Package com.wombat.mamda.orderbook
Class MamdaOrderBookEntry
- java.lang.Object
-
- com.wombat.mamda.orderbook.MamdaOrderBookEntry
-
public class MamdaOrderBookEntry extends java.lang.Object
MamdaOrderBookEntry is a class that provides implements order book functionality.
-
-
Field Summary
Fields Modifier and Type Field Description static char
ACTION_ADD
An enumeration for book entry actions.static char
ACTION_DELETE
An updated entry.static char
ACTION_UNKNOWN
A deleted entry.static char
ACTION_UPDATE
A new entry.
-
Constructor Summary
Constructors Constructor Description MamdaOrderBookEntry()
MamdaOrderBookEntry(MamdaOrderBookEntry copy)
Copy an order book entry object which is a shallow copy of the original.MamdaOrderBookEntry(java.lang.String entryId, double entrySize, char action, com.wombat.mama.MamaDateTime eventTime, com.wombat.mama.MamaSourceDerivative source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertEqual(MamdaOrderBookEntry rhs)
Order book entry equality verification.void
copy(MamdaOrderBookEntry copy)
Copy an order book entry object which is an exact and deep copy of the original.boolean
equalId(java.lang.String id)
Whether the id of the entry is equal to the id passed to the method.boolean
equals(java.lang.Object obj)
char
getAction()
Whether to ADD, UPDATE or DELETE the entry.boolean
getCheckSourceState()
Get whether this order book wants to check the source state.java.lang.Object
getClosure()
Get the order book entry closure handle.java.lang.String
getId()
If supported, Order book entry ID (order ID, participant ID, etc.)MamdaOrderBookEntryManager
getManager()
Get the MamdaOrderBookEntryManager object to which this entry belongs.MamdaOrderBook
getOrderBook()
Get the order book for this entry, if possible.int
getPosition(int maxPos)
Get the position in the order book for this entry.double
getPrice()
Get the price for this entry.MamdaOrderBookPriceLevel
getPriceLevel()
Get the MamdaOrderBookPriceLevel object to which this entry belongs.short
getQuality()
Get the entry-level quality factor.char
getReason()
The reason for the order entry.char
getSide()
Get the price for this entry.double
getSize()
The size of the order entry.com.wombat.mama.MamaSource
getSource()
Return the MamaSource for this book entry.com.wombat.mama.MamaSourceDerivative
getSourceDerivative()
Return the MamaSourceDerivative for this book entry.int
getStatus()
Return the status for the entry.java.lang.String
getSymbol()
Get the symbol for this entry, if possible.com.wombat.mama.MamaDateTime
getTime()
Time of order book entry update.java.lang.String
getUniqueId()
If supported, Order book entry unique ID (order ID, participant ID, etc.).int
hashCode()
boolean
isVisible()
void
setAction(char action)
void
setClosure(java.lang.Object closure)
Set the order book entry closure handle.void
setDetails(MamdaBookAtomicLevelEntry copy)
void
setDetails(MamdaOrderBookEntry copy)
void
setId(java.lang.String id)
void
setManager(MamdaOrderBookEntryManager manager)
Set the MamdaOrderBookEntryManager object to which this entry belongs.void
setPriceLevel(MamdaOrderBookPriceLevel priceLevel)
Set the MamdaOrderBookPriceLevel object to which this entry belongs.void
setQuality(short quality)
Set the entry-level quality factor.void
setReason(char reason)
void
setSize(double size)
void
setSourceDerivative(com.wombat.mama.MamaSourceDerivative source)
Set the MamaSourceDerivative for this book entry.void
setStatus(int value)
Set the status for the entry.static void
setStrictChecking(boolean strict)
Enforce strict checking of order book modifications (at the expense of some performance).void
setTime(com.wombat.mama.MamaDateTime time)
void
setUniqueId(java.lang.String uniqueId)
-
-
-
Field Detail
-
ACTION_ADD
public static final char ACTION_ADD
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.- See Also:
- Constant Field Values
-
ACTION_UPDATE
public static final char ACTION_UPDATE
A new entry.- See Also:
- Constant Field Values
-
ACTION_DELETE
public static final char ACTION_DELETE
An updated entry.- See Also:
- Constant Field Values
-
ACTION_UNKNOWN
public static final char ACTION_UNKNOWN
A deleted entry.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MamdaOrderBookEntry
public MamdaOrderBookEntry()
-
MamdaOrderBookEntry
public MamdaOrderBookEntry(MamdaOrderBookEntry copy)
Copy an order book entry object which is a shallow copy of the original.- Parameters:
copy
- The MamdaOrderBookEntry to copy.
-
MamdaOrderBookEntry
public MamdaOrderBookEntry(java.lang.String entryId, double entrySize, char action, com.wombat.mama.MamaDateTime eventTime, com.wombat.mama.MamaSourceDerivative source)
-
-
Method Detail
-
copy
public void copy(MamdaOrderBookEntry copy)
Copy an order book entry object which is an exact and deep copy of the original.- Parameters:
copy
- The MamdaOrderBookEntry to copy.
-
setId
public void setId(java.lang.String id)
-
setSize
public void setSize(double size)
-
setAction
public void setAction(char action)
-
setReason
public void setReason(char reason)
-
setTime
public void setTime(com.wombat.mama.MamaDateTime time)
-
setDetails
public void setDetails(MamdaOrderBookEntry copy)
-
setDetails
public void setDetails(MamdaBookAtomicLevelEntry copy)
-
getId
public java.lang.String getId()
If supported, Order book entry ID (order ID, participant ID, etc.)- Returns:
- the id.
-
getUniqueId
public java.lang.String getUniqueId()
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
-
getSize
public double getSize()
The size of the order entry.- Returns:
- the size.
-
getAction
public char getAction()
Whether to ADD, UPDATE or DELETE the entry.- Returns:
- char The action.
-
getReason
public char getReason()
The reason for the order entry.- Returns:
- the reason
-
getTime
public com.wombat.mama.MamaDateTime getTime()
Time of order book entry update.- Returns:
- the time.
-
setStatus
public void setStatus(int value)
Set the status for the entry.
-
getStatus
public int getStatus()
Return the status for the entry.- Returns:
- the status.
-
getPrice
public double getPrice()
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.
-
getSide
public char getSide()
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.
-
getPosition
public int getPosition(int maxPos)
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:
maxPos
- The maximum position to return;- Returns:
- The position of this entry in the order book.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
setPriceLevel
public void setPriceLevel(MamdaOrderBookPriceLevel priceLevel)
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:
priceLevel
- The price level to be associated with.
-
getPriceLevel
public MamdaOrderBookPriceLevel getPriceLevel()
Get the MamdaOrderBookPriceLevel object to which this entry belongs.- Returns:
- The price level currently associated with this entry.
-
getOrderBook
public MamdaOrderBook getOrderBook()
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.
-
setManager
public void 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:
manager
- The manager.
-
getManager
public MamdaOrderBookEntryManager getManager()
Get the MamdaOrderBookEntryManager object to which this entry belongs.- Returns:
- The manager currently associated with this entry.
-
getSymbol
public java.lang.String getSymbol()
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.
-
setSourceDerivative
public void setSourceDerivative(com.wombat.mama.MamaSourceDerivative source)
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:
source
- The MAMA source derivative.
-
getSourceDerivative
public com.wombat.mama.MamaSourceDerivative getSourceDerivative()
Return the MamaSourceDerivative for this book entry.- Returns:
- the MamaSourceDerivative
-
getSource
public com.wombat.mama.MamaSource getSource()
Return the MamaSource for this book entry.- Returns:
- the source.
-
getCheckSourceState
public boolean getCheckSourceState()
Get whether this order book wants to check the source state.- Returns:
- Whether to check source state.
-
setQuality
public void setQuality(short quality)
Set the entry-level quality factor. This level, if not MAMA_QUALITY_OK, overrides the source-level level.- Parameters:
quality
- The new entry-level MAMA quality level.
-
getQuality
public short getQuality()
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.
-
isVisible
public boolean isVisible()
-
setClosure
public void setClosure(java.lang.Object closure)
Set the order book entry closure handle.- Parameters:
closure
- The closure.
-
getClosure
public java.lang.Object getClosure()
Get the order book entry closure handle.- Returns:
- The entry closure.
-
assertEqual
public void assertEqual(MamdaOrderBookEntry rhs)
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. \throw\n
-
equalId
public boolean equalId(java.lang.String id)
Whether the id of the entry is equal to the id passed to the method.- Parameters:
id
- The id to compare to the order entry id.- Returns:
- boolean Whether the id is the same as the order id.
-
setStrictChecking
public static void setStrictChecking(boolean strict)
Enforce strict checking of order book modifications (at the expense of some performance). This setting is automatically updated by MamdaOrderBook::setStrictChecking().
-
setUniqueId
public void setUniqueId(java.lang.String uniqueId)
-
-