MamdaOrderBookPriceLevel is a class that provides a price level type for order books. More...
#include <MamdaOrderBookPriceLevel.h>
Classes | |
class | iterator |
Public Types | |
enum | Action { MAMDA_BOOK_ACTION_ADD = MamdaOrderBookTypes::MAMDA_BOOK_ACTION_ADD, MAMDA_BOOK_ACTION_UPDATE = MamdaOrderBookTypes::MAMDA_BOOK_ACTION_UPDATE, MAMDA_BOOK_ACTION_DELETE = MamdaOrderBookTypes::MAMDA_BOOK_ACTION_DELETE, MAMDA_BOOK_ACTION_UNKNOWN = MamdaOrderBookTypes::MAMDA_BOOK_ACTION_UNKNOWN } |
An enumeration for price level actions. More... | |
enum | Side { MAMDA_BOOK_SIDE_BID = MamdaOrderBookTypes::MAMDA_BOOK_SIDE_BID, MAMDA_BOOK_SIDE_ASK = MamdaOrderBookTypes::MAMDA_BOOK_SIDE_ASK, MAMDA_BOOK_SIDE_UNKNOWN = MamdaOrderBookTypes::MAMDA_BOOK_SIDE_UNKNOWN } |
An enumeration for the side order book side. More... | |
enum | Reason { MAMDA_BOOK_REASON_MODIFY = MamdaOrderBookTypes::MAMDA_BOOK_REASON_MODIFY, MAMDA_BOOK_REASON_CANCEL = MamdaOrderBookTypes::MAMDA_BOOK_REASON_CANCEL, MAMDA_BOOK_REASON_TRADE = MamdaOrderBookTypes::MAMDA_BOOK_REASON_TRADE, MAMDA_BOOK_REASON_CLOSE = MamdaOrderBookTypes::MAMDA_BOOK_REASON_CLOSE, MAMDA_BOOK_REASON_DROP = MamdaOrderBookTypes::MAMDA_BOOK_REASON_DROP, MAMDA_BOOK_REASON_MISC = MamdaOrderBookTypes::MAMDA_BOOK_REASON_MISC, MAMDA_BOOK_REASON_UNKNOWN = MamdaOrderBookTypes::MAMDA_BOOK_REASON_UNKNOWN } |
An enumeration for a reason for a change. More... | |
enum | OrderType { MAMDA_BOOK_LEVEL_LIMIT = MamdaOrderBookTypes::MAMDA_BOOK_LEVEL_LIMIT, MAMDA_BOOK_LEVEL_MARKET = MamdaOrderBookTypes::MAMDA_BOOK_LEVEL_MARKET, MAMDA_BOOK_LEVEL_UNKNOWN = MamdaOrderBookTypes::MAMDA_BOOK_LEVEL_UNKNOWN } |
An enumeration for the type of level. More... | |
typedef const iterator | const_iterator |
Public Member Functions | |
MamdaOrderBookPriceLevel () | |
MamdaOrderBookPriceLevel (const MamdaOrderBookPriceLevel ©) | |
Copy constructor. More... | |
MamdaOrderBookPriceLevel (double price, Side side) | |
Constructor initializing just the price and side. More... | |
MamdaOrderBookPriceLevel (MamaPrice &price, Side side) | |
~MamdaOrderBookPriceLevel () | |
MamdaOrderBookPriceLevel & | operator= (const MamdaOrderBookPriceLevel &rhs) |
Assignment operator. More... | |
void | copy (const MamdaOrderBookPriceLevel &rhs) |
Copy a price level. More... | |
void | copyLevelOnly (const MamdaOrderBookPriceLevel &rhs) |
Copy a price level details only. More... | |
void | addEntry (MamdaOrderBookEntry *entry) |
Add an entry to the level (without any sanity checking). More... | |
void | updateEntry (const MamdaOrderBookEntry &entry) |
Update an entry by copying the information from another entry. More... | |
void | removeEntryById (const MamdaOrderBookEntry &entry) |
Remove an entry based on the entry ID information from another entry. More... | |
void | removeEntry (const MamdaOrderBookEntry *entry) |
Remove this precise entry (i.e., based on this object being the exact object in the level). More... | |
void | addEntriesFromLevel (const MamdaOrderBookPriceLevel *level, MamdaOrderBookEntryFilter *filter, MamdaOrderBookBasicDeltaList *delta) |
Add all entries from another price level into this level. More... | |
void | deleteEntriesFromSource (const MamaSource *source, MamdaOrderBookBasicDeltaList *delta) |
Delete all entries in this price level that have "source" as its MamaSource. More... | |
bool | reevaluate () |
Re-evaluate the price level. More... | |
void | clear () |
void | setPrice (double price) |
void | setPrice (MamaPrice &price) |
void | setSize (mama_quantity_t size) |
void | setSizeChange (mama_quantity_t sizeChange) |
void | setNumEntries (mama_u32_t numEntries) |
void | setSide (Side side) |
void | setAction (Action action) |
void | setTime (const MamaDateTime &time) |
void | setDetails (const MamdaOrderBookPriceLevel &rhs) |
void | markAllDeleted () |
Mark everything in this price level as deleted, including entries. More... | |
void | setAsDifference (const MamdaOrderBookPriceLevel &lhs, const MamdaOrderBookPriceLevel &rhs) |
double | getPrice () const |
Return the price for this level. More... | |
MamaPrice | getMamaPrice () const |
mama_quantity_t | getSize () const |
Return the total size (across all entries) for this level. More... | |
mama_quantity_t | getSizeChange () const |
Return the size change for this (presumably delta) level. More... | |
mama_u32_t | getNumEntries () const |
Return the actual number of entries for this level. More... | |
mama_u32_t | getNumEntriesTotal () const |
Return the number of entries that can be iterated over. More... | |
bool | empty () const |
Return whether there are no entries for this level. More... | |
Side | getSide () const |
Return the side (bid/ask) of the book for this level. More... | |
Action | getAction () const |
Return the action for this price level. More... | |
const MamaDateTime & | getTime () const |
Return the time stamp for when the price level was last updated. More... | |
bool | operator== (const MamdaOrderBookPriceLevel &rhs) const |
Equality operator. More... | |
bool | operator!= (const MamdaOrderBookPriceLevel &rhs) const |
Non-equality operator. More... | |
void | setOrderBook (MamdaOrderBook *book) |
Set the MamdaOrderBook object to which this price level belongs. More... | |
MamdaOrderBook * | getOrderBook () const |
Get the MamdaOrderBook object to which this entry belongs. More... | |
const char * | getSymbol () const |
Get the symbol for this entry, if possible. More... | |
MamdaOrderBookEntry * | findEntry (const char *id) const |
Return the order book entry with ID "id" in the price level or NULL if not found. More... | |
MamdaOrderBookEntry * | findOrCreateEntry (const char *id) |
Return the order book entry with ID "id" in the price level, creating one if necessary. More... | |
MamdaOrderBookEntry * | findOrCreateEntry (const char *id, bool &newEntry) |
Return the order book entry with ID "id" in the price level, creating one if necessary. More... | |
MamdaOrderBookEntry * | getEntryAtPosition (mama_u32_t pos) const |
Return the order book entry at position "pos" in the price level. More... | |
void | setClosure (void *closure) |
Set the order book price level closure handle. More... | |
void * | getClosure () const |
Get the order book price level closure handle. More... | |
OrderType | getOrderType () const |
Return the order type of the level. More... | |
void | setOrderType (OrderType orderType) |
Set the order type for this level. More... | |
void | assertEqual (const MamdaOrderBookPriceLevel &rhs) const |
Order book price level equality verification. More... | |
iterator | begin () |
const_iterator | begin () const |
iterator & | begin (iterator &reuse) |
const_iterator & | begin (const_iterator &reuse) const |
iterator | end () |
const_iterator | end () const |
iterator & | end (iterator &reuse) |
const_iterator & | end (const_iterator &reuse) const |
iterator | findEntryAfter (iterator &start, const char *id) |
const_iterator | findEntryAfter (const_iterator &start, const char *id) const |
Static Public Member Functions | |
static void | setStrictChecking (bool strict) |
Enforce strict checking of order book modifications (at the expense of some performance). More... | |
Static Public Attributes | |
static bool | sortEntriesByTime |
MamdaOrderBookPriceLevel is a class that provides a price level type for order books.
typedef const iterator Wombat::MamdaOrderBookPriceLevel::const_iterator |
An enumeration for price level actions.
Price level actions differ from entry actions because, for example, a price level message with ACTION_UPDATE may consist of entries with ACTION_ADD, ACTION_UPDATE or ACTION_DELETE.
Enumerator | |
---|---|
MAMDA_BOOK_ACTION_ADD | |
MAMDA_BOOK_ACTION_UPDATE | |
MAMDA_BOOK_ACTION_DELETE | |
MAMDA_BOOK_ACTION_UNKNOWN |
An enumeration for a reason for a change.
Some of the values of Reason can mean the same thing, as far as their affect on the order book. If possible, a feed will send MODIFY, CANCEL or TRADE actions so that downstream applications that are interested in such data can handle it; other applications can treat such actions in the same way as an UPDATE action (or as a DELETE action if the size is zero).
Enumerator | |
---|---|
MAMDA_BOOK_REASON_MODIFY | |
MAMDA_BOOK_REASON_CANCEL | |
MAMDA_BOOK_REASON_TRADE | |
MAMDA_BOOK_REASON_CLOSE | |
MAMDA_BOOK_REASON_DROP | |
MAMDA_BOOK_REASON_MISC | |
MAMDA_BOOK_REASON_UNKNOWN |
Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel | ( | ) |
Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel | ( | const MamdaOrderBookPriceLevel & | copy) |
Copy constructor.
Note that the associated order book of the original copy is not copied.
Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel | ( | double | price, |
Side | side | ||
) |
Constructor initializing just the price and side.
Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel | ( | MamaPrice & | price, |
Side | side | ||
) |
Wombat::MamdaOrderBookPriceLevel::~MamdaOrderBookPriceLevel | ( | ) |
MamdaOrderBookPriceLevel& Wombat::MamdaOrderBookPriceLevel::operator= | ( | const MamdaOrderBookPriceLevel & | rhs) |
Assignment operator.
Note that the associated order book of the original copy is not copied.
void Wombat::MamdaOrderBookPriceLevel::copy | ( | const MamdaOrderBookPriceLevel & | rhs) |
Copy a price level.
Note that the associated order book of the original copy is not copied.
void Wombat::MamdaOrderBookPriceLevel::copyLevelOnly | ( | const MamdaOrderBookPriceLevel & | rhs) |
Copy a price level details only.
No entries are copied.
void Wombat::MamdaOrderBookPriceLevel::addEntry | ( | MamdaOrderBookEntry * | entry) |
Add an entry to the level (without any sanity checking).
void Wombat::MamdaOrderBookPriceLevel::updateEntry | ( | const MamdaOrderBookEntry & | entry) |
Update an entry by copying the information from another entry.
void Wombat::MamdaOrderBookPriceLevel::removeEntryById | ( | const MamdaOrderBookEntry & | entry) |
Remove an entry based on the entry ID information from another entry.
void Wombat::MamdaOrderBookPriceLevel::removeEntry | ( | const MamdaOrderBookEntry * | entry) |
Remove this precise entry (i.e., based on this object being the exact object in the level).
void Wombat::MamdaOrderBookPriceLevel::addEntriesFromLevel | ( | const MamdaOrderBookPriceLevel * | level, |
MamdaOrderBookEntryFilter * | filter, | ||
MamdaOrderBookBasicDeltaList * | delta | ||
) |
Add all entries from another price level into this level.
level | The price level to add. |
filter | Filter to use when adding the entries |
delta | An optional delta to collect for the deleted entries. |
void Wombat::MamdaOrderBookPriceLevel::deleteEntriesFromSource | ( | const MamaSource * | source, |
MamdaOrderBookBasicDeltaList * | delta | ||
) |
Delete all entries in this price level that have "source" as its MamaSource.
source | The source to match. |
delta | An optional delta to collect for the deleted entries. |
bool Wombat::MamdaOrderBookPriceLevel::reevaluate | ( | ) |
Re-evaluate the price level.
This would be performed after the status of sources and/or subsources of an "aggregated order book" (i.e., a book built from multiple sources) have changed.
void Wombat::MamdaOrderBookPriceLevel::clear | ( | ) |
void Wombat::MamdaOrderBookPriceLevel::setPrice | ( | double | price) |
void Wombat::MamdaOrderBookPriceLevel::setPrice | ( | MamaPrice & | price) |
void Wombat::MamdaOrderBookPriceLevel::setSize | ( | mama_quantity_t | size) |
void Wombat::MamdaOrderBookPriceLevel::setSizeChange | ( | mama_quantity_t | sizeChange) |
void Wombat::MamdaOrderBookPriceLevel::setNumEntries | ( | mama_u32_t | numEntries) |
void Wombat::MamdaOrderBookPriceLevel::setSide | ( | Side | side) |
void Wombat::MamdaOrderBookPriceLevel::setAction | ( | Action | action) |
void Wombat::MamdaOrderBookPriceLevel::setTime | ( | const MamaDateTime & | time) |
void Wombat::MamdaOrderBookPriceLevel::setDetails | ( | const MamdaOrderBookPriceLevel & | rhs) |
void Wombat::MamdaOrderBookPriceLevel::markAllDeleted | ( | ) |
Mark everything in this price level as deleted, including entries.
void Wombat::MamdaOrderBookPriceLevel::setAsDifference | ( | const MamdaOrderBookPriceLevel & | lhs, |
const MamdaOrderBookPriceLevel & | rhs | ||
) |
double Wombat::MamdaOrderBookPriceLevel::getPrice | ( | ) | const |
Return the price for this level.
MamaPrice Wombat::MamdaOrderBookPriceLevel::getMamaPrice | ( | ) | const |
mama_quantity_t Wombat::MamdaOrderBookPriceLevel::getSize | ( | ) | const |
Return the total size (across all entries) for this level.
mama_quantity_t Wombat::MamdaOrderBookPriceLevel::getSizeChange | ( | ) | const |
Return the size change for this (presumably delta) level.
This attribute is only of interest for delta order books. For full order books, this field will be equal to the size of the price level.
mama_u32_t Wombat::MamdaOrderBookPriceLevel::getNumEntries | ( | ) | const |
Return the actual number of entries for this level.
The actual number of entries may not equate to the number of entries that can be iterated over if: (a) the feed does not provide the actual entries, or (b) the price level is just a delta.
mama_u32_t Wombat::MamdaOrderBookPriceLevel::getNumEntriesTotal | ( | ) | const |
Return the number of entries that can be iterated over.
bool Wombat::MamdaOrderBookPriceLevel::empty | ( | ) | const |
Return whether there are no entries for this level.
Side Wombat::MamdaOrderBookPriceLevel::getSide | ( | ) | const |
Return the side (bid/ask) of the book for this level.
Action Wombat::MamdaOrderBookPriceLevel::getAction | ( | ) | const |
Return the action for this price level.
All price levels for a full book are marked with ACTION_ADD.
const MamaDateTime& Wombat::MamdaOrderBookPriceLevel::getTime | ( | ) | const |
Return the time stamp for when the price level was last updated.
bool Wombat::MamdaOrderBookPriceLevel::operator== | ( | const MamdaOrderBookPriceLevel & | rhs) | const |
Equality operator.
Two price levels are equal if their members and price level entries are identical.
rhs | The order book price level to compare this level to. |
bool Wombat::MamdaOrderBookPriceLevel::operator!= | ( | const MamdaOrderBookPriceLevel & | rhs) | const |
Non-equality operator.
Two price levels are equal if their members and price level entries are identical.
rhs | The order book price level to compare this level to. |
void Wombat::MamdaOrderBookPriceLevel::setOrderBook | ( | MamdaOrderBook * | book) |
Set the MamdaOrderBook object to which this price level belongs.
This method is invoked internally, by the MAMDA API, when a price level is added to a book.
book | The order book to be associated with |
MamdaOrderBook* Wombat::MamdaOrderBookPriceLevel::getOrderBook | ( | ) | const |
Get the MamdaOrderBook object to which this entry belongs.
const char* Wombat::MamdaOrderBookPriceLevel::getSymbol | ( | ) | const |
Get the symbol for this entry, if possible.
This can only be done if the price level is part of an order book. NULL is returned if no symbol can be found.
MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::findEntry | ( | const char * | id) | const |
Return the order book entry with ID "id" in the price level or NULL if not found.
id | The ID of the order book entry. |
MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::findOrCreateEntry | ( | const char * | id) |
Return the order book entry with ID "id" in the price level, creating one if necessary.
id | The ID of the order book entry. |
MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::findOrCreateEntry | ( | const char * | id, |
bool & | newEntry | ||
) |
Return the order book entry with ID "id" in the price level, creating one if necessary.
id | The ID of the order book entry. |
newEntry | Boolean reference indicating entry creation. |
MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::getEntryAtPosition | ( | mama_u32_t | pos) | const |
Return the order book entry at position "pos" in the price level.
pos | The position of the order book entry. |
void Wombat::MamdaOrderBookPriceLevel::setClosure | ( | void * | closure) |
Set the order book price level closure handle.
closure | The closure. |
void* Wombat::MamdaOrderBookPriceLevel::getClosure | ( | ) | const |
Get the order book price level closure handle.
OrderType Wombat::MamdaOrderBookPriceLevel::getOrderType | ( | ) | const |
Return the order type of the level.
void Wombat::MamdaOrderBookPriceLevel::setOrderType | ( | OrderType | orderType) |
Set the order type for this level.
orderType | The order type of the level. |
void Wombat::MamdaOrderBookPriceLevel::assertEqual | ( | const MamdaOrderBookPriceLevel & | rhs) | const |
Order book price level equality verification.
A MamdaOrderBookException is thrown if the price levels are not equal, along with the reason for the inequality.
rhs | The order book price level to compare this level to. |
<MamdaOrderBookException> | If error encountered during book processing. |
iterator Wombat::MamdaOrderBookPriceLevel::begin | ( | ) |
const_iterator Wombat::MamdaOrderBookPriceLevel::begin | ( | ) | const |
const_iterator& Wombat::MamdaOrderBookPriceLevel::begin | ( | const_iterator & | reuse) | const |
iterator Wombat::MamdaOrderBookPriceLevel::end | ( | ) |
const_iterator Wombat::MamdaOrderBookPriceLevel::end | ( | ) | const |
const_iterator& Wombat::MamdaOrderBookPriceLevel::end | ( | const_iterator & | reuse) | const |
const_iterator Wombat::MamdaOrderBookPriceLevel::findEntryAfter | ( | const_iterator & | start, |
const char * | id | ||
) | const |
|
static |
Enforce strict checking of order book modifications (at the expense of some performance).
This setting is automatically updated by MamdaOrderBook::setStrictChecking().
strict | Whether strict checking of modification is enabled. |
|
static |