Package org.knowm.xchange.dto.marketdata
Class OrderBook
java.lang.Object
org.knowm.xchange.dto.marketdata.OrderBook
- All Implemented Interfaces:
Serializable
public final class OrderBook extends Object implements Serializable
DTO representing the exchange order book
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description OrderBook(Date timeStamp, List<LimitOrder> asks, List<LimitOrder> bids)
ConstructorOrderBook(Date timeStamp, List<LimitOrder> asks, List<LimitOrder> bids, boolean sort)
ConstructorOrderBook(Date timeStamp, Stream<LimitOrder> asks, Stream<LimitOrder> bids)
ConstructorOrderBook(Date timeStamp, Stream<LimitOrder> asks, Stream<LimitOrder> bids, boolean sort)
Constructor -
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
List<LimitOrder>
getAsks()
List<LimitOrder>
getBids()
List<LimitOrder>
getOrders(Order.OrderType type)
Date
getTimeStamp()
int
hashCode()
boolean
ordersEqual(OrderBook ob)
Identical toequals
method except that this ignores different timestamps.String
toString()
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.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.
-
Constructor Details
-
OrderBook
Constructor- Parameters:
timeStamp
- - the timestamp of the orderbook according to the exchange's server, null if not providedasks
- The ASK ordersbids
- The BID orders
-
OrderBook
Constructor- Parameters:
timeStamp
- - the timestamp of the orderbook according to the exchange's server, null if not providedasks
- The ASK ordersbids
- The BID orderssort
- True if the asks and bids need to be sorted
-
OrderBook
Constructor- Parameters:
timeStamp
- - the timestamp of the orderbook according to the exchange's server, null if not providedasks
- The ASK ordersbids
- The BID orders
-
OrderBook
Constructor- Parameters:
timeStamp
- - the timestamp of the orderbook according to the exchange's server, null if not providedasks
- The ASK ordersbids
- The BID orderssort
- True if the asks and bids need to be sorted
-
-
Method Details
-
getTimeStamp
-
getAsks
-
getBids
-
getOrders
-
update
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
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() -
equals
-
ordersEqual
Identical toequals
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:
-
toString
-