Record Class TickerSnapshot

java.lang.Object
java.lang.Record
com.wualabs.qtsurfer.engine.core.TickerSnapshot
All Implemented Interfaces:
MarketSnapshot

public record TickerSnapshot(Instrument instrument, double bid, double bidSize, double ask, double askSize, double open, double high, double low, double close, double vwap, double volume, double quoteVolume, double percentageChange, long timestamp) extends Record implements MarketSnapshot
Primitive-double view of a Ticker. Created once per incoming tick, shared across all indicators for that instrument, exposing OHLCV plus order-book and trade-stats data through the sealed MarketSnapshot contract.

Null BigDecimal fields map to Double.NaN.

volume, high, low and open are 24-hour rolling exchange statistics, not this tick's bar. They are whatever the exchange reports as the rolling window's totals, so they barely move from tick to tick and repeat the same figure indefinitely. Only close (the last trade), bid/ask and the order-book sizes are instantaneous.

This matters because a RichRTIndicator<MarketSnapshot> written for bar data — OBV, ATR, MFI, VWAP, … — accepts one of these without complaint and produces a plausible-looking, meaningless series from the 24h aggregates. Indicators that need real bars declare requiresBarData(), and the ticker dispatcher raises a retrievable notice when one is bound here . The path that carries true per-bar OHLCV is KlineSnapshot, driven by AbstractKlineStrategy.

  • Constructor Summary

    Constructors
    Constructor
    Description
    TickerSnapshot(Instrument instrument, double bid, double bidSize, double ask, double askSize, double open, double high, double low, double close, double vwap, double volume, double quoteVolume, double percentageChange, long timestamp)
    Creates an instance of a TickerSnapshot record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    ask()
    Returns the value of the ask record component.
    double
    Returns the value of the askSize record component.
    double
    bid()
    Returns the value of the bid record component.
    double
    Returns the value of the bidSize record component.
    double
    Returns the value of the close record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the high record component.
    Returns the value of the instrument record component.
    double
    low()
    Returns the value of the low record component.
    Primitive view of the engine-owned canonical Ticker.
    double
    Returns the value of the open record component.
    double
    Returns the value of the percentageChange record component.
    double
    Returns the value of the quoteVolume record component.
    long
    Returns the value of the timestamp record component.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the volume record component.
    double
    Returns the value of the vwap record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TickerSnapshot

      public TickerSnapshot(Instrument instrument, double bid, double bidSize, double ask, double askSize, double open, double high, double low, double close, double vwap, double volume, double quoteVolume, double percentageChange, long timestamp)
      Creates an instance of a TickerSnapshot record class.
      Parameters:
      instrument - the value for the instrument record component
      bid - the value for the bid record component
      bidSize - the value for the bidSize record component
      ask - the value for the ask record component
      askSize - the value for the askSize record component
      open - the value for the open record component
      high - the value for the high record component
      low - the value for the low record component
      close - the value for the close record component
      vwap - the value for the vwap record component
      volume - the value for the volume record component
      quoteVolume - the value for the quoteVolume record component
      percentageChange - the value for the percentageChange record component
      timestamp - the value for the timestamp record component
  • Method Details

    • of

      public static TickerSnapshot of(Ticker t)
      Primitive view of the engine-owned canonical Ticker.
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • instrument

      public Instrument instrument()
      Returns the value of the instrument record component.
      Specified by:
      instrument in interface MarketSnapshot
      Returns:
      the value of the instrument record component
    • bid

      public double bid()
      Returns the value of the bid record component.
      Returns:
      the value of the bid record component
    • bidSize

      public double bidSize()
      Returns the value of the bidSize record component.
      Returns:
      the value of the bidSize record component
    • ask

      public double ask()
      Returns the value of the ask record component.
      Returns:
      the value of the ask record component
    • askSize

      public double askSize()
      Returns the value of the askSize record component.
      Returns:
      the value of the askSize record component
    • open

      public double open()
      Returns the value of the open record component.
      Specified by:
      open in interface MarketSnapshot
      Returns:
      the value of the open record component
    • high

      public double high()
      Returns the value of the high record component.
      Specified by:
      high in interface MarketSnapshot
      Returns:
      the value of the high record component
    • low

      public double low()
      Returns the value of the low record component.
      Specified by:
      low in interface MarketSnapshot
      Returns:
      the value of the low record component
    • close

      public double close()
      Returns the value of the close record component.
      Specified by:
      close in interface MarketSnapshot
      Returns:
      the value of the close record component
    • vwap

      public double vwap()
      Returns the value of the vwap record component.
      Returns:
      the value of the vwap record component
    • volume

      public double volume()
      Returns the value of the volume record component.
      Specified by:
      volume in interface MarketSnapshot
      Returns:
      the value of the volume record component
    • quoteVolume

      public double quoteVolume()
      Returns the value of the quoteVolume record component.
      Specified by:
      quoteVolume in interface MarketSnapshot
      Returns:
      the value of the quoteVolume record component
    • percentageChange

      public double percentageChange()
      Returns the value of the percentageChange record component.
      Returns:
      the value of the percentageChange record component
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface MarketSnapshot
      Returns:
      the value of the timestamp record component