OpenMAMA
Wombat::MamdaOrderBookListener Class Reference

MamdaOrderBookListener is a class that specializes in handling order book updates. More...

#include <MamdaOrderBookListener.h>

Inheritance diagram for Wombat::MamdaOrderBookListener:
Wombat::MamdaMsgListener MamdaOrderBookDepthFilter MamdaQuoteToBookListener

Public Member Functions

 MamdaOrderBookListener (MamdaOrderBook *fullBook=NULL)
 Create an order book listener using an optional user-provided object for the full order book. More...
 
virtual ~MamdaOrderBookListener ()
 
virtual void addHandler (MamdaOrderBookHandler *handler)
 Add a specialized order book handler. More...
 
virtual void setProcessEntries (bool process)
 Set whether we are interested in "entry level" information at all. More...
 
virtual bool getProcessEntries () const
 Get whether we are interested in "entry level" information. More...
 
virtual void setProcessMarketOrders (bool process)
 Set whether we are interested in market order information, if available. More...
 
virtual bool getProcessMarketOrders () const
 Get whether we are interested in market order information. More...
 
virtual void addIgnoreEntryId (const char *id)
 Add an entry ID to ignore. More...
 
virtual void removeIgnoreEntryId (const char *id)
 Remove an entry ID to ignore. More...
 
virtual void clear ()
 Clear all cached data fields. More...
 
virtual void removeHandlers ()
 Remove the reference of handlers from the internal list. More...
 
virtual const char * getSymbol () const
 
virtual const char * getPartId () const
 
virtual const MamaDateTime & getSrcTime () const
 
virtual const MamaDateTime & getActivityTime () const
 
virtual const MamaDateTime & getLineTime () const
 
virtual const MamaDateTime & getSendTime () const
 
virtual const MamaMsgQual & getMsgQual () const
 
virtual const MamaDateTime & getEventTime () const
 
virtual mama_seqnum_t getEventSeqNum () const
 
virtual MamdaFieldState getSymbolFieldState () const
 
virtual MamdaFieldState getPartIdFieldState () const
 
virtual MamdaFieldState getEventSeqNumFieldState () const
 
virtual MamdaFieldState getEventTimeFieldState () const
 
virtual MamdaFieldState getSrcTimeFieldState () const
 
virtual MamdaFieldState getActivityTimeFieldState () const
 
virtual MamdaFieldState getLineTimeFieldState () const
 
virtual MamdaFieldState getSendTimeFieldState () const
 
virtual MamdaFieldState getMsgQualFieldState () const
 
virtual const MamdaOrderBookgetOrderBook () const
 
virtual MamdaOrderBookgetOrderBook ()
 
virtual mama_seqnum_t getBeginGapSeqNum () const
 
virtual mama_seqnum_t getEndGapSeqNum () const
 
virtual void setUseEntryManager (bool useManager)
 Set whether to use an "entry manager" for finding entries in a book. More...
 
virtual void setEntryIdsAreUnique (bool uniqueIds)
 Set whether the entry IDs are unique across the entire book. More...
 
virtual void setKeepBasicDeltas (bool keep)
 Set whether to gather individual basic deltas when processing a complex delta. More...
 
virtual void setUpdateInconsistentBook (bool update)
 Whether to handle or ignore updates sent for an inconsistent book. More...
 
virtual void setUpdateStaleBook (bool update)
 Whether to handle or ignore updates sent for a stale order book. More...
 
virtual void setClearStaleBook (bool clear)
 Whether to clear the order book upon detection of a stale book condition. More...
 
virtual void setQuality (MamdaSubscription *sub, mamaQuality quality)
 Change the order book quality and invoke appropriate callbacks. More...
 
virtual void setConflateDeltas (bool conflate)
 Whether to conflate the order book deltas. More...
 
virtual bool getConflateDeltas ()
 Whether or not order book deltas are conflated. More...
 
virtual void setConflationInterval (double interval)
 The conflation interval. More...
 
virtual void forceInvokeDeltaHandlers ()
 Invoke delta handlers immediately if there is a conflated delta pending. More...
 
virtual void clearConflatedDeltas ()
 Clear any pending conflated deltas. More...
 
virtual void onMsg (MamdaSubscription *subscription, const MamaMsg &msg, short msgType)
 Implementation of MamdaListener interface. More...
 
virtual void acquireReadLock ()
 Acquire a read lock on the full book, so that an alternative running thread can view the book without it being changed from within the MamdaBookListener. More...
 
virtual void releaseReadLock ()
 Release the read lock on the full book. More...
 
