Classes Files

Wombat::MamdaOrderBook

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

Public Functions

  Name
  MamdaOrderBook()
Construct a new order book object. Contains no price levels upon construction.
void clear()
Clear all levels from the order book. Clears both the bid and ask side levels from the order book.
void setSymbol(string symbol)
String getSymbol()
void setBookTime(DateTime time)
DateTime getBookTime()
void addLevel(MamdaOrderBookPriceLevel level)
Add a price level to the order book.
void updateLevel(MamdaOrderBookPriceLevel level)
Update an existing level in the order book.
void deleteLevel(MamdaOrderBookPriceLevel level)
Delete an existing price level from the book.
void apply(MamdaOrderBook deltaBook)
Apply a delta to this (presumably) full book.
void copy(MamdaOrderBook book)
Make a shallow copy of a book.
void deepCopy(MamdaOrderBook book)
Make a deep copy of a 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.
long getTotalNumLevels()
Get the total number of price levels (both sides of order book).
void assertEqual(MamdaOrderBook rhs)
Order book equality verification. A MamdaOrderBookException is thrown if the books are not equal, along with the reason for the inequality.
IEnumerable getBidLevels()
Allows an application to iterate over all the bid side price levels in the order book.
IEnumerable getAskLevels()
Allows an application to iterate over all the ask side price levels in the order book.
void setIsConsistent(bool isConsistent)
Set whether the order book is in a consistent or an an inconsistent state.
bool getIsConsistent()
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.
void dump()
Dump the order book to standard output.
void dump(Stream stream)
Dumps the order book to the specified stream
void dump(TextWriter writer)
Dumps the order book using the specified TextWriter instance
void setStrictChecking(bool strict)
Enforce strict checking of order book modifications (at the expense of some performance). This setting is passed on to the MamdaOrderBookPriceLevel and MamdaOrderBookEntry classes.

Public Functions Documentation

function MamdaOrderBook

MamdaOrderBook()

Construct a new order book object. Contains no price levels upon construction.

function clear

void clear()

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

function setSymbol

void setSymbol(
    string symbol
)

Parameters:

  • symbol The order book subscription symbol.

function getSymbol

String getSymbol()

Return: The order book subscription symbol.

function setBookTime

void setBookTime(
    DateTime time
)

Parameters:

  • time The order book update time.

function getBookTime

DateTime getBookTime()

Return: The order book subscription symbol.

function addLevel

void addLevel(
    MamdaOrderBookPriceLevel level
)

Add a price level to the order book.

Parameters:

  • level The price level to add to the book.

function updateLevel

void updateLevel(
    MamdaOrderBookPriceLevel level
)

Update an existing level in the order book.

Parameters:

  • level The price level to update.

function deleteLevel

void deleteLevel(
    MamdaOrderBookPriceLevel level
)

Delete an existing price level from the book.

Parameters:

  • level The price level in the book to delete.

function apply

void apply(
    MamdaOrderBook deltaBook
)

Apply a delta to this (presumably) full book.

Parameters:

  • deltaBook The delta to apply to the order book.

function copy

void copy(
    MamdaOrderBook book
)

Make a shallow copy of a book.

Parameters:

  • book The order book to copy.

function deepCopy

void deepCopy(
    MamdaOrderBook book
)

Make a deep copy of a book.

Parameters:

  • book The order book to copy.

function setAsDeltaDeleted

void setAsDeltaDeleted(
    MamdaOrderBook bookToDelete
)

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

Parameters:

  • bookToDelete The book to be deleted.

function setAsDeltaDifference

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.

Parameters:

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

function getTotalNumLevels

long getTotalNumLevels()

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

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

function assertEqual

void assertEqual(
    MamdaOrderBook rhs
)

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

Parameters:

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

Exceptions:

function getBidLevels

IEnumerable getBidLevels()

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

Return: IEnumerable for the bid side price levels in the order book - the elements are of type MamdaOrderBookPriceLevel

function getAskLevels

IEnumerable getAskLevels()

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

Return: IEnumerable for the ask side price levels in the order book - the elements are of type MamdaOrderBookPriceLevel

function setIsConsistent

void setIsConsistent(
    bool isConsistent
)

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

Parameters:

  • isConsistent Whether the book is consistent.

function getIsConsistent

bool getIsConsistent()

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.

Return: Whether the book is in a consistent state.

function dump

void dump()

Dump the order book to standard output.

function dump

void dump(
    Stream stream
)

Dumps the order book to the specified stream

Parameters:

  • stream The stream on which the order book will be dumped

function dump

void dump(
    TextWriter writer
)

Dumps the order book using the specified TextWriter instance

Parameters:

  • writer

function setStrictChecking

static void setStrictChecking(
    bool strict
)

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

Parameters:

  • strict

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