Record Class Layer1ApiDynamicHistoryListener.BlockContext

java.lang.Object
java.lang.Record
velox.api.layer1.dynamichistory.Layer1ApiDynamicHistoryListener.BlockContext
Record Components:
timeFrom - start of the block's window, in nanoseconds (exclusive), in chart time
timeTo - end of the block's window, in nanoseconds (inclusive), in chart time - the window is (timeFrom, timeTo], see DynamicHistoryEvent
dataDelayNs - the shift Bookmap applied to the window, in nanoseconds; 0 when the instrument is not delayed or its delay is unknown
Enclosing interface:
Layer1ApiDynamicHistoryListener

public static record Layer1ApiDynamicHistoryListener.BlockContext(long timeFrom, long timeTo, long dataDelayNs) extends Record
Where one historical block sits on the chart's time axis, as handed to the conversion methods.

Bookmap shows a delayed instrument's data shifted forward by its delay (InstrumentInfo.dataDelay), while the history server stores it in the time it happened. The window below is already shifted into the time the chart shows (the same time DynamicHistoryAccessInterface.get(long, long, int, com.bookmap.api.treestructure.DataSource, velox.api.layer1.data.InstrumentInfo, java.util.List<com.bookmap.api.treestructure.TreeId>, velox.api.layer1.dynamichistory.DynamicHistoryAccessInterface.AsyncResultConsumer) is called with), so an event built with these bounds lines up with live data. What Bookmap cannot shift is the content of the aggregation itself: if the aggregation carries absolute timestamps of its own (a candle's publish time, say), add dataDelayNs to them.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockContext(long timeFrom, long timeTo, long dataDelayNs)
    Creates an instance of a BlockContext record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the dataDelayNs record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the timeFrom record component.
    long
    Returns the value of the timeTo record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • BlockContext

      public BlockContext(long timeFrom, long timeTo, long dataDelayNs)
      Creates an instance of a BlockContext record class.
      Parameters:
      timeFrom - the value for the timeFrom record component
      timeTo - the value for the timeTo record component
      dataDelayNs - the value for the dataDelayNs 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. All components in this record class 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.
    • timeFrom

      public long timeFrom()
      Returns the value of the timeFrom record component.
      Returns:
      the value of the timeFrom record component
    • timeTo

      public long timeTo()
      Returns the value of the timeTo record component.
      Returns:
      the value of the timeTo record component
    • dataDelayNs

      public long dataDelayNs()
      Returns the value of the dataDelayNs record component.
      Returns:
      the value of the dataDelayNs record component