public class MamdaOrderBook
extends java.lang.Object
Constructor and Description |
---|
MamdaOrderBook()
Construct a new order book object.
|
MamdaOrderBook(MamdaOrderBook copy)
Construct a copy of the supplied orderbook.
|
MamdaOrderBook(MamdaOrderBook copy,
boolean writeable)
Construct a copy of the supplied orderbook.
|
Modifier and Type | Method and Description |
---|---|
void |
addDelta(MamdaOrderBookEntry entry,
MamdaOrderBookPriceLevel level,
double plDeltaSize,
char plAction,
char entryAction)
For book delta generation.
|
void |
addEntriesFromBook(MamdaOrderBook book,
MamdaOrderBookEntryFilter filter,
MamdaOrderBookBasicDeltaList delta)
Add all entries from another book into this book.
|
void |
addEntry(MamdaOrderBookEntry entry,
double price,
char side,
com.wombat.mama.MamaDateTime eventTime,
MamdaOrderBookBasicDelta delta)
Add an entry to the order book and (if "delta" is not NULL)
record information about the delta related to this action.
|
MamdaOrderBookEntry |
addEntry(java.lang.String entryId,
long entrySize,
double price,
char side,
com.wombat.mama.MamaDateTime eventTime,
com.wombat.mama.MamaSourceDerivative source,
MamdaOrderBookBasicDelta delta)
Add an entry to the order book and (if "delta" is not NULL)
record information about the delta related to this action.
|
void |
addLevel(MamdaOrderBookPriceLevel level)
Add a price level to the orderbook.
|
void |
addPriceLevelsFromBookAsEntries(MamdaOrderBook book,
java.lang.String source,
MamdaOrderBookBasicDeltaList delta)
Add all price levels from another book as entries (one per
price level) into this book using "source" as the entryId for
each entry.
|
void |
apply(MamdaBookAtomicLevel level) |
void |
apply(MamdaBookAtomicLevelEntry levelEntry) |
void |
apply(MamdaOrderBook deltaBook)
Apply a delta to this (presumably) full book.
|
void |
apply(MamdaOrderBookBasicDelta delta)
Apply a
MamdaOrderBookBasicDelta to this book. |
void |
apply(MamdaOrderBookBasicDeltaList deltaList)
Apply a
MamdaOrderBookBasicDeltaList to this book. |
java.util.Iterator |
askEntryIterator()
Iterator for all the ask side entries in the book.
|
java.util.Iterator |
askIterator()
Allows an application to iterate over all ask side price levels
in the order book.
|
void |
assertEqual(MamdaOrderBook rhs)
Order book equality verification.
|
void |
assertEqual(MamdaOrderBookPriceLevel lhsLevel,
MamdaOrderBookPriceLevel rhsLevel)
Order book level equality verification.
|
java.util.Iterator |
bidEntryIterator()
Iterator for all the bid side entries in the book.
|
java.util.Iterator |
bidIterator()
Allows an application to iterate over all the bid side price
levels in the order book.
|
void |
cleanupDetached() |
void |
clear()
Clear all levels from the order book.
|
void |
clearDeltaList()
clear the delta list using for storing generated deltas
|
void |
copy(MamdaOrderBook book)
Make a writeable deep copy of a book.
|
void |
copyReadOnly(MamdaOrderBook book)
Make a read only deep copy of a book.
|
void |
deleteEntriesFromSource(com.wombat.mama.MamaSource source,
MamdaOrderBookBasicDeltaList delta)
Delete all entries in this book that have "source" as its MamaSource.
|
void |
deleteEntry(MamdaOrderBookEntry entry,
com.wombat.mama.MamaDateTime eventTime,
MamdaOrderBookBasicDelta delta)
Delete an entry in the order book and (if "delta" is not NULL)
record information about the delta related to this action.
|
void |
deleteLevel(MamdaOrderBookPriceLevel level)
Delete a price level from the orderbook.
|
void |
detach(MamdaOrderBookEntry entry)
NOOP FOR JAVA
Adds the entry to the list of entries to be detached.
|
void |
detach(MamdaOrderBookPriceLevel level)
Detach a price level.
|
void |
dump()
Dump the order book to standard out.
|
void |
dump(java.io.OutputStream outputStream)
Dump the order book to an
OutputStream . |
boolean |
equals(java.lang.Object obj) |
MamdaOrderBookPriceLevel |
findLevel(double price,
char side) |
MamdaOrderBookPriceLevel |
findOrCreateLevel(double price,
char side)
Create a price level in the orderbook for the given price/size.
|
void |
generateDeltaMsgs(boolean publish)
Enable the generation of book deltas for this book.
|
MamdaOrderBookPriceLevel |
getAskMarketOrders() |
MamdaOrderBookPriceLevel |
getBidMarketOrders() |
com.wombat.mama.MamaDateTime |
getBookTime()
Return the book time.
|
boolean |
getCheckSourceState()
Get whether to check the MamaSourceState when
adding/deleting/re-evaluating entries in the book.
|
java.lang.Object |
getClosure()
Get the order book closure handle.
|
MamdaOrderBookEntry |
getEntryAtPosition(long pos,
char side)
Return the order book entry at position "pos" in the order book.
|
boolean |
getGenerateDeltaMsgs()
Get whether book delta generation is enabled
|
boolean |
getIsConsistent()
Get whether the order book is in a consistent or an an
inconsistent state.
|
MamdaOrderBookPriceLevel |
getLevelAtPosition(long pos,
char side)
Return the order book price level at position "pos" in the
order book.
|
MamdaOrderBookPriceLevel |
getLevelAtPrice(double price,
char side)
Return the order book price level at "price" on "side" of the
order book.
|
MamdaOrderBookPriceLevel |
getMarketOrdersSide(char side) |
boolean |
getNeedsReevaluation()
Get whether this book needs a re-evaluation.
|
int |
getNumAskLevels()
Get the number of ask levels.
|
int |
getNumBidLevels()
Get the number of bid levels.
|
MamdaOrderBookPriceLevel |
getOrCreateMarketOrdersSide(char side) |
java.lang.String |
getPartId() |
short |
getQuality()
Get the mamaQuality for this order book.
|
com.wombat.mama.MamaSource |
getSource()
Get the MamaSource for this order book.
|
com.wombat.mama.MamaSourceDerivative |
getSourceDerivative()
Return the SourceDerivative for this book.
|
java.lang.String |
getSymbol()
The order book subscription symbol.
|
long |
getTotalNumLevels()
Get the total number of price levels (both sides of order book).
|
int |
hashCode() |
boolean |
hasPartId() |
boolean |
isReadOnly()
If this book is read only.
|
boolean |
populateDelta(com.wombat.mama.MamaMsg msg)
Populate a MamaMsg of the changes to this order book.
|
void |
populateRecap(com.wombat.mama.MamaMsg msg)
Populate a MamaMsg with the current state of this order book.
|
boolean |
reevaluate()
Re-evaluate the order book.
|
void |
setAsDeltaDeleted(MamdaOrderBook bookToDelete)
Set this order book to be a delta that would, when applied,
delete all of the fields in the bookToDelete.
|
void |
setAsDeltaDifference(MamdaOrderBook lhs,
MamdaOrderBook rhs)
Set this order book to be a delta that would, when applied, be
the difference between to other books.
|
void |
setBookTime(com.wombat.mama.MamaDateTime value)
Set The SourceDerivative for this book.
|
void |
setCheckSourceState(boolean check)
Set whether to check the MamaSourceState when
adding/deleting/re-evaluating entries in the book.
|
void |
setClosure(java.lang.Object closure)
Set the order book closure handle.
|
void |
setIsConsistent(boolean isConsistent)
Set whether the order book is in a consistent or an an
inconsistent state.
|
void |
setNeedsReevaluation(boolean need)
Set whether this book needs a re-evaluation.
|
void |
setPartId(java.lang.String PartId) |
void |
setQuality(short quality)
Set the mamaQuality for this order book.
|
void |
setSourceDerivative(com.wombat.mama.MamaSourceDerivative value)
Set The SourceDerivative for this book.
|
static void |
setStrictChecking(boolean strict)
Enforce strict checking of order book modifications (at the
expense of some performance).
|
void |
setSymbol(java.lang.String symbol)
The order book subscription symbol.
|
void |
updateEntry(MamdaOrderBookEntry entry,
double size,
com.wombat.mama.MamaDateTime eventTime,
MamdaOrderBookBasicDelta delta)
Update an entry in the order book and (if "delta" is not NULL)
record information about the delta related to this action.
|
void |
updateLevel(MamdaOrderBookPriceLevel level)
Update an existing level in the orderbook.
|
public MamdaOrderBook()
public MamdaOrderBook(MamdaOrderBook copy)
copy
- The book to copy.public MamdaOrderBook(MamdaOrderBook copy, boolean writeable)
copy
- The book to copy.writeable
- is this copy writable. false creates a read only copypublic boolean isReadOnly()
public void clear()
public void setSymbol(java.lang.String symbol)
symbol
- the symbol.public java.lang.String getSymbol()
public void setPartId(java.lang.String PartId)
public java.lang.String getPartId()
public boolean hasPartId()
public MamdaOrderBookPriceLevel findOrCreateLevel(double price, char side)
price
- The price of the price level to find/create.side
- The side of the book of the price level to find/create.MamdaOrderBookException
- When an error is encountered during
book processing.public MamdaOrderBookPriceLevel findLevel(double price, char side)
public MamdaOrderBookPriceLevel getMarketOrdersSide(char side)
public MamdaOrderBookPriceLevel getOrCreateMarketOrdersSide(char side)
public void apply(MamdaOrderBook deltaBook)
deltaBook
- The delta to apply to the order book.MamdaOrderBookException
- if called on a read only order bookpublic void apply(MamdaOrderBookBasicDelta delta)
MamdaOrderBookBasicDelta
to this book.delta
- The delta to apply.MamdaOrderBookException
- if called on a read only order bookpublic void apply(MamdaBookAtomicLevel level)
public void apply(MamdaBookAtomicLevelEntry levelEntry)
public void apply(MamdaOrderBookBasicDeltaList deltaList)
MamdaOrderBookBasicDeltaList
to this book.deltaList
- The deltas to apply.MamdaOrderBookException
- if called on a read only order bookpublic void copy(MamdaOrderBook book)
book
- The order book to copy.public void copyReadOnly(MamdaOrderBook book)
book
- The order book to copy.public void setAsDeltaDeleted(MamdaOrderBook bookToDelete)
bookToDelete
- The book to be deleted.MamdaOrderBookException
- if called on a read only order bookpublic void setAsDeltaDifference(MamdaOrderBook lhs, MamdaOrderBook rhs)
lhs
- An order book.rhs
- An order book.MamdaOrderBookException
- if called on a read only order bookpublic long getTotalNumLevels()
public int getNumBidLevels()
public int getNumAskLevels()
public MamdaOrderBookPriceLevel getBidMarketOrders()
public MamdaOrderBookPriceLevel getAskMarketOrders()
public com.wombat.mama.MamaDateTime getBookTime()
public void setBookTime(com.wombat.mama.MamaDateTime value)
value
- The SourceDerivative.public void setSourceDerivative(com.wombat.mama.MamaSourceDerivative value)
value
- The SourceDerivative.public com.wombat.mama.MamaSourceDerivative getSourceDerivative()
public com.wombat.mama.MamaSource getSource()
public void setQuality(short quality)
quality
- The new quality.public short getQuality()
public void setClosure(java.lang.Object closure)
closure
- The closure.public java.lang.Object getClosure()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void addEntry(MamdaOrderBookEntry entry, double price, char side, com.wombat.mama.MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
entry
- the entryprice
- the priceside
- the side (bid or ask)eventTime
- the event time.delta
- the delta.MamdaOrderBookException
- if called on a read only order bookpublic MamdaOrderBookEntry addEntry(java.lang.String entryId, long entrySize, double price, char side, com.wombat.mama.MamaDateTime eventTime, com.wombat.mama.MamaSourceDerivative source, MamdaOrderBookBasicDelta delta)
price
- the priceside
- the side (bid or ask)eventTime
- the event time.delta
- the delta.entryId
- The id.entrySize
- the sizesource
- the MamaSourceDerivative.MamdaOrderBookException
- if called on a read only order bookpublic void addLevel(MamdaOrderBookPriceLevel level)
level
- The price level to add to the orderbook.public void updateLevel(MamdaOrderBookPriceLevel level)
level
- The details of the price level to update.MamdaOrderBookException
- When an error is encountered during
book processing.public boolean populateDelta(com.wombat.mama.MamaMsg msg)
msg
- A MamaMsg ref containing all changes to the current book.public void populateRecap(com.wombat.mama.MamaMsg msg)
msg
- A MamaMsg containing all book, price and entry
(if applicable) details of the current book.public void deleteLevel(MamdaOrderBookPriceLevel level)
level
- The price level to delete from the orderbook.MamdaOrderBookException
- When an error is encountered during
book processing.public boolean reevaluate()
MamdaOrderBookException
- if called on a read only order bookpublic void setNeedsReevaluation(boolean need)
need
- true if books requires re-evaluation.public boolean getNeedsReevaluation()
public void setCheckSourceState(boolean check)
check
- true to check the MamaSourceState.public boolean getCheckSourceState()
public MamdaOrderBookPriceLevel getLevelAtPrice(double price, char side)
price
- The price of the order book price level.side
- The side of the order book to search.public MamdaOrderBookPriceLevel getLevelAtPosition(long pos, char side)
pos
- The position of the order book price level.side
- The side of the order book to search.public MamdaOrderBookEntry getEntryAtPosition(long pos, char side)
pos
- The position of the order book entry.side
- The side of the order book to search.public void assertEqual(MamdaOrderBook rhs)
rhs
- The order book to compare to the current book.MamdaOrderBookException
- The two books are not equal.public void assertEqual(MamdaOrderBookPriceLevel lhsLevel, MamdaOrderBookPriceLevel rhsLevel)
rhs
- The order book to compare to the current book.MamdaOrderBookException
- The two books are not equal.public void setIsConsistent(boolean isConsistent)
isConsistent
- Whether the book is consistent.public boolean getIsConsistent()
public void dump()
public void dump(java.io.OutputStream outputStream)
OutputStream
.outputStream
- the OutputStream
public void updateEntry(MamdaOrderBookEntry entry, double size, com.wombat.mama.MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
entry
- the entrysize
- the sizeeventTime
- the event timedelta
- the delta.MamdaOrderBookException
- if called on a read only order bookpublic void deleteEntry(MamdaOrderBookEntry entry, com.wombat.mama.MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
entry
- the entry to detete.eventTime
- the event time.delta
- the deltaMamdaOrderBookException
- if called on a read only order bookpublic void addEntriesFromBook(MamdaOrderBook book, MamdaOrderBookEntryFilter filter, MamdaOrderBookBasicDeltaList delta)
book
- The source book to add.filter
- If not NULL, a filter to apply to each entry.delta
- An optional delta to collect the added entries.MamdaOrderBookException
- if called on a read only order bookpublic void addPriceLevelsFromBookAsEntries(MamdaOrderBook book, java.lang.String source, MamdaOrderBookBasicDeltaList delta)
book
- The source book to add.source
- The name to use as the entry ID.delta
- An optional delta to collect the added entries.MamdaOrderBookException
- if called on a read only order bookpublic void deleteEntriesFromSource(com.wombat.mama.MamaSource source, MamdaOrderBookBasicDeltaList delta)
source
- The source to match.delta
- An optional delta to collect the deleted entries.MamdaOrderBookException
- if called on a read only order bookpublic void generateDeltaMsgs(boolean publish)
publish
- Whether book delta generation is enabled.public boolean getGenerateDeltaMsgs()
public void clearDeltaList()
public void addDelta(MamdaOrderBookEntry entry, MamdaOrderBookPriceLevel level, double plDeltaSize, char plAction, char entryAction)
entry
- MamdaOrderBookEntry where change occurred.level
- MamdaOrderBookPriceLevel where change occurred.plDeltaSize
- Pricelevel size change.plAction
- Pricelevel action.entAction
- Entry action.public void detach(MamdaOrderBookEntry entry)
entry
- the entry to detach.public void detach(MamdaOrderBookPriceLevel level)
level
- the level to detach.MamdaOrderBookException
- if called on a read only order bookpublic java.util.Iterator bidEntryIterator()
public java.util.Iterator bidIterator()
public java.util.Iterator askIterator()
public java.util.Iterator askEntryIterator()
public static void setStrictChecking(boolean strict)
strict
- the value for strict checking.public void cleanupDetached()
Copyright 2007 Wombat Financial Software, Inc.