1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
class SystemApiClientDemo : public SystemApi {
public:
void onTrade(const Trade &trade);
void onTradeTick(std::string symbol,
int size,
double price,
int totalVolume,
std::string exchangeId,
std::string quoteSource,
Timestamp timestamp,
std::string tradeType);
}
void SystemApiClientDemo::onTrade(const Trade &trade)
{
std::string symbol;
map<int, std::string>::const_iterator searchResult = symbolIndexToName.find(trade.symbolIndex);
if (searchResult != symbolIndexToName.end())
symbol = symbolIndexToName[trade.symbolIndex];
int size = trade.size;
double price = trade.priceMantissa * (double)pow(10.0, trade.priceExponent);
long totalVolume = trade.totalVolume;
std::string exchangeId = trade.exchangeId;
std::string quoteSource = trade.quoteSource;
Timestamp timestamp = trade.timestamp;
std::string tradeType = trade.tradeType;
if(!printQuotes) return;
std::cout << "onTradeTick: symbol = " << symbol
<< ", size = " << size
<< ", price = " << std::showpoint << std::fixed << std::setprecision(4) << price
<< ", totalVolume = " << totalVolume
<< ", exchangeId = " << exchangeId
<< ", quoteSource = " << quoteSource
<< ", timestamp = " << timestamp
<< ", tradeType = " << tradeType
<< std::endl;
}
//This is where I am trying to convert the timestamp to a string
| |