Class InstrumentMapKlineSourceRTIndicator
- All Implemented Interfaces:
Backtestable, ClockAware, Resettable, RTIndicator, RTIndicatorSource<Kline>
InstrumentMapTickerSourceRTIndicator. Builds a KlineSnapshot once per bar and
dispatches it to every registered indicator.
RichRTIndicator indicators must be bound to KlineSnapshot or to the
MarketSnapshot supertype — which covers every shipped indicator: the OHLCV pro indicators
and the scalar wrapper (TickerRTIndicator) are all MarketSnapshot-bound. A
hand-written RichRTIndicator<TickerSnapshot> would throw ClassCastException here
(klines carry no order-book data), but none ship. The scalar fallback uses a KlineValueSource
via KlineSnapshots; a NumberOfTrades source on a non-kline snapshot resolves to
Double.NaN and is skipped.
-
Nested Class Summary
Nested classes/interfaces inherited from class InstrumentMapRTIndicator
InstrumentMapRTIndicator.IndicatorNotFoundException -
Field Summary
Fields inherited from class InstrumentMapRTIndicator
PRIVATE_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentMapKlineSourceRTIndicator(@NonNull Instrument instrument, @NonNull KlineValueSource valueSource) InstrumentMapKlineSourceRTIndicator(Instrument instrument) -
Method Summary
Modifier and TypeMethodDescriptionbacktestEnabled(boolean backtestEnabled) protected StringWhich field of the incoming data this map extracts for scalar indicators, as a stable string.booleaninthashCode()booleanvoidsetBacktestEnabled(boolean backtestEnabled) voidupdateFrom(Kline source) Propagates a kline update to all registered indicators and to this map itself.Methods inherited from class InstrumentMapRTIndicator
add, clear, forEachPublicable, get, getCacheContext, getExisting, getInstrument, getNotices, getRaw, getReadOnly, getReadOnlyExisting, getValue, indicators, namedIndicators, raiseNotice, remove, reset, setClockSupplier, size, toStringMethods inherited from class AbstractRTIndicator
getDisplayHint, getMeta, getValue, hide, isPoison, setValue, toString, update, withDisplayHint, withMeta
-
Constructor Details
-
InstrumentMapKlineSourceRTIndicator
-
InstrumentMapKlineSourceRTIndicator
public InstrumentMapKlineSourceRTIndicator(@NonNull @NonNull Instrument instrument, @NonNull @NonNull KlineValueSource valueSource)
-
-
Method Details
-
backtestEnabled
-
cacheSelector
Description copied from class:InstrumentMapRTIndicatorWhich field of the incoming data this map extracts for scalar indicators, as a stable string.Abstract rather than defaulted on purpose: a subclass that reads a different field and forgot to say so would share memoized series between streams that never produced the same numbers, and a compile error is a far better way to find that out than a wrong leaderboard.
- Specified by:
cacheSelectorin classInstrumentMapRTIndicator- Returns:
- the selector name, never null
-
updateFrom
Propagates a kline update to all registered indicators and to this map itself. In backtest mode, the bar close time is used to set a fixed clock on all clock-aware indicators before the update. Each child indicator is updated viaRichRTIndicator.updateFrom(T)if it implements that interface, otherwise viaKlineSnapshots.update(RTIndicator, MarketSnapshot, KlineValueSource)which extracts the configured value source field.- Specified by:
updateFromin interfaceRTIndicatorSource<Kline>- Parameters:
source- the kline data to propagate
-
hashCode
public int hashCode()- Overrides:
hashCodein classInstrumentMapRTIndicator
-
equals
- Overrides:
equalsin classInstrumentMapRTIndicator
-
getValueSource
-
isBacktestEnabled
public boolean isBacktestEnabled()- Specified by:
isBacktestEnabledin interfaceBacktestable
-
setBacktestEnabled
public void setBacktestEnabled(boolean backtestEnabled) - Specified by:
setBacktestEnabledin interfaceBacktestable
-