Record Class KlineSnapshot

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

public record KlineSnapshot(Instrument instrument, KlineInterval interval, long openTime, double open, double high, double low, double close, double volume, double quoteVolume, long closeTime, long numberOfTrades, boolean closed) extends Record implements MarketSnapshot
Primitive-double view of a Kline. timestamp() returns the bar's close time so indicators consuming snapshots see a uniform "as-of" timeline regardless of whether the source is a tick stream or a kline stream.

Null BigDecimal fields on the source map to Double.NaN.

  • Constructor Summary

    Constructors
    Constructor
    Description
    KlineSnapshot(Instrument instrument, KlineInterval interval, long openTime, double open, double high, double low, double close, double volume, double quoteVolume, long closeTime, long numberOfTrades, boolean closed)
    Creates an instance of a KlineSnapshot record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the close record component.
    boolean
    Returns the value of the closed record component.
    long
    Returns the value of the closeTime 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.
    Returns the value of the interval record component.
    double
    low()
    Returns the value of the low record component.
    long
    Returns the value of the numberOfTrades record component.
    of(Kline k)
     
    double
    Returns the value of the open record component.
    long
    Returns the value of the openTime record component.
    double
    Returns the value of the quoteVolume record component.
    long
    Observation timestamp, epoch milliseconds.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the volume record component.

    Methods inherited from class Object

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

    • KlineSnapshot

      public KlineSnapshot(Instrument instrument, KlineInterval interval, long openTime, double open, double high, double low, double close, double volume, double quoteVolume, long closeTime, long numberOfTrades, boolean closed)
      Creates an instance of a KlineSnapshot record class.
      Parameters:
      instrument - the value for the instrument record component
      interval - the value for the interval record component
      openTime - the value for the openTime 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
      volume - the value for the volume record component
      quoteVolume - the value for the quoteVolume record component
      closeTime - the value for the closeTime record component
      numberOfTrades - the value for the numberOfTrades record component
      closed - the value for the closed record component
  • Method Details

    • timestamp

      public long timestamp()
      Description copied from interface: MarketSnapshot
      Observation timestamp, epoch milliseconds.

      The backend NATS/QuestDB pipeline uses microseconds; the engine has historically operated in milliseconds (XChange Ticker, Kline, signals). Cross-pipeline integration with micro-resolution data is a separate refactor — a timestampMicros() method can be added additively without breaking existing snapshots.

      Specified by:
      timestamp in interface MarketSnapshot
    • of

      public static KlineSnapshot of(Kline k)
    • 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
    • interval

      public KlineInterval interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component
    • openTime

      public long openTime()
      Returns the value of the openTime record component.
      Returns:
      the value of the openTime 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
    • 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
    • closeTime

      public long closeTime()
      Returns the value of the closeTime record component.
      Returns:
      the value of the closeTime record component
    • numberOfTrades

      public long numberOfTrades()
      Returns the value of the numberOfTrades record component.
      Returns:
      the value of the numberOfTrades record component
    • closed

      public boolean closed()
      Returns the value of the closed record component.
      Returns:
      the value of the closed record component