Class OrderBook

java.lang.Object
velox.api.layer1.layers.utils.OrderBook

public class OrderBook
extends java.lang.Object
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.TreeMap<java.lang.Integer,​java.lang.Long> askMap  
    protected java.util.TreeMap<java.lang.Integer,​java.lang.Long> bidMap  
    static int NONE  
  • Constructor Summary

    Constructors 
    Constructor Description
    OrderBook()  
    OrderBook​(OrderBook orderBook)  
  • Method Summary

    Modifier and Type Method Description
    void clear()  
    java.util.TreeMap<java.lang.Integer,​java.lang.Long> getAskMap()
    Beware: changing this map will break order book
    int getBestAskPriceOrNone()  
    int getBestBidPriceOrNone()  
    java.util.TreeMap<java.lang.Integer,​java.lang.Long> getBidMap()
    Beware: changing this map will break order book
    int getFirstKeyOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)  
    long getFirstValueOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)  
    int getLastKeyOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)  
    double getMidPriceOrNan()  
    long getSizeFor​(boolean isBid, int price)  
    long getSizeFor​(boolean isBid, int price, long defaultSize)  
    int getWorstAskPriceOrNone()  
    int getWorstBidPriceOrNone()  
    boolean isEmpty()
    Check if order book is empty
    java.lang.Integer[] levels​(boolean isBid)  
    java.util.Map<java.lang.Integer,​java.lang.Long> levels​(boolean isBid, int from, boolean fromInclusive, int to, boolean toInclusive)  
    java.util.Map<java.lang.Integer,​java.lang.Long> levels​(boolean isBid, int from, int to)  
    void onUpdate​(boolean isBid, int price, long size)  
    void onUpdate​(DepthAggregationEvent depthAggregationEvent)  
    java.lang.String toString()  
    protected void updateMap​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> updatedMap, int price, long size)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • NONE

      public static final int NONE
      See Also:
      Constant Field Values
    • bidMap

      protected java.util.TreeMap<java.lang.Integer,​java.lang.Long> bidMap
    • askMap

      protected java.util.TreeMap<java.lang.Integer,​java.lang.Long> askMap
  • Constructor Details

  • Method Details

    • onUpdate

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

      public void onUpdate​(DepthAggregationEvent depthAggregationEvent)
    • updateMap

      protected void updateMap​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> updatedMap, int price, long size)
    • getBestBidPriceOrNone

      public int getBestBidPriceOrNone()
    • getBestAskPriceOrNone

      public int getBestAskPriceOrNone()
    • getMidPriceOrNan

      public double getMidPriceOrNan()
    • getFirstKeyOrNone

      public int getFirstKeyOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)
    • getFirstValueOrNone

      public long getFirstValueOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)
    • levels

      public java.lang.Integer[] levels​(boolean isBid)
    • getWorstBidPriceOrNone

      public int getWorstBidPriceOrNone()
    • getWorstAskPriceOrNone

      public int getWorstAskPriceOrNone()
    • getLastKeyOrNone

      public int getLastKeyOrNone​(java.util.TreeMap<java.lang.Integer,​java.lang.Long> map)
    • levels

      public java.util.Map<java.lang.Integer,​java.lang.Long> levels​(boolean isBid, int from, int to)
    • levels

      public java.util.Map<java.lang.Integer,​java.lang.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 java.util.TreeMap<java.lang.Integer,​java.lang.Long> getBidMap()
      Beware: changing this map will break order book
    • getAskMap

      public java.util.TreeMap<java.lang.Integer,​java.lang.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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object