本文整理汇总了C++中O2G2Ptr::getAmount方法的典型用法代码示例。如果您正苦于以下问题:C++ O2G2Ptr::getAmount方法的具体用法?C++ O2G2Ptr::getAmount怎么用?C++ O2G2Ptr::getAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类O2G2Ptr
的用法示例。
在下文中一共展示了O2G2Ptr::getAmount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printTrades
void TableListener::printTrades(std::vector<IO2GTradeRow*> &trades, std::string &sOrderID)
{
if (trades.size() == 0)
return;
std::cout << "For the order: OrderID=" << sOrderID << " the following positions have been opened: " << std::endl;
for (size_t i = 0; i < trades.size(); ++i)
{
O2G2Ptr<IO2GTradeRow> trade = trades[i];
std::string tradeID = trade->getTradeID();
int amount = trade->getAmount();
double rate = trade->getOpenRate();
std::cout << "Trade ID: " << tradeID << ", "
<< "Amount: " << amount << ", "
<< "Rate: " << rate << std::endl;
}
}
示例2: onTablesUpdates
/** Request update data received data handler. */
void ResponseListener::onTablesUpdates(IO2GResponse *data)
{
if (data)
{
O2G2Ptr<IO2GResponseReaderFactory> factory = mSession->getResponseReaderFactory();
if (factory)
{
O2G2Ptr<IO2GTablesUpdatesReader> reader = factory->createTablesUpdatesReader(data);
if (reader)
{
for (int i = 0; i < reader->size(); ++i)
{
switch (reader->getUpdateTable(i))
{
case Orders:
{
O2G2Ptr<IO2GOrderRow> order = reader->getOrderRow(i);
if (mRequestID != order->getRequestID())
break;
switch (reader->getUpdateType(i))
{
case Insert:
if ((isClosingOrder(order) || isOpeningOrder(order)) &&
mOrderMonitorNetting == NULL)
{
std::cout << "The order has been added. OrderID='" << order->getOrderID() << "', "
<< "Rate='" << order->getRate() << "', "
<< "TimeInForce='" << order->getTimeInForce() << "'"
<< std::endl;
O2G2Ptr<IO2GTradeRow> trade = NULL;
std::string sTradeID = std::string(order->getTradeID());
if (mTradesTable)
{
for (int j = 0; j < mTradesTable->size(); ++j)
{
if (sTradeID == mTradesTable->getRow(j)->getTradeID())
{
trade = mTradesTable->getRow(j);
break;
}
}
}
if (trade)
mOrderMonitorNetting = new OrderMonitorNetting(order, trade->getAmount());
else
mOrderMonitorNetting = new OrderMonitorNetting(order, 0);
}
break;
case Delete:
if (mOrderMonitorNetting)
{
std::cout << "The order has been deleted. OrderID='" << order->getOrderID() << "'"
<< std::endl;
mOrderMonitorNetting->onOrderDeleted(order);
if (mOrderMonitorNetting->isOrderCompleted())
{
printResult();
SetEvent(mResponseEvent);
}
}
break;
}
}
break;
case Trades:
{
O2G2Ptr<IO2GTradeRow> trade = reader->getTradeRow(i);
switch (reader->getUpdateType(i))
{
case Insert:
{
if (mOrderMonitorNetting)
{
mOrderMonitorNetting->onTradeAdded(trade);
if (mOrderMonitorNetting->isOrderCompleted())
{
printResult();
SetEvent(mResponseEvent);
}
}
}
break;
case Update:
{
if (mOrderMonitorNetting)
{
mOrderMonitorNetting->onTradeUpdated(trade);
if (mOrderMonitorNetting->isOrderCompleted())
{
printResult();
SetEvent(mResponseEvent);
}
}
}
break;
}
}
break;
case ClosedTrades:
//.........这里部分代码省略.........