Class TickerRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, CacheableRTIndicator, RichRTIndicator<MarketSnapshot>, RTIndicator
Direct Known Subclasses:
CompoundTickerRTIndicator

Indicator that extracts a scalar value from a MarketSnapshot via a configurable MarketSnapshotValueSource. Snapshot-agnostic: works on both the ticker and the kline path. Extraction routes by source kind to the matching switch-based extractor (TickerSnapshots for TickerValueSource, KlineSnapshots for KlineValueSource); a source field absent on the incoming snapshot resolves to Double.NaN and the update is skipped. Supports backtest mode where the snapshot's timestamp is used to set a fixed clock for time-aware child indicators.
  • Constructor Details

  • Method Details

    • backtestEnabled

      public TickerRTIndicator backtestEnabled(boolean backtestEnabled)
    • signature

      public String signature()
      Which snapshot field is extracted, the decorated chain below it, and whether backtest mode is on .

      The highest-value identity in the base catalog, because AbstractTickerStrategy registers four of these by default — so without it every ticker strategy starts with four indicators that cannot be memoized before its author declares anything.

      backtestEnabled is part of the identity and not an execution detail: it decides whether a fixed clock built from the snapshot's own timestamp is installed on time-aware children, so the same source and the same chain produce different series with it on and off.

      The source is qualified by its enum type, not just its name. MarketSnapshotValueSource is a sealed interface over two independent enums that share six constant names — Open, High, Low, Close, Volume, VolumeQuote — and updateFrom(MarketSnapshot) routes each to a different extractor. They happen to read the same fields today, but they are free to diverge (only TickerValueSource has the AutoAskClose fallback, only KlineValueSource has NumberOfTrades), and an unqualified "Close" would share one series between two extractions the moment they do.

      Specified by:
      signature in interface CacheableRTIndicator
      Returns:
      the identity, or null when this instance cannot state one (an unidentifiable source, a mode the implementation does not model) and must therefore compute live
    • updateFrom

      public double updateFrom(@NonNull @NonNull MarketSnapshot snap)
      Description copied from interface: RichRTIndicator
      Updates the indicator from a full market snapshot. Returns the new value so callers can chain (matching RTIndicator.update(double)'s contract).
      Specified by:
      updateFrom in interface RichRTIndicator<MarketSnapshot>
    • isBacktestEnabled

      public boolean isBacktestEnabled()