Package com.wombat.mamda.orderbook
Class MamdaBookAtomicListener
- java.lang.Object
-
- com.wombat.mamda.orderbook.MamdaBookAtomicListener
-
- All Implemented Interfaces:
MamdaBasicEvent
,MamdaBasicRecap
,MamdaMsgListener
,MamdaBookAtomicGap
,MamdaBookAtomicLevel
,MamdaBookAtomicLevelEntry
public class MamdaBookAtomicListener extends java.lang.Object implements MamdaMsgListener, MamdaBookAtomicLevel, MamdaBookAtomicLevelEntry, MamdaBookAtomicGap
-
-
Constructor Summary
Constructors Constructor Description MamdaBookAtomicListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBookHandler(MamdaBookAtomicBookHandler handler)
void
addLevelEntryHandler(MamdaBookAtomicLevelEntryHandler handler)
void
addLevelHandler(MamdaBookAtomicLevelHandler handler)
java.util.Iterator
entryIterator()
Returns ajava.util.Iterator
for all entries within this level.com.wombat.mama.MamaDateTime
getActivityTime()
Activity time.short
getActivityTimeFieldState()
return Activity time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updatedlong
getBeginGapSeqNum()
Beginning sequence number in a detected gap event.long
getEndGapSeqNum()
Ending sequence number in a detected gap event.long
getEventSeqNum()
short
getEventSeqNumFieldState()
return source sequence number Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updatedcom.wombat.mama.MamaDateTime
getEventTime()
short
getEventTimeFieldState()
return event time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updatedboolean
getHasMarketOrders()
com.wombat.mama.MamaDateTime
getLineTime()
Get the line time of the update.short
getLineTimeFieldState()
short
getMsgQual()
char
getOrderType()
java.lang.String
getPartId()
Get the participant identifier.short
getPartIdFieldState()
char
getPriceLevelAction()
The action to apply to the orderbook for this price level.long
getPriceLevelActNumEntries()
char
getPriceLevelEntryAction()
Order book entry action to apply to the full order book.java.lang.String
getPriceLevelEntryId()
Order book entry Id.char
getPriceLevelEntryReason()
Reason for order book entry.long
getPriceLevelEntrySize()
Return the order book entry sizecom.wombat.mama.MamaDateTime
getPriceLevelEntryTime()
Return the time of order book entry update.com.wombat.mama.MamaPrice
getPriceLevelMamaPrice()
Return the MamaPrice for this price level.long
getPriceLevelNum()
Return at which position this level is within an update containing a number of levels.double
getPriceLevelNumEntries()
Number of order book entries at current price level.long
getPriceLevelNumLevels()
Return the number of price levels in the order book update.double
getPriceLevelPrice()
Return the price for this price level.char
getPriceLevelSide()
Side of book at current price level.double
getPriceLevelSize()
Return the number of order entries comprising this price level.long
getPriceLevelSizeChange()
Aggregate size at current price level.com.wombat.mama.MamaDateTime
getPriceLevelTime()
Time of order book price level.com.wombat.mama.MamaDateTime
getSendTime()
Get the send time of the update.short
getSendTimeFieldState()
com.wombat.mama.MamaDateTime
getSrcTime()
Source time.short
getSrcTimeFieldState()
return Source time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updatedjava.lang.String
getSymbol()
Get the string symbol for the instrument.short
getSymbolFieldState()
boolean
isVisible()
void
onMsg(MamdaSubscription subscription, com.wombat.mama.MamaMsg msg, short msgType)
Invoked for each message received for the subscription to which the Listener is registered.void
setOrderType(char orderType)
void
setPriceLevel(long priceLevel)
void
setProcessMarketOrders(boolean process)
-
-
-
Method Detail
-
entryIterator
public java.util.Iterator entryIterator()
Returns ajava.util.Iterator
for all entries within this level. Price Level entries are represented by theMamdaOrderBookEntry
class.- Specified by:
entryIterator
in interfaceMamdaBookAtomicLevel
- Specified by:
entryIterator
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- Iterator The iterator for the price level entries
-
addBookHandler
public void addBookHandler(MamdaBookAtomicBookHandler handler)
-
addLevelHandler
public void addLevelHandler(MamdaBookAtomicLevelHandler handler)
-
addLevelEntryHandler
public void addLevelEntryHandler(MamdaBookAtomicLevelEntryHandler handler)
-
getSymbol
public java.lang.String getSymbol()
Description copied from interface:MamdaBasicRecap
Get the string symbol for the instrument.- Specified by:
getSymbol
in interfaceMamdaBasicRecap
- Returns:
- Symbol. This is the "well-known" symbol for the security, including any symbology mapping performed by the publisher.
-
getPartId
public java.lang.String getPartId()
Description copied from interface:MamdaBasicRecap
Get the participant identifier.- Specified by:
getPartId
in interfaceMamdaBasicRecap
- Returns:
- Participant ID. This may be an exchange identifier, a market maker ID, etc., or NULL (if this is not related to any specific participant).
-
getSrcTime
public com.wombat.mama.MamaDateTime getSrcTime()
Description copied from interface:MamdaBasicRecap
Source time. Typically, the exchange generated feed- Specified by:
getSrcTime
in interfaceMamdaBasicEvent
- Specified by:
getSrcTime
in interfaceMamdaBasicRecap
- Returns:
- Source time. Typically, the exchange generated feed time stamp. This is often the same as the "event time", because many feeds do not distinguish between the actual event time and when the exchange sent the message.
-
getActivityTime
public com.wombat.mama.MamaDateTime getActivityTime()
Description copied from interface:MamdaBasicRecap
Activity time. A feed handler generated time stamp representing when the data item was last updated.- Specified by:
getActivityTime
in interfaceMamdaBasicEvent
- Specified by:
getActivityTime
in interfaceMamdaBasicRecap
- Returns:
- Activity time. A feed handler generated time stamp representing when the data item was last updated.
-
getLineTime
public com.wombat.mama.MamaDateTime getLineTime()
Description copied from interface:MamdaBasicRecap
Get the line time of the update.- Specified by:
getLineTime
in interfaceMamdaBasicRecap
- Returns:
- Line time. A feed handler (or similar publisher) time stamp representing the time that such publisher received the update message pertaining to the event. If clocks are properly synchronized and the source time (see above) is accurate enough, then the difference between the source time and line time is the latency between the data source and the feed handler.
-
getSendTime
public com.wombat.mama.MamaDateTime getSendTime()
Description copied from interface:MamdaBasicRecap
Get the send time of the update.- Specified by:
getSendTime
in interfaceMamdaBasicRecap
- Returns:
- Send time. A feed handler (or similar publisher) time stamp representing the time that such publisher sent the current message. The difference between the line time and send time is the latency within the feed handler itself. Also, if clocks are properly synchronized then the difference between the send time and current time is the latency within the market data distribution framework (i.e. MAMA and the underlying middleware).
-
getMsgQual
public short getMsgQual()
-
getEventSeqNum
public long getEventSeqNum()
- Specified by:
getEventSeqNum
in interfaceMamdaBasicEvent
- Returns:
- Source sequence number. The exchange generated sequence number.
-
getEventTime
public com.wombat.mama.MamaDateTime getEventTime()
- Specified by:
getEventTime
in interfaceMamdaBasicEvent
- Returns:
- Event time. Typically, when the event actually occurred. This is often the same as the "source time", because many feeds do not distinguish between the actual event time and when the exchange sent the message.
-
getPriceLevelNumLevels
public long getPriceLevelNumLevels()
Description copied from interface:MamdaBookAtomicLevel
Return the number of price levels in the order book update.- Specified by:
getPriceLevelNumLevels
in interfaceMamdaBookAtomicLevel
- Returns:
- The number of price levels.
-
getPriceLevelNum
public long getPriceLevelNum()
Description copied from interface:MamdaBookAtomicLevel
Return at which position this level is within an update containing a number of levels. (i.e. level m of n levels in the update)- Specified by:
getPriceLevelNum
in interfaceMamdaBookAtomicLevel
- Returns:
- The position of this level in the update received.
-
getPriceLevelPrice
public double getPriceLevelPrice()
Description copied from interface:MamdaBookAtomicLevel
Return the price for this price level.- Specified by:
getPriceLevelPrice
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelPrice
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The price level price.
- See Also:
MamdaBookAtomicLevel.getPriceLevelPrice()
-
getPriceLevelMamaPrice
public com.wombat.mama.MamaPrice getPriceLevelMamaPrice()
Description copied from interface:MamdaBookAtomicLevel
Return the MamaPrice for this price level.- Specified by:
getPriceLevelMamaPrice
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelMamaPrice
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The price level price.
- See Also:
MamdaBookAtomicLevel.getPriceLevelMamaPrice()
-
getPriceLevelSize
public double getPriceLevelSize()
Description copied from interface:MamdaBookAtomicLevel
Return the number of order entries comprising this price level.
Not supported for V5 entry book updates.- Specified by:
getPriceLevelSize
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelSize
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The number of entries in this price level.
- See Also:
MamdaBookAtomicLevel.getPriceLevelSize()
-
getPriceLevelSizeChange
public long getPriceLevelSizeChange()
Description copied from interface:MamdaBookAtomicLevel
Aggregate size at current price level.
Not supported for V5 entry book updates.- Specified by:
getPriceLevelSizeChange
in interfaceMamdaBookAtomicLevel
- Returns:
- The aggregate size at the current price level.
-
getPriceLevelAction
public char getPriceLevelAction()
Description copied from interface:MamdaBookAtomicLevel
The action to apply to the orderbook for this price level. Can have a value of:- A : Add a new price level
- U : Update an existing price level
- D : Delete an existing price level
- C : Closing information for price level (often treat the same as Update).
- Specified by:
getPriceLevelAction
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelAction
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The price level action.
- See Also:
MamdaBookAtomicLevel.getPriceLevelAction()
-
getPriceLevelSide
public char getPriceLevelSide()
Description copied from interface:MamdaBookAtomicLevel
Side of book at current price level.- B : Bid side. Same as 'buy' side.
- A : Ask side. Same as 'sell' side.
- Specified by:
getPriceLevelSide
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelSide
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The price level side.
- See Also:
MamdaBookAtomicLevel.getPriceLevelSide()
-
getPriceLevelTime
public com.wombat.mama.MamaDateTime getPriceLevelTime()
Description copied from interface:MamdaBookAtomicLevel
Time of order book price level.- Specified by:
getPriceLevelTime
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelTime
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The time of the orderbook price level.
- See Also:
MamdaBookAtomicLevel.getPriceLevelTime()
-
getPriceLevelNumEntries
public double getPriceLevelNumEntries()
Description copied from interface:MamdaBookAtomicLevel
Number of order book entries at current price level.
Not supported for V5 entry book updates.- Specified by:
getPriceLevelNumEntries
in interfaceMamdaBookAtomicLevel
- Specified by:
getPriceLevelNumEntries
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The number of entries at the current price level.
- See Also:
MamdaBookAtomicLevel.getPriceLevelNumEntries()
-
setOrderType
public void setOrderType(char orderType)
-
getOrderType
public char getOrderType()
-
getHasMarketOrders
public boolean getHasMarketOrders()
-
setProcessMarketOrders
public void setProcessMarketOrders(boolean process)
-
getPriceLevelActNumEntries
public long getPriceLevelActNumEntries()
- Specified by:
getPriceLevelActNumEntries
in interfaceMamdaBookAtomicLevelEntry
-
getPriceLevelEntryAction
public char getPriceLevelEntryAction()
Description copied from interface:MamdaBookAtomicLevelEntry
Order book entry action to apply to the full order book. A : Add entry to the price level. U : Update existing entry in the price level. D : Delete existing entry from the price level.- Specified by:
getPriceLevelEntryAction
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The orderbook entry action.
-
getPriceLevelEntryReason
public char getPriceLevelEntryReason()
Description copied from interface:MamdaBookAtomicLevelEntry
Reason for order book entry.- Specified by:
getPriceLevelEntryReason
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The orderbook entry reason.
-
getPriceLevelEntryId
public java.lang.String getPriceLevelEntryId()
Description copied from interface:MamdaBookAtomicLevelEntry
Order book entry Id. (order ID, participant ID, etc.)- Specified by:
getPriceLevelEntryId
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- The entry id
-
getPriceLevelEntrySize
public long getPriceLevelEntrySize()
Description copied from interface:MamdaBookAtomicLevelEntry
Return the order book entry size- Specified by:
getPriceLevelEntrySize
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- Order book entry size
-
getPriceLevelEntryTime
public com.wombat.mama.MamaDateTime getPriceLevelEntryTime()
Description copied from interface:MamdaBookAtomicLevelEntry
Return the time of order book entry update.- Specified by:
getPriceLevelEntryTime
in interfaceMamdaBookAtomicLevelEntry
- Returns:
- Time of order book entry update.
-
getBeginGapSeqNum
public long getBeginGapSeqNum()
Description copied from interface:MamdaBookAtomicGap
Beginning sequence number in a detected gap event.- Specified by:
getBeginGapSeqNum
in interfaceMamdaBookAtomicGap
-
getEndGapSeqNum
public long getEndGapSeqNum()
Description copied from interface:MamdaBookAtomicGap
Ending sequence number in a detected gap event.- Specified by:
getEndGapSeqNum
in interfaceMamdaBookAtomicGap
-
setPriceLevel
public void setPriceLevel(long priceLevel)
-
isVisible
public boolean isVisible()
- Specified by:
isVisible
in interfaceMamdaBookAtomicLevelEntry
-
getSymbolFieldState
public short getSymbolFieldState()
- Specified by:
getSymbolFieldState
in interfaceMamdaBasicRecap
- Returns:
- symbol Field State
-
getPartIdFieldState
public short getPartIdFieldState()
- Specified by:
getPartIdFieldState
in interfaceMamdaBasicRecap
- Returns:
- participant ID Field State
-
getSrcTimeFieldState
public short getSrcTimeFieldState()
Description copied from interface:MamdaBasicEvent
return Source time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updated- Specified by:
getSrcTimeFieldState
in interfaceMamdaBasicEvent
- Specified by:
getSrcTimeFieldState
in interfaceMamdaBasicRecap
- Returns:
- source time Field State
-
getActivityTimeFieldState
public short getActivityTimeFieldState()
Description copied from interface:MamdaBasicEvent
return Activity time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updated- Specified by:
getActivityTimeFieldState
in interfaceMamdaBasicEvent
- Specified by:
getActivityTimeFieldState
in interfaceMamdaBasicRecap
- Returns:
- activity time Field State
-
getLineTimeFieldState
public short getLineTimeFieldState()
- Specified by:
getLineTimeFieldState
in interfaceMamdaBasicRecap
- Returns:
- line time Field State
-
getSendTimeFieldState
public short getSendTimeFieldState()
- Specified by:
getSendTimeFieldState
in interfaceMamdaBasicRecap
- Returns:
- send time Field State
-
getEventTimeFieldState
public short getEventTimeFieldState()
Description copied from interface:MamdaBasicEvent
return event time Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updated- Specified by:
getEventTimeFieldState
in interfaceMamdaBasicEvent
-
getEventSeqNumFieldState
public short getEventSeqNumFieldState()
Description copied from interface:MamdaBasicEvent
return source sequence number Field State MODIFIED (2) value indicates the fied was updated in last tick NOT MODIFIED (1) value indicate that there was no change in the last tick NOT_INITIALISED (0) value indicates that the field has never been updated- Specified by:
getEventSeqNumFieldState
in interfaceMamdaBasicEvent
-
onMsg
public void onMsg(MamdaSubscription subscription, com.wombat.mama.MamaMsg msg, short msgType)
Description copied from interface:MamdaMsgListener
Invoked for each message received for the subscription to which the Listener is registered.- Specified by:
onMsg
in interfaceMamdaMsgListener
- Parameters:
subscription
- The MamdaSubscription to which this listener was registered.msg
- The MamaMsg received by the underlying MAMA API and which resulted in this callback being invoked.msgType
- The message type. e.g. INITIAL, RECAP, UPDATE etc.
-
-