Class OrderBook

    • Constructor Detail

      • OrderBook

        public OrderBook​(Date timeStamp,
                         List<LimitOrder> asks,
                         List<LimitOrder> bids)
        Constructor
        Parameters:
        timeStamp - - the timestamp of the orderbook according to the exchange's server, null if not provided
        asks - The ASK orders
        bids - The BID orders
      • OrderBook

        public OrderBook​(Date timeStamp,
                         List<LimitOrder> asks,
                         List<LimitOrder> bids,
                         boolean sort)
        Constructor
        Parameters:
        timeStamp - - the timestamp of the orderbook according to the exchange's server, null if not provided
        asks - The ASK orders
        bids - The BID orders
        sort - True if the asks and bids need to be sorted
      • OrderBook

        public OrderBook​(Date timeStamp,
                         Stream<LimitOrder> asks,
                         Stream<LimitOrder> bids)
        Constructor
        Parameters:
        timeStamp - - the timestamp of the orderbook according to the exchange's server, null if not provided
        asks - The ASK orders
        bids - The BID orders
      • OrderBook

        public OrderBook​(Date timeStamp,
                         Stream<LimitOrder> asks,
                         Stream<LimitOrder> bids,
                         boolean sort)
        Constructor
        Parameters:
        timeStamp - - the timestamp of the orderbook according to the exchange's server, null if not provided
        asks - The ASK orders
        bids - The BID orders
        sort - True if the asks and bids need to be sorted
    • Method Detail

      • getTimeStamp

        public Date getTimeStamp()
      • update

        public void update​(LimitOrder limitOrder)
        Given a new LimitOrder, it will replace a matching limit order in the orderbook if one is found, or add the new LimitOrder if one is not. timeStamp will be updated if the new timestamp is non-null and in the future.
        Parameters:
        limitOrder - the new LimitOrder
      • update

        public void update​(OrderBookUpdate orderBookUpdate)
        Given an OrderBookUpdate, it will replace a matching limit order in the orderbook if one is found, or add a new if one is not. timeStamp will be updated if the new timestamp is non-null and in the future.
        Parameters:
        orderBookUpdate - the new OrderBookUpdate
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • ordersEqual

        public boolean ordersEqual​(OrderBook ob)
        Identical to equals method except that this ignores different timestamps. In other words, this version of equals returns true if the order internal to the OrderBooks are equal but their timestamps are unequal. It returns false if any order between the two are different.
        Parameters:
        ob -
        Returns: