本文整理汇总了C++中MamdaOrderBook::getQuality方法的典型用法代码示例。如果您正苦于以下问题:C++ MamdaOrderBook::getQuality方法的具体用法?C++ MamdaOrderBook::getQuality怎么用?C++ MamdaOrderBook::getQuality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MamdaOrderBook
的用法示例。
在下文中一共展示了MamdaOrderBook::getQuality方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onBookAtomicEndBook
/**
* Method invoked when we stop processing the last level in a message. We
* invoke this method after the last entry for the level gets processed.
* The subscription may be destroyed from this callback.
*/
void onBookAtomicEndBook (
MamdaSubscription* subscription,
MamdaBookAtomicListener& listener)
{
/**
* When level recap/delta is received, it is stored in a MamdaOrderBookPriceLevel.
* If no entry deltas/recaps are received, then the price level should be applied
* to the book.
* The entry delta/recap callback will mark the price level with an UNKNOWN side to
* show that it does not need to be applied to the book
*/
if(mReusablePriceLevel.getSide() != MamdaOrderBookPriceLevel::MAMDA_BOOK_SIDE_UNKNOWN)
{
if (gExampleLogLevel == EXAMPLE_LOG_LEVEL_NORMAL
&& mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
prettyPrint(subscription, mReusablePriceLevel);
}
applyLevel(mReusablePriceLevel);
mReusablePriceLevel.setSide(MamdaOrderBookPriceLevel::MAMDA_BOOK_SIDE_UNKNOWN);
}
if(mOrderBook.getQuality() == MAMA_QUALITY_OK && gExampleLogLevel == EXAMPLE_LOG_LEVEL_NORMAL)
{
prettyPrint(mOrderBook);
}
cout<< "BOOK END\n";
}
示例2: setQuality
void MamdaQuoteToBookListenerImpl::setQuality (
MamdaSubscription* sub,
mamaQuality quality)
{
if (mFullBook->getQuality() == quality)
return; // no change
mFullBook->setQuality (quality);
switch (quality)
{
case MAMA_QUALITY_OK:
break;
case MAMA_QUALITY_STALE:
case MAMA_QUALITY_MAYBE_STALE:
case MAMA_QUALITY_PARTIAL_STALE:
case MAMA_QUALITY_FORCED_STALE:
case MAMA_QUALITY_UNKNOWN:
if (mClearStaleBook)
{
acquireLock();
clear();
invokeClearHandlers (sub, NULL);
releaseLock();
}
}
}
示例3: onBookAtomicLevelDelta
/**
* Method invoked when an order book delta is reported.
*/
void onBookAtomicLevelDelta (
MamdaSubscription* subscription,
MamdaBookAtomicListener& listener,
const MamaMsg& msg,
const MamdaBookAtomicLevel& level)
{
/**
* The level should only be processed when entires are not received
* i.e. for level only based feeds
* If an entry was received on the previous level, then the level will
* have been marked with an UNKNOWN side and should not be applied to
* the book
*/
if(mReusablePriceLevel.getSide() != MamdaOrderBookPriceLevel::MAMDA_BOOK_SIDE_UNKNOWN)
{
if (gExampleLogLevel == EXAMPLE_LOG_LEVEL_NORMAL
&& mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
prettyPrint(subscription, mReusablePriceLevel);
}
applyLevel(mReusablePriceLevel);
}
/**
* Store the current level
*/
storeLevel(level);
}
示例4: onBookAtomicLevelEntryDelta
/**
* Method invoked when an order book delta is reported.
*/
void onBookAtomicLevelEntryDelta (
MamdaSubscription* subscription,
MamdaBookAtomicListener& listener,
const MamaMsg& msg,
const MamdaBookAtomicLevelEntry& levelEntry)
{
if (gExampleLogLevel == EXAMPLE_LOG_LEVEL_NORMAL
&& mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
prettyPrint (subscription, levelEntry);
}
applyEntry (levelEntry);
/**
* An entry has been processed on the level so mark the level with
* an unknown side so that it will not be applied to book
*/
mReusablePriceLevel.setSide (MamdaOrderBookPriceLevel::MAMDA_BOOK_SIDE_UNKNOWN);
}
示例5: onBookAtomicBeginBook
/**
* Method invoked before we start processing the first level in a message.
* The book should be cleared when isRecap == true.
*/
void onBookAtomicBeginBook (
MamdaSubscription* subscription,
MamdaBookAtomicListener& listener,
bool isRecap)
{
cout<< "BOOK BEGIN\n";
if(isRecap)
mOrderBook.clear();
if(mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
if(isRecap)
{
cout << "RECAP!!!\n";
}
else
{
cout << "DELTA!!!\n";
}
}
}
示例6: applyEntry
/**
* Helper function to apply a MamdaBookAtomicLevelEntry to
* a MamdaOrderBook
*/
void applyEntry (const MamdaBookAtomicLevelEntry& levelEntry)
{
MamdaOrderBookEntry::Action entryAction;
if(mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
entryAction = (MamdaOrderBookEntry::Action) levelEntry.getPriceLevelEntryAction();
switch(entryAction)
{
case MamdaOrderBookEntry::MAMDA_BOOK_ACTION_UPDATE :
try
{
//get the price level by price
mLevelPtr = mOrderBook.findLevel(
levelEntry.getPriceLevelPrice(),
(MamdaOrderBookPriceLevel::Side) levelEntry.getPriceLevelSide());
if(mLevelPtr != NULL)
{
//get the entry by id
mEntryPtr = mLevelPtr->findEntry(levelEntry.getPriceLevelEntryId());
if(mEntryPtr != NULL)
{
mOrderBook.updateEntry(
mEntryPtr,
levelEntry.getPriceLevelEntrySize(),
levelEntry.getPriceLevelEntryTime(),
(MamdaOrderBookBasicDelta*) NULL);
break;
}
}
/*
* intentional fall through to add the entry if
* the entry or level cannot be found to update it
*/
}
catch ( MamdaOrderBookInvalidEntry &e)
{
cout<< "atomicbookbuilder: could not update entry.\n";
cout << "Caught MamdaOrderBookInvalidEntry [" << e.what() << "]\n";
}
catch (MamdaOrderBookException &e)
{
cout<< "atomicbookbuilder: could not update entry.\n";
cout<< "Caught MamdaOrderBookException [" << e.what() << "[\n";
}
case MamdaOrderBookEntry::MAMDA_BOOK_ACTION_ADD :
mEntryPtr = mOrderBook.addEntry(
levelEntry.getPriceLevelEntryId(),
levelEntry.getPriceLevelEntrySize(),
levelEntry.getPriceLevelPrice(),
(MamdaOrderBookPriceLevel::Side) levelEntry.getPriceLevelSide(),
levelEntry.getPriceLevelEntryTime(),
(const MamaSourceDerivative*) NULL,
(MamdaOrderBookBasicDelta*) NULL);
mEntryPtr->setReason(
(MamdaOrderBookTypes::Reason)levelEntry.getPriceLevelEntryReason());
break;
case MamdaOrderBookEntry::MAMDA_BOOK_ACTION_DELETE :
try
{
//get the price level by price
mLevelPtr = mOrderBook.findLevel(
levelEntry.getPriceLevelPrice(),
(MamdaOrderBookPriceLevel::Side) levelEntry.getPriceLevelSide());
if(mLevelPtr != NULL)
{
//get the entry by id
mEntryPtr = mLevelPtr->findEntry(levelEntry.getPriceLevelEntryId());
if(mEntryPtr != NULL)
mOrderBook.deleteEntry(
mEntryPtr,
levelEntry.getPriceLevelEntryTime(),
(MamdaOrderBookBasicDelta*) NULL);
}
}
catch ( MamdaOrderBookInvalidEntry &e)
{
cout<< "atomicbookbuilder: could not delete entry.\n";
cout << "Caught MamdaOrderBookInvalidEntry [" << e.what() << "]\n";
}
catch (MamdaOrderBookException &e)
{
cout<< "atomicbookbuilder: could not delete entry.\n";
cout<< "Caught MamdaOrderBookException [" << e.what() << "[\n";
}
break;
default:
cout << "atomicbookbuilder: Unknown entry action ["
<< (char)entryAction << "]\n";
break;
}
//.........这里部分代码省略.........
示例7: applyLevel
/**
* Helper function to apply a MamdaOrderBookPriceLevel to
* a MamdaOrderBook
*/
void applyLevel (MamdaOrderBookPriceLevel& level)
{
if(mOrderBook.getQuality() == MAMA_QUALITY_OK)
{
switch(level.getAction())
{
case MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_UPDATE :
try
{
/*
* When in the order book the only Action which makes sense is
* ADD
*/
level.setAction(MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_ADD);
mOrderBook.updateLevel(level);
}
catch ( MamdaOrderBookException &e)
{
//Exception is thrown when updating level which does not exist
//level will be added so handled internally
}
break;
case MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_ADD :
try
{
mLevelPtr = new MamdaOrderBookPriceLevel(level);
/*
* When in the order book the only Action which makes sense is
* ADD
*/
mLevelPtr->setAction(MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_ADD);
mOrderBook.addLevel(*mLevelPtr);
//ownership of ptr passed to MamdaOrderBook
}
catch ( MamdaOrderBookException &e)
{
//Exception is thrown if adding a level already in book
//handled internally by updating level
delete mLevelPtr;
}
break;
case MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_DELETE :
try
{
mOrderBook.deleteLevel(mReusablePriceLevel);
}
catch (MamdaOrderBookException &e)
{
//Thrown if the level cannot be found in the book
//No need for handling as level is deleted
}
break;
default:
cout << "atomicbookbuilder: Unknown price level ["
<< level.getAction() << "]\n";
break;
}
mLevelPtr = NULL;
}
}