MamdaOrderBookEntry is a class that represents an entry within a price level of an order book. More...
#include <MamdaOrderBookEntry.h>
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 book entry actions. More... | |
Public Member Functions | |
MamdaOrderBookEntry () | |
MamdaOrderBookEntry (const MamdaOrderBookEntry ©) | |
Copy constructor. More... | |
MamdaOrderBookEntry (const char *entryId, mama_quantity_t size, Action action, const MamaDateTime &entryTime, const MamaSourceDerivative *deriv) | |
Constructor that takes the basic information for the entry ID, size, action and time. More... | |
~MamdaOrderBookEntry () | |
MamdaOrderBookEntry & | operator= (const MamdaOrderBookEntry &rhs) |
Assignment operator. More... | |
void | clear () |
void | copy (const MamdaOrderBookEntry ©) |
Copy an order book entry. More... | |
void | setId (const char *id) |
void | setUniqueId (const char *id) |
void | setSize (mama_quantity_t size) |
void | setAction (Action action) |
void | setReason (MamdaOrderBookTypes::Reason reason) |
void | setTime (const MamaDateTime &time) |
void | setStatus (mama_u16_t status) |
void | setDetails (const MamdaOrderBookEntry ©) |
const char * | getId () const |
If supported, Order book entry ID (order ID, participant ID, etc.) More... | |
const char * | getUniqueId () const |
If supported, Order book entry unique ID (order ID, participant ID, etc.). More... | |
mama_quantity_t | getSize () const |
The size of the order entry. More... | |
Action | getAction () const |
Whether to ADD, UPDATE or DELETE the entry. More... | |
MamdaOrderBookTypes::Reason | getReason () const |
Reason for a change. More... | |
const MamaDateTime & | getTime () const |
Time of order book entry update. More... | |
mama_u16_t | getStatus () const |
Get the status. More... | |
double | getPrice () const |
Get the price for this entry. More... | |
MamaPrice | getMamaPrice () const |
MamdaOrderBookPriceLevel::Side | getSide () const |
Get the price for this entry. More... | |
mama_u32_t | getPosition (mama_u32_t maxPos=0) const |
Get the position in the order book for this entry. More... | |
bool | equalId (const char *id) const |
Whether two participant ids are equal. More... | |
bool | operator== (const MamdaOrderBookEntry &rhs) const |
Equality operator. More... | |
bool | operator!= (const MamdaOrderBookEntry &rhs) const |
Non-equality operator. More... | |
void | setPriceLevel (MamdaOrderBookPriceLevel *level) |
Set the MamdaOrderBookPriceLevel object to which this entry belongs. More... | |
MamdaOrderBookPriceLevel * | getPriceLevel () const |
Get the MamdaOrderBookPriceLevel object to which this entry belongs. More... | |
MamdaOrderBook * | getOrderBook () const |
Get the order book for this entry, if possible. More... | |
void | setManager (MamdaOrderBookEntryManager *manager) |
Set the MamdaOrderBookEntryManager object to which this entry belongs. More... | |
MamdaOrderBookEntryManager * | getManager () const |
Get the MamdaOrderBookEntryManager object to which this entry belongs. More... | |
const char * | getSymbol () const |
Get the symbol for this entry, if possible. More... | |
void | setSourceDerivative (const MamaSourceDerivative *deriv) |
Set the MamaSourceDerivative for this book entry. More... | |
const MamaSourceDerivative * | getSourceDerivative () const |
Return the MamaSourceDerivative for this book entry. More... | |
const MamaSource * | getSource () const |
Return the MamaSource for this book entry. More... | |
mamaSourceState | getSourceState () const |
Get the source state. More... | |
bool | getCheckSourceState () const |
Get whether this order book wants to check the source state. More... | |
void | setQuality (mamaQuality quality) |
Set the entry-level quality factor. More... | |
mamaQuality | getQuality () const |
Get the entry-level quality factor. More... | |
bool | isVisible () const |
Get whether this entry is "visible" in this book. More... | |
void | setClosure (void *closure) |
Set the order book entry closure handle. More... | |
void * | getClosure () const |
Get the order book entry closure handle. More... | |
void | assertEqual (const MamdaOrderBookEntry &rhs) const |
Order book entry equality verification. More... | |
Static Public Member Functions | |
static void | setStrictChecking (bool strict) |
Enforce strict checking of order book modifications (at the expense of some performance). More... | |
MamdaOrderBookEntry is a class that represents an entry within a price level of an order book.
In addition to being referenced in a MamdaOrderBookPriceLevel, an order book entry may also be stored in a MamdaOrderBookEntryManager.
An enumeration for book entry 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 |
Wombat::MamdaOrderBookEntry::MamdaOrderBookEntry | ( | ) |
Wombat::MamdaOrderBookEntry::MamdaOrderBookEntry | ( | const MamdaOrderBookEntry & | copy) |
Copy constructor.
Note that the associated price level of the original copy is not copied.
Wombat::MamdaOrderBookEntry::MamdaOrderBookEntry | ( | const char * | entryId, |
mama_quantity_t | size, | ||
Action | action, | ||
const MamaDateTime & | entryTime, | ||
const MamaSourceDerivative * | deriv | ||
) |
Constructor that takes the basic information for the entry ID, size, action and time.
Wombat::MamdaOrderBookEntry::~MamdaOrderBookEntry | ( | ) |
MamdaOrderBookEntry& Wombat::MamdaOrderBookEntry::operator= | ( | const MamdaOrderBookEntry & | rhs) |
Assignment operator.
Note that the associated price level of the original copy is not copied.
void Wombat::MamdaOrderBookEntry::clear | ( | ) |
void Wombat::MamdaOrderBookEntry::copy | ( | const MamdaOrderBookEntry & | copy) |
Copy an order book entry.
Note that the associated price level of the original copy is not copied.
void Wombat::MamdaOrderBookEntry::setId | ( | const char * | id) |
void Wombat::MamdaOrderBookEntry::setUniqueId | ( | const char * | id) |
void Wombat::MamdaOrderBookEntry::setSize | ( | mama_quantity_t | size) |
void Wombat::MamdaOrderBookEntry::setAction | ( | Action | action) |
void Wombat::MamdaOrderBookEntry::setReason | ( | MamdaOrderBookTypes::Reason | reason) |
void Wombat::MamdaOrderBookEntry::setTime | ( | const MamaDateTime & | time) |
void Wombat::MamdaOrderBookEntry::setStatus | ( | mama_u16_t | status) |
void Wombat::MamdaOrderBookEntry::setDetails | ( | const MamdaOrderBookEntry & | copy) |
const char* Wombat::MamdaOrderBookEntry::getId | ( | ) | const |
If supported, Order book entry ID (order ID, participant ID, etc.)
const char* Wombat::MamdaOrderBookEntry::getUniqueId | ( | ) | const |
If supported, Order book entry unique ID (order ID, participant ID, etc.).
The unique ID should be unique throughout the order book. If no explicit unique ID has been set, then it assumed that the basic ID is unique and that is returned.
mama_quantity_t Wombat::MamdaOrderBookEntry::getSize | ( | ) | const |
The size of the order entry.
Action Wombat::MamdaOrderBookEntry::getAction | ( | ) | const |
Whether to ADD, UPDATE or DELETE the entry.
MamdaOrderBookTypes::Reason Wombat::MamdaOrderBookEntry::getReason | ( | ) | const |
Reason for a change.
const MamaDateTime& Wombat::MamdaOrderBookEntry::getTime | ( | ) | const |
Time of order book entry update.
mama_u16_t Wombat::MamdaOrderBookEntry::getStatus | ( | ) | const |
Get the status.
double Wombat::MamdaOrderBookEntry::getPrice | ( | ) | const |
Get the price for this entry.
This method will throw a MamdaOrderBookInvalidEntry if no MamdaPriceLevel is associated with it because order book price information is only stored in MamdaOrderBookPriceLevel objects.
MamaPrice Wombat::MamdaOrderBookEntry::getMamaPrice | ( | ) | const |
MamdaOrderBookPriceLevel::Side Wombat::MamdaOrderBookEntry::getSide | ( | ) | const |
Get the price for this entry.
This method will throw a MamdaOrderBookInvalidEntry if no MamdaPriceLevel is associated with it because order book price information is only stored in MamdaOrderBookPriceLevel objects.
mama_u32_t Wombat::MamdaOrderBookEntry::getPosition | ( | mama_u32_t | maxPos = 0 ) | const |
Get the position in the order book for this entry.
If maxPos is not zero, then the method will return a result no greater than maxPos. This is to prevent searching the entire book when only a limited search is necessary. Note: the logic used in the positional search is to use the number of entries that MamdaOrderBookPriceLevel::getNumEntries() returns for price levels above the entry's price level. -1 is return if the entry is in the book but not currently "visible" (i.e., it is being omitted because the MAMA source is turned off). A MamdaOrderBookInvalidEntry is thrown if the entry is not found in the book.
maxPos | The maximum position to return; |
bool Wombat::MamdaOrderBookEntry::equalId | ( | const char * | id) | const |
Whether two participant ids are equal.
bool Wombat::MamdaOrderBookEntry::operator== | ( | const MamdaOrderBookEntry & | rhs) | const |
Equality operator.
Two order book entries are equal if their members are identical.
rhs | The order book entry to compare this entry to. |
bool Wombat::MamdaOrderBookEntry::operator!= | ( | const MamdaOrderBookEntry & | rhs) | const |
Non-equality operator.
Two order book entries are equal if their members are identical.
rhs | The order book entry to compare this entry to. |
void Wombat::MamdaOrderBookEntry::setPriceLevel | ( | MamdaOrderBookPriceLevel * | level) |
Set the MamdaOrderBookPriceLevel object to which this entry belongs.
This method is invoked automatically internally, by the MAMDA API, when an entry is added to a price level.
level | The price level to be associated with. |
MamdaOrderBookPriceLevel* Wombat::MamdaOrderBookEntry::getPriceLevel | ( | ) | const |
Get the MamdaOrderBookPriceLevel object to which this entry belongs.
MamdaOrderBook* Wombat::MamdaOrderBookEntry::getOrderBook | ( | ) | const |
Get the order book for this entry, if possible.
This can only be done if the entry is part of a price level and the price level is part of an order book. NULL is returned if no order book can be found.
void Wombat::MamdaOrderBookEntry::setManager | ( | MamdaOrderBookEntryManager * | manager) |
Set the MamdaOrderBookEntryManager object to which this entry belongs.
This method is invoked automatically internally, by the MAMDA API, when an entry is added to an entry manager.
manager | pointer to the MamdaOrderBookEntryManager |
MamdaOrderBookEntryManager* Wombat::MamdaOrderBookEntry::getManager | ( | ) | const |
Get the MamdaOrderBookEntryManager object to which this entry belongs.
const char* Wombat::MamdaOrderBookEntry::getSymbol | ( | ) | const |
Get the symbol for this entry, if possible.
This can only be done if the entry is part of a price level and the price level is part of an order book. NULL is returned if no symbol can be found.
void Wombat::MamdaOrderBookEntry::setSourceDerivative | ( | const MamaSourceDerivative * | deriv) |
Set the MamaSourceDerivative for this book entry.
The source derivative is used to help determine what the quality of order book entry is and to efficiently identify all of the entries for a given source (e.g. for aggregated order books).
deriv | The MAMA source derivative |
const MamaSourceDerivative* Wombat::MamdaOrderBookEntry::getSourceDerivative | ( | ) | const |
Return the MamaSourceDerivative for this book entry.
const MamaSource* Wombat::MamdaOrderBookEntry::getSource | ( | ) | const |
Return the MamaSource for this book entry.
mamaSourceState Wombat::MamdaOrderBookEntry::getSourceState | ( | ) | const |
Get the source state.
bool Wombat::MamdaOrderBookEntry::getCheckSourceState | ( | ) | const |
Get whether this order book wants to check the source state.
void Wombat::MamdaOrderBookEntry::setQuality | ( | mamaQuality | quality) |
Set the entry-level quality factor.
This level, if not MAMA_QUALITY_OK, overrides the source-level level.
quality | The new entry-level MAMA quality level. |
mamaQuality Wombat::MamdaOrderBookEntry::getQuality | ( | ) | const |
Get the entry-level quality factor.
If the entry-level quality is MAMA_QUALITY_OK, then this method returns the source-level quality.
bool Wombat::MamdaOrderBookEntry::isVisible | ( | ) | const |
Get whether this entry is "visible" in this book.
Visibility is controlled by the status of the MamaSourceDerivative for the entry.
void Wombat::MamdaOrderBookEntry::setClosure | ( | void * | closure) |
Set the order book entry closure handle.
closure | The closure. |
void* Wombat::MamdaOrderBookEntry::getClosure | ( | ) | const |
Get the order book entry closure handle.
void Wombat::MamdaOrderBookEntry::assertEqual | ( | const MamdaOrderBookEntry & | rhs) | const |
Order book entry equality verification.
A MamdaOrderBookException is thrown if the entries within a price level are not equal, along with the reason for the inequality.
rhs | The entry which this entry is being compared to. |
<MamdaOrderBookException> | Exception thrown if any errors encountered during book processing. |
|
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 should be employed. |