virtual void acquireWriteLock ()
 
virtual void releaseWriteLock ()
 
virtual void getBookSnapShot (MamdaOrderBook &result)
 A thread safe function that can be called to populate a snapshot of the full book for the given symbol providing there already exists a MamdaBookListener for the symbol within the process. More...
 
virtual void setBookPropertyFids (mama_fid_t *fids, mama_size_t numFids)
 Set the FIDs for any additional fields to cached in the book properties for the book. More...
 
virtual void setLevelPropertyFids (mama_fid_t *fids, mama_size_t numFids)
 Set the FIDs for any additional fields to cached in the price level properties for the book. More...
 
virtual void setEntryPropertyFids (mama_fid_t *fids, mama_size_t numFids)
 Set the FIDs for any additional fields to cached in the entry properties for the book. More...
 
- Public Member Functions inherited from Wombat::MamdaMsgListener
virtual ~MamdaMsgListener ()
 

Public Attributes

MamdaOrderBookListenerImpl & mImpl
 

Detailed Description

MamdaOrderBookListener is a class that specializes in handling order book updates.

Developers provide their own implementation of the MamdaOrderBookHandler interface and will be delivered notifications for order book recaps and deltas. Notifications for order book deltas include the delta itself as well as the full order book with deltas applied. An obvious application for this MAMDA class is any kind of program trading application that looks at depth of book.

Note: The MamdaOrderBookListener class caches the order book. Among other reasons, caching of these fields makes it possible to provide full-book related callbacks, even when the publisher (e.g., feed handler) is only publishing deltas containing modified fields.

Constructor & Destructor Documentation

◆ MamdaOrderBookListener()

Wombat::MamdaOrderBookListener::MamdaOrderBookListener ( MamdaOrderBook fullBook = NULL)

Create an order book listener using an optional user-provided object for the full order book.

If "fullBook" is NULL, an object will be allocated internally. If this listener is destroyed then the full order book object will only be destroyed if it was created by the listener (i.e., if fullBook was passed as NULL in this constructor).

Parameters
fullBookThe MamdaOrderBook used to maintain the full book.

◆ ~MamdaOrderBookListener()

virtual Wombat::MamdaOrderBookListener::~MamdaOrderBookListener ( )
virtual

Member Function Documentation

◆ addHandler()

virtual void Wombat::MamdaOrderBookListener::addHandler ( MamdaOrderBookHandler handler)
virtual

Add a specialized order book handler.

Currently, only one handler can (and must) be registered.

Parameters
handlerThe handler registered to receive order book update callbacks.

Reimplemented in MamdaQuoteToBookListener, and MamdaOrderBookDepthFilter.

◆ setProcessEntries()

virtual void Wombat::MamdaOrderBookListener::setProcessEntries ( bool  process)
virtual

Set whether we are interested in "entry level" information at all.

Many applications only care about price level information. (Default is to process entry level information.)

Parameters
processWhether to process entries in books.

Reimplemented in MamdaQuoteToBookListener.

◆ getProcessEntries()

virtual bool Wombat::MamdaOrderBookListener::getProcessEntries ( ) const
virtual

Get whether we are interested in "entry level" information.

Returns
true if we are set to process entries

◆ setProcessMarketOrders()

virtual void Wombat::MamdaOrderBookListener::setProcessMarketOrders ( bool  process)
virtual

Set whether we are interested in market order information, if available.

Parameters
processWhether to process market order data.

◆ getProcessMarketOrders()

virtual bool Wombat::MamdaOrderBookListener::getProcessMarketOrders ( ) const
virtual

Get whether we are interested in market order information.

Returns
true if we are set to process market orders

◆ addIgnoreEntryId()

virtual void Wombat::MamdaOrderBookListener::addIgnoreEntryId ( const char *  id)
virtual

Add an entry ID to ignore.

This only makes sense when the entry type is participant ID (as opposed to order ID). All order book updates for this entry ID will be ignored.

Parameters
idThe id of the participant to ignore when process book updates.

Reimplemented in MamdaQuoteToBookListener.

◆ removeIgnoreEntryId()

virtual void Wombat::MamdaOrderBookListener::removeIgnoreEntryId ( const char *  id)
virtual

Remove an entry ID to ignore.

Parameters
idThe id of the participant whose update will be subsequently processed as part of the book.
See also
addIgnoreEntryId(const char*)

Reimplemented in MamdaQuoteToBookListener.

◆ clear()

virtual void Wombat::MamdaOrderBookListener::clear ( )
virtual

Clear all cached data fields.

Reimplemented in MamdaQuoteToBookListener.

