Record Class OrderBook.OrderBookSnapshot
java.lang.Object
java.lang.Record
eds.model.OrderBook.OrderBookSnapshot
- Record Components:
bids- aggregated bid price levelsasks- aggregated ask price levelsbestBid- best bid price if presentbestAsk- best ask price if presentmidPrice- midpoint between best bid and best askspread- difference between best ask and best bid
- Enclosing class:
OrderBook
public static record OrderBook.OrderBookSnapshot(List<OrderBook.PriceLevel> bids, List<OrderBook.PriceLevel> asks, OptionalDouble bestBid, OptionalDouble bestAsk, OptionalDouble midPrice, OptionalDouble spread)
extends Record
Immutable snapshot of the entire order book state.
This object is safe to expose to external components such as the UI or statistics collectors because it contains no mutable references to internal data structures.
-
Constructor Summary
ConstructorsConstructorDescriptionOrderBookSnapshot(List<OrderBook.PriceLevel> bids, List<OrderBook.PriceLevel> asks, OptionalDouble bestBid, OptionalDouble bestAsk, OptionalDouble midPrice, OptionalDouble spread) Creates an instance of aOrderBookSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionasks()Returns the value of theasksrecord component.bestAsk()Returns the value of thebestAskrecord component.bestBid()Returns the value of thebestBidrecord component.bids()Returns the value of thebidsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.midPrice()Returns the value of themidPricerecord component.spread()Returns the value of thespreadrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OrderBookSnapshot
public OrderBookSnapshot(List<OrderBook.PriceLevel> bids, List<OrderBook.PriceLevel> asks, OptionalDouble bestBid, OptionalDouble bestAsk, OptionalDouble midPrice, OptionalDouble spread) Creates an instance of aOrderBookSnapshotrecord class.- Parameters:
bids- the value for thebidsrecord componentasks- the value for theasksrecord componentbestBid- the value for thebestBidrecord componentbestAsk- the value for thebestAskrecord componentmidPrice- the value for themidPricerecord componentspread- the value for thespreadrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
bids
-
asks
-
bestBid
-
bestAsk
-
midPrice
-
spread
-