Interface IHeatmapCandleConsumer
- Namespace
- ATAS.Indicators.Heatmap
- Assembly
- ATAS.Indicators.dll
Optional capability: receive candle series (history and live candles) of the heatmap instrument or of another instrument, built by the same loader the chart uses for multi-timeframe candles.
The indicator only declares which series it needs in GetRequiredCandleSeries(); the platform owns the subscriptions (tariff checks, the open-instruments budget, reloads after reconnects, disposal) and delivers copies of the candles to ProcessCandlesAsync(HeatmapCandleSeriesUpdate, CancellationToken) on the instance's own task, serialised with the other callbacks.
Delivery order. For every declared series the instance first receives a Reload with the full history, then Updates that replace the tail of the delivered list (the forming candle and any candles that closed since the previous update). Live updates are coalesced: one update per series carries all the changes since the previous one. A Reload is delivered again whenever the series reloads (reconnect, contract roll-over, replay transitions), after every state reset of the instance (OnStateResetNotificationAsync(IHeatmapIndicatorContext, IHeatmapIndicatorRuntime, CancellationToken), including the one after an instrument change), and when the instance starts declaring the series. A new request object, even one equal to the previous request, means the instance wants a fresh Reload: return the same request object for as long as the delivered candles stay valid. A Reload also follows an update the instance did not complete (cancelled, timed out, faulted). No Update is delivered between a state reset and the next Reload.
Use ApplyTo(List<HeatmapCandle>) to keep a list of the delivered candles, and TradingCalendar to place candles on the heatmap timeline and to detect session, week and month boundaries the way chart indicators do.
Not in ATAS 8.0.15 yet: available from the next version.
public interface IHeatmapCandleConsumer
- Extension Methods
Methods
GetRequiredCandleSeries()
The candle series this instance needs now; an empty collection means none. Requests with an empty Instrument refer to the heatmap instrument. Two requests that HeatmapCandleSeriesRequestComparer considers equal share one subscription.
Threading. Like GetRequiredProfilePeriods(), this method is called
from the platform's pump thread at any time, concurrently with the instance's own callbacks. It MUST be
thread-safe, cheap and non-blocking: return an immutable collection prepared in advance (for example a
volatile field refreshed in ConfigureAsync(TSettings, CancellationToken))
and never mutate indicator state here. The platform re-reads the declaration periodically, so a settings
change takes effect within about a second.
IReadOnlyCollection<CandleSeriesRequest> GetRequiredCandleSeries()
Returns
- IReadOnlyCollection<CandleSeriesRequest>
The declared requests; never null.
ProcessCandlesAsync(HeatmapCandleSeriesUpdate, CancellationToken)
Processes one update of a declared candle series. Called on the instance's own task, serialised with the other callbacks; Request is the request object this instance declared. A Reload gets the warm-up time budget (30 s by default) because it may recalculate the whole history, as does a settings change (ConfigureAsync(TSettings, CancellationToken)); Update and Failed get the regular per-call budget (2 s by default).
ValueTask ProcessCandlesAsync(HeatmapCandleSeriesUpdate update, CancellationToken cancellationToken)
Parameters
updateHeatmapCandleSeriesUpdateThe update; its candles are copies that may be kept after the call.
cancellationTokenCancellationTokenCancelled when the per-call timeout expires or the instance is shut down.
Returns
- ValueTask
A task that completes when the update has been processed.