OpenMAMA
Wombat::MamdaOrderBookPriceLevel Class Reference

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)
 Copy constructor. More...
 
 MamdaOrderBookPriceLevel (double price, Side side)
 Constructor initializing just the price and side. More...
 
 MamdaOrderBookPriceLevel (MamaPrice &price, Side side)
 
 ~MamdaOrderBookPriceLevel ()
 
MamdaOrderBookPriceLeveloperator= (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...
 
MamdaOrderBookgetOrderBook () const
 Get the MamdaOrderBook object to which this entry belongs. More...
 
const char * getSymbol () const
 Get the symbol for this entry, if possible. More...
 
MamdaOrderBookEntryfindEntry (const char *id) const
 Return the order book entry with ID "id" in the price level or NULL if not found. More...
 
MamdaOrderBookEntryfindOrCreateEntry (const char *id)
 Return the order book entry with ID "id" in the price level, creating one if necessary. More...
 
MamdaOrderBookEntryfindOrCreateEntry (const char *id, bool &newEntry)
 Return the order book entry with ID "id" in the price level, creating one if necessary. More...
 
MamdaOrderBookEntrygetEntryAtPosition (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
 
iteratorbegin (iterator &reuse)
 
const_iteratorbegin (const_iterator &reuse) const
 
iterator end ()
 
const_iterator end () const
 
iteratorend (iterator &reuse)
 
const_iteratorend (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
 

Detailed Description

MamdaOrderBookPriceLevel is a class that provides a price level type for order books.

Member Typedef Documentation

◆ const_iterator

Member Enumeration Documentation

◆ Action

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 

◆ Side

An enumeration for the side order book side.

"Bid" (or "buy") orders occur on one side and "ask" (or "sell") orders occur on the other.

Enumerator
MAMDA_BOOK_SIDE_BID 
MAMDA_BOOK_SIDE_ASK 
MAMDA_BOOK_SIDE_UNKNOWN 

◆ Reason

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 
83  {
91  };
Definition: MamdaOrderBookTypes.h:79
Definition: MamdaOrderBookTypes.h:77
Definition: MamdaOrderBookTypes.h:81
Definition: MamdaOrderBookTypes.h:78
Definition: MamdaOrderBookPriceLevel.h:87
Definition: MamdaOrderBookTypes.h:80
Definition: MamdaOrderBookPriceLevel.h:90
Definition: MamdaOrderBookPriceLevel.h:86
Definition: MamdaOrderBookPriceLevel.h:89
Definition: MamdaOrderBookTypes.h:75
Definition: MamdaOrderBookTypes.h:76
Definition: MamdaOrderBookPriceLevel.h:84
Definition: MamdaOrderBookPriceLevel.h:85
Definition: MamdaOrderBookPriceLevel.h:88

◆ OrderType

An enumeration for the type of level.

"Limit" level orders are set at a specific price. "Market" level orders are set at the current market price.

Enumerator
MAMDA_BOOK_LEVEL_LIMIT 
MAMDA_BOOK_LEVEL_MARKET 
MAMDA_BOOK_LEVEL_UNKNOWN 

Constructor & Destructor Documentation

◆ MamdaOrderBookPriceLevel() [1/4]

Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel ( )

◆ MamdaOrderBookPriceLevel() [2/4]

Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel ( const MamdaOrderBookPriceLevel copy)

Copy constructor.

Note that the associated order book of the original copy is not copied.

◆ MamdaOrderBookPriceLevel() [3/4]

Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel ( double  price,
Side  side 
)

Constructor initializing just the price and side.

◆ MamdaOrderBookPriceLevel() [4/4]

Wombat::MamdaOrderBookPriceLevel::MamdaOrderBookPriceLevel ( MamaPrice &  price,
Side  side 
)

◆ ~MamdaOrderBookPriceLevel()

Wombat::MamdaOrderBookPriceLevel::~MamdaOrderBookPriceLevel ( )

Member Function Documentation

◆ operator=()

MamdaOrderBookPriceLevel& Wombat::MamdaOrderBookPriceLevel::operator= ( const MamdaOrderBookPriceLevel rhs)

Assignment operator.

Note that the associated order book of the original copy is not copied.

◆ copy()

void Wombat::MamdaOrderBookPriceLevel::copy ( const MamdaOrderBookPriceLevel rhs)

Copy a price level.

Note that the associated order book of the original copy is not copied.

◆ copyLevelOnly()

void Wombat::MamdaOrderBookPriceLevel::copyLevelOnly ( const MamdaOrderBookPriceLevel rhs)

Copy a price level details only.

No entries are copied.

◆ addEntry()

void Wombat::MamdaOrderBookPriceLevel::addEntry ( MamdaOrderBookEntry entry)

Add an entry to the level (without any sanity checking).

◆ updateEntry()

void Wombat::MamdaOrderBookPriceLevel::updateEntry ( const MamdaOrderBookEntry entry)

Update an entry by copying the information from another entry.

◆ removeEntryById()

void Wombat::MamdaOrderBookPriceLevel::removeEntryById ( const MamdaOrderBookEntry entry)

Remove an entry based on the entry ID information from another entry.

◆ removeEntry()

void Wombat::MamdaOrderBookPriceLevel::removeEntry ( const MamdaOrderBookEntry entry)

Remove this precise entry (i.e., based on this object being the exact object in the level).

◆ addEntriesFromLevel()

void Wombat::MamdaOrderBookPriceLevel::addEntriesFromLevel ( const MamdaOrderBookPriceLevel level,
MamdaOrderBookEntryFilter filter,
MamdaOrderBookBasicDeltaList delta 
)

Add all entries from another price level into this level.

Parameters
levelThe price level to add.
filterFilter to use when adding the entries
deltaAn optional delta to collect for the deleted entries.

◆ deleteEntriesFromSource()

void Wombat::MamdaOrderBookPriceLevel::deleteEntriesFromSource ( const MamaSource *  source,
MamdaOrderBookBasicDeltaList delta 
)

Delete all entries in this price level that have "source" as its MamaSource.

Parameters
sourceThe source to match.
deltaAn optional delta to collect for the deleted entries.

◆ reevaluate()

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.

Returns
Whether the book info changed based on the re-evaluation.

◆ clear()

void Wombat::MamdaOrderBookPriceLevel::clear ( )

◆ setPrice() [1/2]

void Wombat::MamdaOrderBookPriceLevel::setPrice ( double  price)

◆ setPrice() [2/2]

void Wombat::MamdaOrderBookPriceLevel::setPrice ( MamaPrice &  price)

◆ setSize()

void Wombat::MamdaOrderBookPriceLevel::setSize ( mama_quantity_t  size)

◆ setSizeChange()

void Wombat::MamdaOrderBookPriceLevel::setSizeChange ( mama_quantity_t  sizeChange)

◆ setNumEntries()

void Wombat::MamdaOrderBookPriceLevel::setNumEntries ( mama_u32_t  numEntries)

◆ setSide()

void Wombat::MamdaOrderBookPriceLevel::setSide ( Side  side)

◆ setAction()

void Wombat::MamdaOrderBookPriceLevel::setAction ( Action  action)

◆ setTime()

void Wombat::MamdaOrderBookPriceLevel::setTime ( const MamaDateTime &  time)

◆ setDetails()

void Wombat::MamdaOrderBookPriceLevel::setDetails ( const MamdaOrderBookPriceLevel rhs)

◆ markAllDeleted()

void Wombat::MamdaOrderBookPriceLevel::markAllDeleted ( )

Mark everything in this price level as deleted, including entries.

◆ setAsDifference()

void Wombat::MamdaOrderBookPriceLevel::setAsDifference ( const MamdaOrderBookPriceLevel lhs,
const MamdaOrderBookPriceLevel rhs 
)

◆ getPrice()

double Wombat::MamdaOrderBookPriceLevel::getPrice ( ) const

Return the price for this level.

Returns
The price for this level.

◆ getMamaPrice()

MamaPrice Wombat::MamdaOrderBookPriceLevel::getMamaPrice ( ) const

◆ getSize()

mama_quantity_t Wombat::MamdaOrderBookPriceLevel::getSize ( ) const

Return the total size (across all entries) for this level.

Returns
The total size for this level.

◆ getSizeChange()

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.

Returns
The changed size for this level.

◆ getNumEntries()

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.

Returns
The actual number of entries for this level.

◆ getNumEntriesTotal()

mama_u32_t Wombat::MamdaOrderBookPriceLevel::getNumEntriesTotal ( ) const

Return the number of entries that can be iterated over.

Returns
The number of entries that can be iterated over

◆ empty()

bool Wombat::MamdaOrderBookPriceLevel::empty ( ) const

Return whether there are no entries for this level.

Returns
Whether there are no entries for this level.

◆ getSide()

Side Wombat::MamdaOrderBookPriceLevel::getSide ( ) const

Return the side (bid/ask) of the book for this level.

Returns
The side of the book for this level.

◆ getAction()

Action Wombat::MamdaOrderBookPriceLevel::getAction ( ) const

Return the action for this price level.

All price levels for a full book are marked with ACTION_ADD.

Returns
The action for this level.

◆ getTime()

const MamaDateTime& Wombat::MamdaOrderBookPriceLevel::getTime ( ) const

Return the time stamp for when the price level was last updated.

Returns
The time stamp for when the price level was last updated.

◆ operator==()

bool Wombat::MamdaOrderBookPriceLevel::operator== ( const MamdaOrderBookPriceLevel rhs) const

Equality operator.

Two price levels are equal if their members and price level entries are identical.

Parameters
rhsThe order book price level to compare this level to.
Returns
Whether the price levels are equal.

◆ operator!=()

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.

Parameters
rhsThe order book price level to compare this level to.
Returns
Whether the price levels are unequal.
308  { return ! operator== (rhs); }
bool operator==(const MamdaOrderBookPriceLevel &rhs) const
Equality operator.

◆ setOrderBook()

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.

Parameters
bookThe order book to be associated with

◆ getOrderBook()

MamdaOrderBook* Wombat::MamdaOrderBookPriceLevel::getOrderBook ( ) const

Get the MamdaOrderBook object to which this entry belongs.

Returns
The order book currently associated with this price level.

◆ getSymbol()

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.

Returns
The symbol or NULL.

◆ findEntry()

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.

Parameters
idThe ID of the order book entry.
Returns
The order book entry found or NULL if not found.

◆ findOrCreateEntry() [1/2]

MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::findOrCreateEntry ( const char *  id)

Return the order book entry with ID "id" in the price level, creating one if necessary.

Parameters
idThe ID of the order book entry.
Returns
The order book entry found or created.

◆ findOrCreateEntry() [2/2]

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.

Parameters
idThe ID of the order book entry.
newEntryBoolean reference indicating entry creation.
Returns
The order book entry found or created.

◆ getEntryAtPosition()

MamdaOrderBookEntry* Wombat::MamdaOrderBookPriceLevel::getEntryAtPosition ( mama_u32_t  pos) const

Return the order book entry at position "pos" in the price level.

Parameters
posThe position of the order book entry.
Returns
The order book entry or NULL if not found.

◆ setClosure()

void Wombat::MamdaOrderBookPriceLevel::setClosure ( void *  closure)

Set the order book price level closure handle.

Parameters
closureThe closure.

◆ getClosure()

void* Wombat::MamdaOrderBookPriceLevel::getClosure ( ) const

Get the order book price level closure handle.

Returns
The closure.

◆ getOrderType()

OrderType Wombat::MamdaOrderBookPriceLevel::getOrderType ( ) const

Return the order type of the level.

Returns
The order type of the level.

◆ setOrderType()

void Wombat::MamdaOrderBookPriceLevel::setOrderType ( OrderType  orderType)

Set the order type for this level.

Parameters
orderTypeThe order type of the level.

◆ assertEqual()

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.

Parameters
rhsThe order book price level to compare this level to.
Exceptions
<MamdaOrderBookException>If error encountered during book processing.

◆ begin() [1/4]

iterator Wombat::MamdaOrderBookPriceLevel::begin ( )

◆ begin() [2/4]

const_iterator Wombat::MamdaOrderBookPriceLevel::begin ( ) const

◆ begin() [3/4]

iterator& Wombat::MamdaOrderBookPriceLevel::begin ( iterator reuse)

◆ begin() [4/4]

const_iterator& Wombat::MamdaOrderBookPriceLevel::begin ( const_iterator reuse) const

◆ end() [1/4]

iterator Wombat::MamdaOrderBookPriceLevel::end ( )

◆ end() [2/4]

const_iterator Wombat::MamdaOrderBookPriceLevel::end ( ) const

◆ end() [3/4]

iterator& Wombat::MamdaOrderBookPriceLevel::end ( iterator reuse)

◆ end() [4/4]

const_iterator& Wombat::MamdaOrderBookPriceLevel::end ( const_iterator reuse) const

◆ findEntryAfter() [1/2]

iterator Wombat::MamdaOrderBookPriceLevel::findEntryAfter ( iterator start,
const char *  id 
)

◆ findEntryAfter() [2/2]

const_iterator Wombat::MamdaOrderBookPriceLevel::findEntryAfter ( const_iterator start,
const char *  id 
) const

◆ setStrictChecking()

static void Wombat::MamdaOrderBookPriceLevel::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 of modification is enabled.

Member Data Documentation

◆ sortEntriesByTime

bool Wombat::MamdaOrderBookPriceLevel::sortEntriesByTime
static

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


© 2012 Linux Foundation