当前位置: 首页>>代码示例>>C++>>正文


C++ MamdaOrderBook::getSymbol方法代码示例

本文整理汇总了C++中MamdaOrderBook::getSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ MamdaOrderBook::getSymbol方法的具体用法?C++ MamdaOrderBook::getSymbol怎么用?C++ MamdaOrderBook::getSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MamdaOrderBook的用法示例。


在下文中一共展示了MamdaOrderBook::getSymbol方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSymbol

const char* MamdaQuoteToBookListenerImpl::getSymbol() const
{
    if (mFullBook)
        return mFullBook->getSymbol();
    else
        return "unknown-symbol";
}
开发者ID:MattMulhern,项目名称:OpenMamaCassandra,代码行数:7,代码来源:MamdaQuoteToBookListener.cpp

示例2: displayEntries

void BookViewer::displayEntries (const MamdaOrderBook&  book)
{
    const char* symbol = book.getSymbol ();
    int symbolCol = sMidColumn - (strlen (symbol)/2);
    attron (A_BOLD);
    mvprintw (0, symbolCol, "%s", symbol);
    attroff (A_BOLD);

    /* Bid entries */
    attron (A_BOLD);
    mvprintw (1, 0, "%s", sBidHeading);
    attroff (A_BOLD);
    MamdaOrderBook::constBidIterator bidIter = book.bidBegin ();
    MamdaOrderBook::constBidIterator bidEnd  = book.bidEnd ();
    int colorId = 1;
    for (int i = 2; i < LINES-1;)
    {
        if (bidIter != bidEnd)
        {
            const MamdaOrderBookPriceLevel* bidLevel = *bidIter;
            displayBidEntriesInLevel (bidLevel, i, colorId);
            ++bidIter;
            ++colorId;
        }
        else
        {
            mvprintw (i, 0, "                                              |");
            i++;
        }
    }

    /* Ask entries */
    attron (A_BOLD);
    mvprintw (1, sMidColumn+1, "%s", sAskHeading);
    attroff (A_BOLD);
    MamdaOrderBook::constAskIterator askIter = book.askBegin ();
    MamdaOrderBook::constAskIterator askEnd  = book.askEnd ();
    colorId = 1;
    for (int i = 2; i < LINES-1;)
    {
        if (askIter!= askEnd)
        {
            const MamdaOrderBookPriceLevel* askLevel = *askIter;
            displayAskEntriesInLevel (askLevel, i, colorId);
            ++askIter;
            ++colorId;
        }
        else
        {
            mvprintw (i, sMidColumn+1,
                     "                                              ");
            i++;
        }
    }

    refresh ();  // refresh the screen
}
开发者ID:OpenMAMA,项目名称:OpenMAMA,代码行数:57,代码来源:bookviewer.cpp

示例3: displayLevels

void BookViewer::displayLevels (const MamdaOrderBook&  book)
{
    const char* symbol = book.getSymbol ();
    int symbolCol = sMidColumn - (strlen (symbol)/2);
    attron (A_BOLD);
    mvprintw (0, symbolCol, "%s", symbol);
    mvprintw (1, 0, "%s | %s",
             "        Time     Num    Size   Price",
             "Price   Size    Num       Time  ");
    attroff (A_BOLD);

    MamdaOrderBook::constBidIterator bidIter = book.bidBegin ();
    MamdaOrderBook::constBidIterator bidEnd  = book.bidEnd ();
    MamdaOrderBook::constAskIterator askIter = book.askBegin ();
    MamdaOrderBook::constAskIterator askEnd  = book.askEnd ();

    for (int i = 2; i < LINES-1; i++)
    {
        move (i, 0);
        if (i < 7)
            attron (COLOR_PAIR (i-1));
        if (bidIter != bidEnd)
        {
            const MamdaOrderBookPriceLevel* bidLevel = *bidIter;
            printw ("   %12s %4d %7d %7.4f ",
                    bidLevel->getTime ().getTimeAsString (),
                    bidLevel->getNumEntries (),
                    (long)bidLevel->getSize (),
                    bidLevel->getPrice ());
            ++bidIter;
        }
        else
        {
            printw ("                                     ");
        }

        printw ("|");

        if (askIter!= askEnd)
        {
            const MamdaOrderBookPriceLevel* askLevel = *askIter;
            printw (" %-7.4f %-7d %-6d %-12s   ",
                    askLevel->getPrice (),
                    (long)askLevel->getSize (),
                    askLevel->getNumEntries (),
                    askLevel->getTime ().getTimeAsString ());
            ++askIter;
        }
        else
        {
            printw ("                                     ");
        }
        if (i < 7)
            attroff (COLOR_PAIR (i-1));
    }
    refresh ();  // refresh the screen
}
开发者ID:OpenMAMA,项目名称:OpenMAMA,代码行数:57,代码来源:bookviewer.cpp

示例4: prettyPrintEntries

    /*
     * Helper function to print the entries in a MamdaOrderBook
     */
    void prettyPrintEntries (const MamdaOrderBook& book)
    {
        printf ("Book for: %s\n", book.getSymbol ());
        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 (),
//.........这里部分代码省略.........
开发者ID:OpenMAMA,项目名称:OpenMAMA,代码行数:101,代码来源:atomicbookbuilder.cpp

示例5: prettyPrintLevels

    /*
     * Helper function to print the levels in a MamdaOrderBook
     */
    void prettyPrintLevels (const MamdaOrderBook& book)
    {
        printf ("Book for: %s\n", book.getSymbol ());
        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 = book.getBidMarketOrders();

            if (marketOrders)
            {
                marketOrders->getTime().getAsFormattedString (timeStr, 32, "%T%;");
                printf ("   %12s %4d %7g  MARKET  %c  ",
                        timeStr,
                        marketOrders->getNumEntries (),
                        marketOrders->getSize (),
                        marketOrders->getAction ());
            }
            else
            {
                printf ("                                         ");
            }

            printf ("|");

            marketOrders = book.getAskMarketOrders();
            if (marketOrders)
            {
                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");
    }
开发者ID:OpenMAMA,项目名称:OpenMAMA,代码行数:92,代码来源:atomicbookbuilder.cpp


注:本文中的MamdaOrderBook::getSymbol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。