Class InstrumentMapRTIndicator
- All Implemented Interfaces:
Backtestable, ClockAware, Resettable, RTIndicator
- Direct Known Subclasses:
InstrumentMapFundingRateSourceRTIndicator, InstrumentMapKlineSourceRTIndicator, InstrumentMapTickerSourceRTIndicator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(String name, RTIndicator indicator) protected abstract StringWhich field of the incoming data this map extracts for scalar indicators, as a stable string.voidclear()booleanvoidforEachPublicable(BiConsumer<String, RTIndicator> action) Iterates over the public indicators — those not markedhidden— invoking the given action.final StringgetCacheContext(RTIndicator indicator) Identity of the value stream a memoized indicator is registered against (goal indicator-bank-coverage P5b) — what makes two otherwise identical indicators produce different series.getExisting(String name) Wiring diagnostics raised about this group — seeIndicatorNoticefor why these are data rather than log lines.getReadOnly(String name) Returns a read-only wrapper of the named indicator, creating and caching it on first access.getReadOnlyExisting(String name) doubleinthashCode()protected Collection<RTIndicator> protected Collection<Map.Entry<String, RTIndicator>> Every registered indicator paired with the name it was registered under, hidden ones included.protected booleanraiseNotice(@NonNull IndicatorNotice notice) Records a notice, keeping only the first occurrence per(code, indicator)pair.voidreset()Resets every child indicator in place, mirroringsetClockSupplier(Supplier).voidsetClockSupplier(Supplier<Clock> clockSupplier) intsize()protected com.google.common.base.MoreObjects.ToStringHelpertoString(com.google.common.base.MoreObjects.ToStringHelper ts) Methods inherited from class AbstractRTIndicator
getDisplayHint, getMeta, getValue, hide, isPoison, setValue, toString, update, withDisplayHint, withMetaMethods inherited from interface Backtestable
isBacktestEnabled, setBacktestEnabled
-
Field Details
-
PRIVATE_PREFIX
- See Also:
-
-
Constructor Details
-
InstrumentMapRTIndicator
-
-
Method Details
-
add
-
getCacheContext
Identity of the value stream a memoized indicator is registered against (goal indicator-bank-coverage P5b) — what makes two otherwise identical indicators produce different series.A
RichRTIndicatoris fed the whole snapshot viaupdateFrom, never throughcacheSelector()'s field —chg%andvwapboth driving a snapshot- consumingTickerRTIndicatorwould otherwise be keyed apart by a selector neither of them reads, splitting one series into two for no difference in what either actually computes. A scalar indicator has no such isolation: two groups reading different fields of the same stream can and do produce different numbers, so the selector stays load-bearing for it.- Parameters:
indicator- the indicator about to be registered, deciding which identity it needs- Returns:
- the stream identity, stable for the lifetime of this map for a given indicator shape
-
cacheSelector
Which 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.
- Returns:
- the selector name, never null
-
getValue
-
getReadOnlyExisting
-
getReadOnly
Returns a read-only wrapper of the named indicator, creating and caching it on first access. Read-only wrappers prevent accidental mutation of shared indicators when they are referenced by multiple derived indicators. The cache is invalidated when indicators are added or removed.- Parameters:
name- the indicator name, or null- Returns:
- an Optional containing the read-only wrapper, or empty if not found
-
getExisting
-
get
-
getRaw
-
remove
-
size
public int size() -
clear
public void clear() -
namedIndicators
Every registered indicator paired with the name it was registered under, hidden ones included. This is the dispatch view: a subclass propagating market data needs the name to report anything about an individual indicator, whichindicators()alone cannot give it.- Returns:
- the name→indicator entries, in registration order
-
getNotices
Wiring diagnostics raised about this group — seeIndicatorNoticefor why these are data rather than log lines. Empty for a correctly wired group.- Returns:
- the notices in the order they were first raised, never null
-
raiseNotice
Records a notice, keeping only the first occurrence per(code, indicator)pair.De-duplication is the whole point: the conditions worth reporting are detected inside the per-tick dispatch loop, so a naive implementation would raise the same notice on every tick of every instrument for the lifetime of the run. The first occurrence is kept rather than the last because they are identical by construction, and keeping the first means the list order matches the order problems were discovered.
- Parameters:
notice- the diagnostic to record- Returns:
- true if this was the first time that notice was raised
-
forEachPublicable
Iterates over the public indicators — those not markedhidden— invoking the given action. Internal indicators (the_gain/_loss/_winentries thegain()/loss()/window()factories register, the auto-created Bollinger behindbollingerBandwidth, …) are skipped so their values are not emitted. The skip reads visibility metadata, not the"_"name prefix, which the registration path has already translated into that metadata.- Parameters:
action- consumer receiving the indicator name and instance
-
setClockSupplier
- Specified by:
setClockSupplierin interfaceClockAware
-
reset
public void reset()Resets every child indicator in place, mirroringsetClockSupplier(Supplier). The instrument map itself is kept (useclear()to drop instruments); only the children's rolling state is zeroed, so the basereset()contract — return to a pre-first-tick state — holds for containers too. The read-only wrappers stay valid: they delegate live to the children they wrap.- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractRTIndicator
-
equals
- Overrides:
equalsin classAbstractRTIndicator
-
toString
protected com.google.common.base.MoreObjects.ToStringHelper toString(com.google.common.base.MoreObjects.ToStringHelper ts) - Overrides:
toStringin classAbstractRTIndicator
-
indicators
-
getInstrument
-