◆ removeHandlers()

virtual void Wombat::MamdaOrderBookListener::removeHandlers ( )
virtual

Remove the reference of handlers from the internal list.

Memory is not freed.

Reimplemented in MamdaQuoteToBookListener, and MamdaOrderBookDepthFilter.

◆ getSymbol()

virtual const char* Wombat::MamdaOrderBookListener::getSymbol ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getPartId()

virtual const char* Wombat::MamdaOrderBookListener::getPartId ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getSrcTime()

virtual const MamaDateTime& Wombat::MamdaOrderBookListener::getSrcTime ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getActivityTime()

virtual const MamaDateTime& Wombat::MamdaOrderBookListener::getActivityTime ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getLineTime()

virtual const MamaDateTime& Wombat::MamdaOrderBookListener::getLineTime ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getSendTime()

virtual const MamaDateTime& Wombat::MamdaOrderBookListener::getSendTime ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getMsgQual()

virtual const MamaMsgQual& Wombat::MamdaOrderBookListener::getMsgQual ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getEventTime()

virtual const MamaDateTime& Wombat::MamdaOrderBookListener::getEventTime ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getEventSeqNum()

virtual mama_seqnum_t Wombat::MamdaOrderBookListener::getEventSeqNum ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getSymbolFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getSymbolFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getPartIdFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getPartIdFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getEventSeqNumFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getEventSeqNumFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getEventTimeFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getEventTimeFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getSrcTimeFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getSrcTimeFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getActivityTimeFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getActivityTimeFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getLineTimeFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getLineTimeFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getSendTimeFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getSendTimeFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getMsgQualFieldState()

virtual MamdaFieldState Wombat::MamdaOrderBookListener::getMsgQualFieldState ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getOrderBook() [1/2]

virtual const MamdaOrderBook* Wombat::MamdaOrderBookListener::getOrderBook ( ) const
virtual

◆ getOrderBook() [2/2]

virtual MamdaOrderBook* Wombat::MamdaOrderBookListener::getOrderBook ( )
virtual

◆ getBeginGapSeqNum()

virtual mama_seqnum_t Wombat::MamdaOrderBookListener::getBeginGapSeqNum ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getEndGapSeqNum()

virtual mama_seqnum_t Wombat::MamdaOrderBookListener::getEndGapSeqNum ( ) const
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ setUseEntryManager()

virtual void Wombat::MamdaOrderBookListener::setUseEntryManager ( bool  useManager)
virtual

Set whether to use an "entry manager" for finding entries in a book.

Reimplemented in MamdaQuoteToBookListener.

◆ setEntryIdsAreUnique()

virtual void Wombat::MamdaOrderBookListener::setEntryIdsAreUnique ( bool  uniqueIds)
virtual

Set whether the entry IDs are unique across the entire book.

This is only relevant if using an "entry manager".

Reimplemented in MamdaQuoteToBookListener.

◆ setKeepBasicDeltas()

virtual void Wombat::MamdaOrderBookListener::setKeepBasicDeltas ( bool  keep)
virtual

Set whether to gather individual basic deltas when processing a complex delta.

Many applications don't need the basic deltas and will iterate over part or all of the full book (with the deltas already applied).

Reimplemented in MamdaQuoteToBookListener.

◆ setUpdateInconsistentBook()

virtual void Wombat::MamdaOrderBookListener::setUpdateInconsistentBook ( bool  update)
virtual

Whether to handle or ignore updates sent for an inconsistent book.

A book may be in an inconsistent state if there has been a gap on the sequence of update (delta) messages. Default is to not update (and wait for a recap).

Parameters
updateWhether to apply updates to an inconsistent book.

Reimplemented in MamdaQuoteToBookListener.

◆ setUpdateStaleBook()

virtual void Wombat::MamdaOrderBookListener::setUpdateStaleBook ( bool  update)
virtual

Whether to handle or ignore updates sent for a stale order book.

A book is in a stale state if its mamaQuality is not MAMA_QUALITY_OK..

Parameters
updateWhether to apply updates to a stale book.

Reimplemented in MamdaQuoteToBookListener.

◆ setClearStaleBook()

virtual void Wombat::MamdaOrderBookListener::setClearStaleBook ( bool  clear)
virtual

Whether to clear the order book upon detection of a stale book condition.

If this is set to true, then setUpdateStaleBook() should probably have been set to false.

Reimplemented in MamdaQuoteToBookListener.

◆ setQuality()

virtual void Wombat::MamdaOrderBookListener::setQuality ( MamdaSubscription sub,
mamaQuality  quality 
)
virtual

