Record Class OrderBook.OrderBookSnapshot

java.lang.Object
java.lang.Record
eds.model.OrderBook.OrderBookSnapshot
Record Components:
bids - aggregated bid price levels
asks - aggregated ask price levels
bestBid - best bid price if present
bestAsk - best ask price if present
midPrice - midpoint between best bid and best ask
spread - 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 Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • bids

      public List<OrderBook.PriceLevel> bids()
      Returns the value of the bids record component.
      Returns:
      the value of the bids record component
    • asks

      public List<OrderBook.PriceLevel> asks()
      Returns the value of the asks record component.
      Returns:
      the value of the asks record component
    • bestBid

      public OptionalDouble bestBid()
      Returns the value of the bestBid record component.
      Returns:
      the value of the bestBid record component
    • bestAsk

      public OptionalDouble bestAsk()
      Returns the value of the bestAsk record component.
      Returns:
      the value of the bestAsk record component
    • midPrice

      public OptionalDouble midPrice()
      Returns the value of the midPrice record component.
      Returns:
      the value of the midPrice record component
    • spread

      public OptionalDouble spread()
      Returns the value of the spread record component.
      Returns:
      the value of the spread record component