OpenMAMA
Wombat::MamdaOrderBookEntry Class Reference

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)
 Copy constructor.
 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.
 ~MamdaOrderBookEntry ()
MamdaOrderBookEntryoperator= (const MamdaOrderBookEntry &rhs)
 Assignment operator.
void clear ()
void copy (const MamdaOrderBookEntry &copy)
 Copy an order book entry.
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 &copy)
const char * getId () const
 If supported, Order book entry ID (order ID, participant ID, etc.)
const char * getUniqueId () const
 If supported, Order book entry unique ID (order ID, participant ID, etc.).
mama_quantity_t getSize () const
 The size of the order entry.
Action getAction () const
 Whether to ADD, UPDATE or DELETE the entry.
MamdaOrderBookTypes::Reason getReason () const
 Reason for a change.
const MamaDateTime & getTime () const
 Time of order book entry update.
mama_u16_t getStatus () const
 Get the status.
double getPrice () const
 Get the price for this entry.
MamaPrice getMamaPrice () const
MamdaOrderBookPriceLevel::Side getSide () const
 Get the price for this entry.
mama_u32_t getPosition (mama_u32_t maxPos=0) const
 Get the position in the order book for this entry.
bool equalId (const char *id) const
 Whether two participant ids are equal.
bool operator== (const MamdaOrderBookEntry &rhs) const
 Equality operator.
bool operator!= (const MamdaOrderBookEntry &rhs) const
 Non-equality operator.
void setPriceLevel (MamdaOrderBookPriceLevel *level)
 Set the MamdaOrderBookPriceLevel object to which this entry belongs.
MamdaOrderBookPriceLevelgetPriceLevel () const
 Get the MamdaOrderBookPriceLevel object to which this entry belongs.
MamdaOrderBookgetOrderBook () const
 Get the order book for this entry, if possible.
void setManager (MamdaOrderBookEntryManager *manager)
 Set the MamdaOrderBookEntryManager object to which this entry belongs.
MamdaOrderBookEntryManagergetManager () const
 Get the MamdaOrderBookEntryManager object to which this entry belongs.
const char * getSymbol () const
 Get the symbol for this entry, if possible.
void setSourceDerivative (const MamaSourceDerivative *deriv)
 Set the MamaSourceDerivative for this book entry.
const MamaSourceDerivative * getSourceDerivative () const
 Return the MamaSourceDerivative for this book entry.
const MamaSource * getSource () const
 Return the MamaSource for this book entry.
mamaSourceState getSourceState () const
 Get the source state.
bool getCheckSourceState () const
 Get whether this order book wants to check the source state.
void setQuality (mamaQuality quality)
 Set the entry-level quality factor.
mamaQuality getQuality () const
 Get the entry-level quality factor.
bool isVisible () const
 Get whether this entry is "visible" in this book.
void setClosure (void *closure)
 Set the order book entry closure handle.
void * getClosure () const
 Get the order book entry closure handle.
void assertEqual (const MamdaOrderBookEntry &rhs) const
 Order book entry equality verification.

Static Public Member Functions

static void setStrictChecking (bool strict)
 Enforce strict checking of order book modifications (at the expense of some performance).

Detailed Description

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.

Member Enumeration Documentation

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 

Constructor & Destructor Documentation

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 ( )

Member Function Documentation

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.)

Returns
The entry id
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.

Returns
The unique entry id
mama_quantity_t Wombat::MamdaOrderBookEntry::getSize ( ) const

The size of the order entry.

Returns
The size of the order entry.
Action Wombat::MamdaOrderBookEntry::getAction ( ) const

Whether to ADD, UPDATE or DELETE the entry.

Returns
The order entry action.
MamdaOrderBookTypes::Reason Wombat::MamdaOrderBookEntry::getReason ( ) const

Reason for a change.

Returns
The order entry reason
const MamaDateTime& Wombat::MamdaOrderBookEntry::getTime ( ) const

Time of order book entry update.

Returns
The time of the order entry update.
mama_u16_t Wombat::MamdaOrderBookEntry::getStatus ( ) const

Get the status.

Returns
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.

Returns
The price for this entry.
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.

Returns
The side for this entry.
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.

Parameters
maxPosThe maximum position to return;
Returns
The position of this entry in the order book.
bool Wombat::MamdaOrderBookEntry::equalId ( const char *  id) const

Whether two participant ids are equal.

Returns
true if the two id's are equal.
bool Wombat::MamdaOrderBookEntry::operator== ( const MamdaOrderBookEntry rhs) const

Equality operator.

Two order book entries are equal if their members are identical.

Parameters
rhsThe order book entry to compare this entry to.
Returns
Whether the two entries are equal.
bool Wombat::MamdaOrderBookEntry::operator!= ( const MamdaOrderBookEntry rhs) const

Non-equality operator.

Two order book entries are equal if their members are identical.

Parameters
rhsThe order book entry to compare this entry to.
Returns
Whether the two entries are not equal.
{ return ! operator== (rhs); }
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.

Parameters
levelThe price level to be associated with.
MamdaOrderBookPriceLevel* Wombat::MamdaOrderBookEntry::getPriceLevel ( ) const

Get the MamdaOrderBookPriceLevel object to which this entry belongs.

Returns
The price level currently associated with this entry.
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.

Returns
The order book or NULL.
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.

Parameters
managerpointer to the MamdaOrderBookEntryManager
MamdaOrderBookEntryManager* Wombat::MamdaOrderBookEntry::getManager ( ) const

Get the MamdaOrderBookEntryManager object to which this entry belongs.

Returns
The manager currently associated with this entry.
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.

Returns
The symbol or NULL.
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).

Parameters
derivThe 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.

Returns
The current MAMA source state.
bool Wombat::MamdaOrderBookEntry::getCheckSourceState ( ) const

Get whether this order book wants to check the source state.

Returns
Whether to check 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.

Parameters
qualityThe 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.

Returns
The current MAMA quality level.
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.

Returns
Whether the entry is visible.
void Wombat::MamdaOrderBookEntry::setClosure ( void *  closure)

Set the order book entry closure handle.

Parameters
closureThe closure.
void* Wombat::MamdaOrderBookEntry::getClosure ( ) const

Get the order book entry closure handle.

Returns
The entry closure.
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.

Parameters
rhsThe entry which this entry is being compared to.
Exceptions
<MamdaOrderBookException>Exception thrown if any errors encountered during book processing.
static void Wombat::MamdaOrderBookEntry::setStrictChecking ( bool  strict)
static

Enforce strict checking of order book modifications (at the expense of some performance).

This setting is automatically updated by MamdaOrderBook::setStrictChecking().

Parameters
strictWhether strict checking should be employed.

The documentation for this class was generated from the following file:


© 2012 Linux Foundation