本文整理汇总了C++中MamdaOrderBook::getBidMarketOrders方法的典型用法代码示例。如果您正苦于以下问题:C++ MamdaOrderBook::getBidMarketOrders方法的具体用法?C++ MamdaOrderBook::getBidMarketOrders怎么用?C++ MamdaOrderBook::getBidMarketOrders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MamdaOrderBook
的用法示例。
在下文中一共展示了MamdaOrderBook::getBidMarketOrders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prettyPrintLevels
void prettyPrintLevels (const MamdaOrderBook& book)
{
printf ("%s | %s\n",
" Time Num Size Price Act",
"Act Price Size Num Time ");
MamdaOrderBook::constBidIterator bidIter = book.bidBegin ();
MamdaOrderBook::constBidIterator bidEnd = book.bidEnd ();
MamdaOrderBook::constAskIterator askIter = book.askBegin ();
MamdaOrderBook::constAskIterator askEnd = book.askEnd ();
char timeStr[32];
if (mShowMarketOrders)
{
printf (" MARKET ORDERS ---------------------------------------------------------------\n");
const MamdaOrderBookPriceLevel* marketOrders = NULL;
if (marketOrders = book.getBidMarketOrders())
{
marketOrders->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %12s %4d %7g MARKET %c ",
timeStr,
marketOrders->getNumEntries (),
marketOrders->getSize (),
marketOrders->getAction ());
}
else
{
printf (" ");
}
printf ("|");
if (marketOrders = book.getAskMarketOrders())
{
marketOrders->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %c MARKET %-7g %-6d %-12s ",
marketOrders->getAction (),
marketOrders->getSize (),
marketOrders->getNumEntries (),
timeStr);
}
else
{
printf (" ");
}
printf ("\n");
printf (" LIMIT ORDERS ---------------------------------------------------------------\n");
}
while ((bidIter != bidEnd) || (askIter != askEnd))
{
if (bidIter != bidEnd)
{
const MamdaOrderBookPriceLevel* bidLevel = *bidIter;
bidLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %12s %4d %7g %7.*f %c ",
timeStr,
bidLevel->getNumEntries (),
bidLevel->getSize (),
mPrecision,
bidLevel->getPrice (),
bidLevel->getAction ());
++bidIter;
}
else
{
printf (" ");
}
printf ("|");
if (askIter != askEnd)
{
const MamdaOrderBookPriceLevel* askLevel = *askIter;
askLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %c %-7.*f %-7g %-6d %-12s ",
askLevel->getAction (),
mPrecision,
askLevel->getPrice (),
askLevel->getSize (),
askLevel->getNumEntries (),
timeStr);
++askIter;
}
printf ("\n");
}
printf ("\n");
}
示例2: prettyPrintEntries
void prettyPrintEntries (const MamdaOrderBook& book)
{
printf ("%s\n",
" ID/Num Time Size Price");
MamdaOrderBook::constBidIterator bidIter = book.bidBegin ();
MamdaOrderBook::constBidIterator bidEnd = book.bidEnd ();
MamdaOrderBook::constAskIterator askIter = book.askBegin ();
MamdaOrderBook::constAskIterator askEnd = book.askEnd ();
char timeStr[32];
if (mShowMarketOrders)
{
const MamdaOrderBookPriceLevel* marketBidLevel =
book.getBidMarketOrders ();
if (marketBidLevel)
{
marketBidLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" Bid %4d %12s %7g MARKET\n",
marketBidLevel->getNumEntries (),
timeStr,
marketBidLevel->getSize ());
MamdaOrderBookPriceLevel::const_iterator end = marketBidLevel->end ();
MamdaOrderBookPriceLevel::const_iterator i = marketBidLevel->begin ();
while (i != end)
{
const MamdaOrderBookEntry* entry = *i;
const char* id = entry->getId ();
mama_quantity_t size = entry->getSize ();
entry->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %14s %12s %7g MARKET\n",
id, timeStr, size);
++i;
}
}
}
if (mShowMarketOrders)
{
const MamdaOrderBookPriceLevel* marketAskLevel =
book.getAskMarketOrders ();
if (marketAskLevel)
{
marketAskLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" Ask %4d %12s %7g MARKET\n",
marketAskLevel->getNumEntries (),
timeStr,
marketAskLevel->getSize ());
MamdaOrderBookPriceLevel::const_iterator end = marketAskLevel->end ();
MamdaOrderBookPriceLevel::const_iterator i = marketAskLevel->begin ();
while (i != end)
{
const MamdaOrderBookEntry* entry = *i;
const char* id = entry->getId ();
mama_quantity_t size = entry->getSize ();
entry->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %14s %12s %7g MARKET\n",
id, timeStr, size);
++i;
}
}
}
while (bidIter != bidEnd)
{
const MamdaOrderBookPriceLevel* bidLevel = *bidIter;
bidLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" Bid %4d %12s %7g %7.*f\n",
bidLevel->getNumEntries (),
timeStr,
bidLevel->getSize (),
mPrecision,
bidLevel->getPrice ());
MamdaOrderBookPriceLevel::const_iterator end = bidLevel->end ();
MamdaOrderBookPriceLevel::const_iterator i = bidLevel->begin ();
while (i != end)
{
const MamdaOrderBookEntry* entry = *i;
const char* id = entry->getId ();
mama_quantity_t size = entry->getSize ();
double price = bidLevel->getPrice ();
entry->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" %14s %12s %7g %7.*f\n",
id, timeStr, size, mPrecision, price);
++i;
}
++bidIter;
}
while (askIter != askEnd)
{
const MamdaOrderBookPriceLevel* askLevel = *askIter;
askLevel->getTime().getAsFormattedString (timeStr, 32, "%T%;");
printf (" Ask %4d %12s %7g %7.*f\n",
askLevel->getNumEntries (),
timeStr,
askLevel->getSize (),
mPrecision,
askLevel->getPrice ());
MamdaOrderBookPriceLevel::const_iterator end = askLevel->end ();
MamdaOrderBookPriceLevel::const_iterator i = askLevel->begin ();
//.........这里部分代码省略.........