Classes Files

com::wombat::mamda::orderbook::MamdaOrderBook

More…

Public Functions

  Name
  MamdaOrderBook()
  MamdaOrderBook(MamdaOrderBook copy)
  MamdaOrderBook(MamdaOrderBook copy, boolean writeable)
boolean isReadOnly()
void clear()
void setSymbol(String symbol)
String getSymbol()
void setPartId(String PartId)
String getPartId()
boolean hasPartId()
MamdaOrderBookPriceLevel findOrCreateLevel(double price, char side)
MamdaOrderBookPriceLevel findLevel(double price, char side)
MamdaOrderBookPriceLevel getMarketOrdersSide(char side)
MamdaOrderBookPriceLevel getOrCreateMarketOrdersSide(char side)
void apply(MamdaOrderBook deltaBook)
void apply(MamdaOrderBookBasicDelta delta)
void apply(MamdaBookAtomicLevel level)
void apply(MamdaBookAtomicLevelEntry levelEntry)
void apply(MamdaOrderBookBasicDeltaList deltaList)
void copy(MamdaOrderBook book)
void copyReadOnly(MamdaOrderBook book)
void setAsDeltaDeleted(MamdaOrderBook bookToDelete)
void setAsDeltaDifference(MamdaOrderBook lhs, MamdaOrderBook rhs)
long getTotalNumLevels()
int getNumBidLevels()
int getNumAskLevels()
MamdaOrderBookPriceLevel getBidMarketOrders()
MamdaOrderBookPriceLevel getAskMarketOrders()
MamaDateTime getBookTime()
void setBookTime(MamaDateTime value)
void setSourceDerivative(MamaSourceDerivative value)
MamaSourceDerivative getSourceDerivative()
MamaSource getSource()
void setQuality(short quality)
short getQuality()
void setClosure(Object closure)
Object getClosure()
int hashCode()
boolean equals(Object obj)
void addEntry(MamdaOrderBookEntry entry, double price, char side, MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
MamdaOrderBookEntry addEntry(String entryId, long entrySize, double price, char side, MamaDateTime eventTime, MamaSourceDerivative source, MamdaOrderBookBasicDelta delta)
void addLevel(MamdaOrderBookPriceLevel level)
void updateLevel(MamdaOrderBookPriceLevel level)
boolean populateDelta(MamaMsg msg)
void populateRecap(MamaMsg msg)
void deleteLevel(MamdaOrderBookPriceLevel level)
boolean reevaluate()
void setNeedsReevaluation(boolean need)
boolean getNeedsReevaluation()
void setCheckSourceState(boolean check)
boolean getCheckSourceState()
MamdaOrderBookPriceLevel getLevelAtPrice(double price, char side)
MamdaOrderBookPriceLevel getLevelAtPosition(long pos, char side)
MamdaOrderBookEntry getEntryAtPosition(long pos, char side)
void assertEqual(MamdaOrderBook rhs)
void assertEqual(MamdaOrderBookPriceLevel lhsLevel, MamdaOrderBookPriceLevel rhsLevel)
void setIsConsistent(boolean isConsistent)
boolean getIsConsistent()
void dump()
void dump(OutputStream outputStream)
void updateEntry(MamdaOrderBookEntry entry, double size, MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
void deleteEntry(MamdaOrderBookEntry entry, MamaDateTime eventTime, MamdaOrderBookBasicDelta delta)
void addEntriesFromBook(MamdaOrderBook book, MamdaOrderBookEntryFilter filter, MamdaOrderBookBasicDeltaList delta)
void addPriceLevelsFromBookAsEntries(MamdaOrderBook book, String source, MamdaOrderBookBasicDeltaList delta)
void deleteEntriesFromSource(MamaSource source, MamdaOrderBookBasicDeltaList delta)
void generateDeltaMsgs(boolean publish)
boolean getGenerateDeltaMsgs()
void clearDeltaList()
void addDelta(MamdaOrderBookEntry entry, MamdaOrderBookPriceLevel level, double plDeltaSize, char plAction, char entryAction)
void detach(MamdaOrderBookEntry entry)
void detach(MamdaOrderBookPriceLevel level)
Iterator bidEntryIterator()
Iterator bidIterator()
Iterator askIterator()
Iterator askEntryIterator()
void cleanupDetached()
void setStrictChecking(boolean strict)

Detailed Description

class com::wombat::mamda::orderbook::MamdaOrderBook;

MamdaOrderBook is a class that provides order book functionality, including iterators over price levels and entries within price levels.

An order book may be read only or writeable. Copying into a read only book is faster than creating a writeable book. Calling methods that attempt to edit the book structure on a read only book will throw a MamdaOrderBookException.

Public Functions Documentation

function MamdaOrderBook

inline MamdaOrderBook()

Construct a new order book object. Contains no price levels upon construction. This book will be writeable.

function MamdaOrderBook

inline MamdaOrderBook(
    MamdaOrderBook copy
)

Parameters:

  • copy The book to copy.

Construct a copy of the supplied orderbook.

function MamdaOrderBook

inline MamdaOrderBook(
    MamdaOrderBook copy,
    boolean writeable
)

Parameters:

  • copy The book to copy.
  • writeable is this copy writable. false creates a read only copy

Construct a copy of the supplied orderbook.

function isReadOnly

inline boolean isReadOnly()

Return: true if this book is read only.

If this book is read only.

function clear

inline void clear()

Clear all levels from the order book. Clears both the bid and ask side levels from the order book.

function setSymbol

inline void setSymbol(
    String symbol
)

Parameters:

  • symbol the symbol.

The order book subscription symbol.

function getSymbol

inline String getSymbol()

Return: the symbol.

The order book subscription symbol.

function setPartId

inline void setPartId(
    String PartId
)

function getPartId

inline String getPartId()

function hasPartId

inline boolean hasPartId()

function findOrCreateLevel

inline MamdaOrderBookPriceLevel findOrCreateLevel(
    double price,
    char side
)

Parameters:

  • price The price of the price level to find/create.
  • side The side of the book of the price level to find/create.

Exceptions:

Return: The found or newly create price level.

Create a price level in the orderbook for the given price/size. The price level is initially empty and marked as “not used”. The “not used” status changes automatically when entries are added to the price level.

function findLevel

inline MamdaOrderBookPriceLevel findLevel(
    double price,
    char side
)

function getMarketOrdersSide

inline MamdaOrderBookPriceLevel getMarketOrdersSide(
    char side
)

function getOrCreateMarketOrdersSide

inline MamdaOrderBookPriceLevel getOrCreateMarketOrdersSide(
    char side
)

function apply

inline void apply(
    MamdaOrderBook deltaBook
)

Parameters:

  • deltaBook The delta to apply to the order book.

Exceptions:

Apply a delta to this (presumably) full book.

function apply

inline void apply(
    MamdaOrderBookBasicDelta delta
)

Parameters:

  • delta The delta to apply.

Exceptions:

Apply a [MamdaOrderBookBasicDelta](classcom_1_1wombat_1_1mamda_1_1orderbook_1_1MamdaOrderBookBasicDelta.html) to this book.

function apply

inline void apply(
    MamdaBookAtomicLevel level
)

function apply

inline void apply(
    MamdaBookAtomicLevelEntry levelEntry
)

function apply

inline void apply(
    MamdaOrderBookBasicDeltaList deltaList
)

Parameters:

  • deltaList The deltas to apply.

Exceptions:

Apply a [MamdaOrderBookBasicDeltaList](classcom_1_1wombat_1_1mamda_1_1orderbook_1_1MamdaOrderBookBasicDeltaList.html) to this book.

function copy

inline void copy(
    MamdaOrderBook book
)

Parameters:

  • book The order book to copy.

Make a writeable deep copy of a book.

function copyReadOnly

inline void copyReadOnly(
    MamdaOrderBook book
)

Parameters:

  • book The order book to copy.

Make a read only deep copy of a book. This method is faster than the copy (MamdaOrderBook book) method.

function setAsDeltaDeleted

inline void setAsDeltaDeleted(
    MamdaOrderBook bookToDelete
)

Parameters:

  • bookToDelete The book to be deleted.

Exceptions:

Set this order book to be a delta that would, when applied, delete all of the fields in the bookToDelete.

function setAsDeltaDifference

inline void setAsDeltaDifference(
    MamdaOrderBook lhs,
    MamdaOrderBook rhs
)

Parameters:

  • lhs An order book.
  • rhs An order book.

Exceptions:

Set this order book to be a delta that would, when applied, be the difference between to other books.

function getTotalNumLevels

inline long getTotalNumLevels()

Return: The total number of level in the order book.

Get the total number of price levels (both sides of order book).

function getNumBidLevels

inline int getNumBidLevels()

Return: the number of bid levels.

Get the number of bid levels.

function getNumAskLevels

inline int getNumAskLevels()

Return: the number of ask levels.

Get the number of ask levels.

function getBidMarketOrders

inline MamdaOrderBookPriceLevel getBidMarketOrders()

function getAskMarketOrders

inline MamdaOrderBookPriceLevel getAskMarketOrders()

function getBookTime

inline MamaDateTime getBookTime()

Return: return the book time.

Return the book time.

function setBookTime

inline void setBookTime(
    MamaDateTime value
)

Parameters:

  • value The SourceDerivative.

Set The SourceDerivative for this book.

function setSourceDerivative

inline void setSourceDerivative(
    MamaSourceDerivative value
)

Parameters:

  • value The SourceDerivative.

Set The SourceDerivative for this book.

function getSourceDerivative

inline MamaSourceDerivative getSourceDerivative()

Return: the SourceDerivative.

Return the SourceDerivative for this book.

function getSource

inline MamaSource getSource()

Return: The source.

Get the MamaSource for this order book.

function setQuality

inline void setQuality(
    short quality
)

Parameters:

  • quality The new quality.

Set the mamaQuality for this order book.

function getQuality

inline short getQuality()

Return: The quality.

Get the mamaQuality for this order book.

function setClosure

inline void setClosure(
    Object closure
)

Parameters:

  • closure The closure.

Set the order book closure handle.

function getClosure

inline Object getClosure()

Return: The orderbook closure.

Get the order book closure handle.

function hashCode

inline int hashCode()

function equals

inline boolean equals(
    Object obj
)

function addEntry

inline void addEntry(
    MamdaOrderBookEntry entry,
    double price,
    char side,
    MamaDateTime eventTime,
    MamdaOrderBookBasicDelta delta
)

Parameters:

  • entry the entry
  • price the price
  • side the side (bid or ask)
  • eventTime the event time.
  • delta the delta.

Exceptions:

Add an entry to the order book and (if “delta” is not NULL) record information about the delta related to this action.

function addEntry

inline MamdaOrderBookEntry addEntry(
    String entryId,
    long entrySize,
    double price,
    char side,
    MamaDateTime eventTime,
    MamaSourceDerivative source,
    MamdaOrderBookBasicDelta delta
)

Parameters:

  • price the price
  • side the side (bid or ask)
  • eventTime the event time.
  • delta the delta.
  • entryId The id.
  • entrySize the size
  • source the MamaSourceDerivative.

Exceptions:

Return: the new entry.

Add an entry to the order book and (if “delta” is not NULL) record information about the delta related to this action. The new entry is returned.

function addLevel

inline void addLevel(
    MamdaOrderBookPriceLevel level
)

Parameters:

  • level The price level to add to the orderbook.

Add a price level to the orderbook.

function updateLevel

inline void updateLevel(
    MamdaOrderBookPriceLevel level
)

Parameters:

  • level The details of the price level to update.

Exceptions:

Update an existing level in the orderbook.

function populateDelta

inline boolean populateDelta(
    MamaMsg msg
)

Parameters:

  • msg A MamaMsg ref containing all changes to the current book.

Populate a MamaMsg of the changes to this order book. This will include the changes from the last time this function was called or all changes from the initial state.

function populateRecap

inline void populateRecap(
    MamaMsg msg
)

Parameters:

  • msg A MamaMsg containing all book, price and entry (if applicable) details of the current book.

Populate a MamaMsg with the current state of this order book.

function deleteLevel

inline void deleteLevel(
    MamdaOrderBookPriceLevel level
)

Parameters:

  • level The price level to delete from the orderbook.

Exceptions:

Delete a price level from the orderbook.

function reevaluate

inline boolean reevaluate()

Exceptions:

Return: Whether the book info changed based on the re-evaluation.

Re-evaluate the order book. 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.

function setNeedsReevaluation

inline void setNeedsReevaluation(
    boolean need
)

Parameters:

  • need true if books requires re-evaluation.

Set whether this book needs a re-evaluation.

function getNeedsReevaluation

inline boolean getNeedsReevaluation()

Return: true if the book needs re-evaluation.

Get whether this book needs a re-evaluation.

function setCheckSourceState

inline void setCheckSourceState(
    boolean check
)

Parameters:

  • check true to check the MamaSourceState.

Set whether to check the MamaSourceState when adding/deleting/re-evaluating entries in the book.

function getCheckSourceState

inline boolean getCheckSourceState()

Return: true if checking the MamaSourceState

Get whether to check the MamaSourceState when adding/deleting/re-evaluating entries in the book.

function getLevelAtPrice

inline MamdaOrderBookPriceLevel getLevelAtPrice(
    double price,
    char side
)

Parameters:

  • price The price of the order book price level.
  • side The side of the order book to search.

Return: The order book price level or NULL if not found.

Return the order book price level at “price” on “side” of the order book.

function getLevelAtPosition

inline MamdaOrderBookPriceLevel getLevelAtPosition(
    long pos,
    char side
)

Parameters:

  • pos The position of the order book price level.
  • side The side of the order book to search.

Return: The order book price level or NULL if not found.

Return the order book price level at position “pos” in the order book.

function getEntryAtPosition

inline MamdaOrderBookEntry getEntryAtPosition(
    long pos,
    char side
)

Parameters:

  • pos The position of the order book entry.
  • side The side of the order book to search.

Return: The order book entry or NULL if not found.

Return the order book entry at position “pos” in the order book.

function assertEqual

inline void assertEqual(
    MamdaOrderBook rhs
)

Parameters:

  • rhs The order book to compare to the current book.

Exceptions:

Order book equality verification. A MamdaOrderBookException is thrown if the books are not equal, along with the reason for the inequality.

function assertEqual

inline void assertEqual(
    MamdaOrderBookPriceLevel lhsLevel,
    MamdaOrderBookPriceLevel rhsLevel
)

Parameters:

  • lhsLevel Left hand side price level to compare.
  • rhsLevel Right hand side price level to compare.

Exceptions:

Order book level equality verification. A MamdaOrderBookException is thrown if the books are not equal, along with the reason for the inequality.

function setIsConsistent

inline void setIsConsistent(
    boolean isConsistent
)

Parameters:

  • isConsistent Whether the book is consistent.

Set whether the order book is in a consistent or an an inconsistent state.

function getIsConsistent

inline boolean getIsConsistent()

Return: boolean Whether the book is in a consistent state.

Get whether the order book is in a consistent or an an inconsistent state. The orderbook will be marked as inconsistent if a gap is detected by the Listener. The book will be marked consistent again once a full recap for the book has been obtained from the feed.

function dump

inline void dump()

Dump the order book to standard out.

function dump

inline void dump(
    OutputStream outputStream
)

Parameters:

  • outputStream the OutputStream

Dump the order book to an OutputStream.

function updateEntry

inline void updateEntry(
    MamdaOrderBookEntry entry,
    double size,
    MamaDateTime eventTime,
    MamdaOrderBookBasicDelta delta
)

Parameters:

  • entry the entry
  • size the size
  • eventTime the event time
  • delta the delta.

Exceptions:

Update an entry in the order book and (if “delta” is not NULL) record information about the delta related to this action. If the entry is not internally “wired” to the order book, a MamdaOrderBookInvalidEntry exception is thrown.

function deleteEntry

inline void deleteEntry(
    MamdaOrderBookEntry entry,
    MamaDateTime eventTime,
    MamdaOrderBookBasicDelta delta
)

Parameters:

  • entry the entry to detete.
  • eventTime the event time.
  • delta the delta

Exceptions:

Delete an entry in the order book and (if “delta” is not NULL) record information about the delta related to this action. If the entry is not internally “wired” to the order book, a MamdaOrderBookInvalidEntry exception is thrown.

function addEntriesFromBook

inline void addEntriesFromBook(
    MamdaOrderBook book,
    MamdaOrderBookEntryFilter filter,
    MamdaOrderBookBasicDeltaList delta
)

Parameters:

  • 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.

Exceptions:

Add all entries from another book into this book.

function addPriceLevelsFromBookAsEntries

inline void addPriceLevelsFromBookAsEntries(
    MamdaOrderBook book,
    String source,
    MamdaOrderBookBasicDeltaList delta
)

Parameters:

  • book The source book to add.
  • source The name to use as the entry ID.
  • delta An optional delta to collect the added entries.

Exceptions:

Add all price levels from another book as entries (one per price level) into this book using “source” as the entryId for each entry.

function deleteEntriesFromSource

inline void deleteEntriesFromSource(
    MamaSource source,
    MamdaOrderBookBasicDeltaList delta
)

Parameters:

  • source The source to match.
  • delta An optional delta to collect the deleted entries.

Exceptions:

Delete all entries in this book that have “source” as its MamaSource.

function generateDeltaMsgs

inline void generateDeltaMsgs(
    boolean publish
)

Parameters:

  • publish Whether book delta generation is enabled.

Enable the generation of book deltas for this book. When delta generation is enabled changes to the book are saved and can be popultaed to MamaMsgs.

function getGenerateDeltaMsgs

inline boolean getGenerateDeltaMsgs()

Return: Whether book delta generation is enabled.

Get whether book delta generation is enabled

function clearDeltaList

inline void clearDeltaList()

clear the delta list using for storing generated deltas

function addDelta

inline void addDelta(
    MamdaOrderBookEntry entry,
    MamdaOrderBookPriceLevel level,
    double plDeltaSize,
    char plAction,
    char entryAction
)

Parameters:

For book delta generation. Add a delta to the order book delta list for the publishing of order book data

function detach

inline void detach(
    MamdaOrderBookEntry entry
)

Parameters:

  • entry the entry to detach.

NOOP FOR JAVA Adds the entry to the list of entries to be detached.

function detach

inline void detach(
    MamdaOrderBookPriceLevel level
)

Parameters:

  • level the level to detach.

Exceptions:

Detach a price level.

function bidEntryIterator

inline Iterator bidEntryIterator()

Return: the iterator.

Iterator for all the bid side entries in the book.

function bidIterator

inline Iterator bidIterator()

Return: Iterator java.util.Iterator for the bid side price levels in the order book.

Allows an application to iterate over all the bid side price levels in the order book.

function askIterator

inline Iterator askIterator()

Return: Iterator java.util.Iterator for the ask side price levels in the order book.

Allows an application to iterate over all ask side price levels in the order book.

function askEntryIterator

inline Iterator askEntryIterator()

Return: the iterator.

Iterator for all the ask side entries in the book.

function cleanupDetached

inline void cleanupDetached()

function setStrictChecking

static inline void setStrictChecking(
    boolean strict
)

Parameters:

  • strict the value for strict checking.

Enforce strict checking of order book modifications (at the expense of some performance). This setting is passed on to the MamdaOrderBookPriceLevel and MamdaOrderBookEntry classes.


Updated on 2023-03-31 at 15:30:38 +0100