Skip to main content

OrderBook

Package: velox.api.layer1.layers.utils

Type: Class

Inheritance: java.lang.Object → OrderBook

Fields​

NONE​

public static final int NONE

bidMap​

protected TreeMap<Integer, Long> bidMap

askMap​

protected TreeMap<Integer, Long> askMap

Constructors​

OrderBook​

public OrderBook()

OrderBook​

public OrderBook(OrderBook orderBook)

Methods​

onUpdate​

public void onUpdate(boolean isBid, int price, long size)

onUpdate​

public void onUpdate(DepthAggregationEvent depthAggregationEvent)

updateMap​

protected void updateMap(TreeMap<Integer, Long> updatedMap, int price, long size)

getBestBidPriceOrNone​

public int getBestBidPriceOrNone()

getBestAskPriceOrNone​

public int getBestAskPriceOrNone()

getMidPriceOrNan​

public double getMidPriceOrNan()

getFirstKeyOrNone​

public int getFirstKeyOrNone(TreeMap<Integer, Long> map)

getFirstValueOrNone​

public long getFirstValueOrNone(TreeMap<Integer, Long> map)

levels​

public Integer[] levels(boolean isBid)

getWorstBidPriceOrNone​

public int getWorstBidPriceOrNone()

getWorstAskPriceOrNone​

public int getWorstAskPriceOrNone()

getLastKeyOrNone​

public int getLastKeyOrNone(TreeMap<Integer, Long> map)

levels​

public Map<Integer, Long> levels(boolean isBid, int from, int to)

levels​

public Map<Integer, Long> levels(boolean isBid, int from, boolean fromInclusive, int to, boolean toInclusive)

getSizeFor​

public long getSizeFor(boolean isBid, int price)

getSizeFor​

public long getSizeFor(boolean isBid, int price, long defaultSize)

clear​

public void clear()

getBidMap​

public TreeMap<Integer, Long> getBidMap()

Beware: changing this map will break order book

getAskMap​

public TreeMap<Integer, Long> getAskMap()

Beware: changing this map will break order book

isEmpty​

public boolean isEmpty()

Check if order book is empty

Returns: true if both sides of the book are empty, false otherwise

toString​

public String toString()

Overrides: toString in class Object