Record Class CryptoOrderbook

java.lang.Object
java.lang.Record
markets.alpaca.client.ws.model.CryptoOrderbook
Record Components:
symbol - crypto pair symbol (e.g. "BTC/USD")
timestamp - RFC-3339 timestamp with nanosecond precision
bids - bid price levels
asks - ask price levels
reset - true for a full snapshot, false for an incremental update

public record CryptoOrderbook(String symbol, String timestamp, List<CryptoOrderbookLevel> bids, List<CryptoOrderbookLevel> asks, boolean reset) extends Record
A full or incremental order book snapshot for a crypto pair (T: "o").

When reset is true this is a full order-book snapshot (all levels). When false only the changed levels are included and should be merged into the locally maintained book.

  • Constructor Details

    • CryptoOrderbook

      public CryptoOrderbook(String symbol, String timestamp, List<CryptoOrderbookLevel> bids, List<CryptoOrderbookLevel> asks, boolean reset)
      Creates an instance of a CryptoOrderbook record class.
      Parameters:
      symbol - the value for the symbol record component
      timestamp - the value for the timestamp record component
      bids - the value for the bids record component
      asks - the value for the asks record component
      reset - the value for the reset record component
  • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • symbol

      @SerializedName("S") public String symbol()
      Returns the value of the symbol record component.
      Returns:
      the value of the symbol record component
    • timestamp

      @SerializedName("t") public String timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • bids

      @SerializedName("b") public List<CryptoOrderbookLevel> bids()
      Returns the value of the bids record component.
      Returns:
      the value of the bids record component
    • asks

      @SerializedName("a") public List<CryptoOrderbookLevel> asks()
      Returns the value of the asks record component.
      Returns:
      the value of the asks record component
    • reset

      @SerializedName("r") public boolean reset()
      Returns the value of the reset record component.
      Returns:
      the value of the reset record component