Change the order book quality and invoke appropriate callbacks.

Reimplemented in MamdaQuoteToBookListener.

◆ setConflateDeltas()

virtual void Wombat::MamdaOrderBookListener::setConflateDeltas ( bool  conflate)
virtual

Whether to conflate the order book deltas.

Parameters
conflateWhether to conflate the order book deltas

Reimplemented in MamdaQuoteToBookListener.

◆ getConflateDeltas()

virtual bool Wombat::MamdaOrderBookListener::getConflateDeltas ( )
virtual

Whether or not order book deltas are conflated.

Returns
true if conflation is set to true

Reimplemented in MamdaQuoteToBookListener.

◆ setConflationInterval()

virtual void Wombat::MamdaOrderBookListener::setConflationInterval ( double  interval)
virtual

The conflation interval.

Parameters
intervalThe conflation interval in seconds. Default is 0.5 seconds.

Reimplemented in MamdaQuoteToBookListener.

◆ forceInvokeDeltaHandlers()

virtual void Wombat::MamdaOrderBookListener::forceInvokeDeltaHandlers ( )
virtual

Invoke delta handlers immediately if there is a conflated delta pending.

Reimplemented in MamdaQuoteToBookListener.

◆ clearConflatedDeltas()

virtual void Wombat::MamdaOrderBookListener::clearConflatedDeltas ( )
virtual

Clear any pending conflated deltas.

Reimplemented in MamdaQuoteToBookListener.

◆ onMsg()

virtual void Wombat::MamdaOrderBookListener::onMsg ( MamdaSubscription subscription,
const MamaMsg &  msg,
short  msgType 
)
virtual

Implementation of MamdaListener interface.

Implements Wombat::MamdaMsgListener.

Reimplemented in MamdaQuoteToBookListener, and MamdaOrderBookDepthFilter.

◆ acquireReadLock()

virtual void Wombat::MamdaOrderBookListener::acquireReadLock ( )
virtual

Acquire a read lock on the full book, so that an alternative running thread can view the book without it being changed from within the MamdaBookListener.

releaseReadLock should be called to release the lock.

Reimplemented in MamdaQuoteToBookListener.

◆ releaseReadLock()

virtual void Wombat::MamdaOrderBookListener::releaseReadLock ( )
virtual

Release the read lock on the full book.

A companion to the acquireReadLock method.

Reimplemented in MamdaQuoteToBookListener.

◆ acquireWriteLock()

virtual void Wombat::MamdaOrderBookListener::acquireWriteLock ( )
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ releaseWriteLock()

virtual void Wombat::MamdaOrderBookListener::releaseWriteLock ( )
virtual

Reimplemented in MamdaQuoteToBookListener.

◆ getBookSnapShot()

virtual void Wombat::MamdaOrderBookListener::getBookSnapShot ( MamdaOrderBook result)
virtual

A thread safe function that can be called to populate a snapshot of the full book for the given symbol providing there already exists a MamdaBookListener for the symbol within the process.

This routine will throw a MamdaOrderBookException in the following three circumstances:

  • If the Mamda API hasn't been built with multi-threading enabled, or
  • If there is no listener within the process for the given symbol, or
  • The listener hasn't as yet received an initial image.
Exceptions
<MamdaOrderBookException>See above for details.

Reimplemented in MamdaQuoteToBookListener.

◆ setBookPropertyFids()

virtual void Wombat::MamdaOrderBookListener::setBookPropertyFids ( mama_fid_t *  fids,
mama_size_t  numFids 
)
virtual

Set the FIDs for any additional fields to cached in the book properties for the book.

Parameters
fidsthe array of FIDs to cache
numFidsthe size of the array

◆ setLevelPropertyFids()

virtual void Wombat::MamdaOrderBookListener::setLevelPropertyFids ( mama_fid_t *  fids,
mama_size_t  numFids 
)
virtual

Set the FIDs for any additional fields to cached in the price level properties for the book.

Parameters
fidsthe array of FIDs to cache
numFidsthe size of the array

◆ setEntryPropertyFids()

virtual void Wombat::MamdaOrderBookListener::setEntryPropertyFids ( mama_fid_t *  fids,
mama_size_t  numFids 
)
virtual

Set the FIDs for any additional fields to cached in the entry properties for the book.

Parameters
fidsthe array of FIDs to cache
numFidsthe size of the array

Member Data Documentation

◆ mImpl

MamdaOrderBookListenerImpl& Wombat::MamdaOrderBookListener::mImpl

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


© 2012 Linux Foundation