Loading...
Searching...
No Matches
ATAS.Indicators.ICandleSeriesSubscription Interface Reference

A live candle series: history plus live updates. Implements ICandleCreator, so it plugs directly into CandlePartSeries (and through it into nested indicators' SourceDataSeries). Dispose to release. More...

Inheritance diagram for ATAS.Indicators.ICandleSeriesSubscription:
[legend]
Collaboration diagram for ATAS.Indicators.ICandleSeriesSubscription:
[legend]

Public Member Functions

Task LoadMoreHistoryAsync (int days)
 Deepens the loaded history to at least the given number of trading days without resubscribing. The returned task is the new Loaded. No-op (returns the current Loaded) when the series is already at least that deep. The host clamps the depth the same way as the initial request.
 
IndicatorCandleGetCandleByTime (DateTime time)
 The last candle that had started at or before the given time, or null when the series has no such candle. Binary search; call from a candle event or the chart's calculation callbacks (the list is appended on the source instrument's data thread).
 
IndicatorCandleGetClosedCandleByTime (DateTime time)
 The last candle that was already CLOSED at the given time (its successor had started at or before time ), or null when the series has no such candle. This is the anti-repaint lookup for historical calculations: the returned candle's values were fully known at time , so historical and live results match. Conservative by construction - a candle is only considered closed once the next one exists. Same threading rules as GetCandleByTime.
 

Properties

CandleSeriesRequest Request [get]
 The request this subscription was created from.
 
string Instrument [get]
 The resolved instrument name (chart's instrument when CandleSeriesRequest.Instrument is null or empty).
 
Task Loaded [get]
 Completes when history is loaded and live updates are flowing; faults with the load error otherwise. Replaced with a new task when the source resets (reconnect/rollover) and the series reloads.
 
bool IsLoaded [get]
 True when history is loaded and live updates are flowing.
 
- Properties inherited from ATAS.Indicators.ICandleCreator
string Name [get]
 Gets the name of the candle creator.
 
List< IndicatorCandleCandles [get]
 Gets the list of IndicatorCandle created by the candle creator.
 

Events

Action< ICandleSeriesSubscription >? Reloaded
 Raised every time the series content is rebuilt: after the initial history load AND after automatic reloads (source reset on reconnect/rollover/replay transitions, deeper history). Consumers should re-read ICandleCreator.Candles and recalculate - the Loaded task instance is replaced on reloads, so a one-shot continuation on it misses them. When a reload FAILED the series is empty and Loaded is faulted with the reason. A handler attached after the series is already loaded is invoked immediately (replay-on-attach), so this event alone is sufficient to drive a consumer. Threading: fires on background/data threads, and on the attaching thread for the replay-on-attach delivery - never assume the UI thread.
 
- Events inherited from ATAS.Indicators.ICandleCreator
Action< IndicatorCandleOnNewCandle
 Event raised when a new IndicatorCandle is created.
 
Action< IndicatorCandleOnRemoveCandle
 Event raised when an IndicatorCandle is removed.
 
Action< IndicatorCandleOnCandleChanged
 Event raised when an IndicatorCandle is changed.
 

Detailed Description

A live candle series: history plus live updates. Implements ICandleCreator, so it plugs directly into CandlePartSeries (and through it into nested indicators' SourceDataSeries). Dispose to release.

The per-candle events cover LIVE updates only: history snapshots (initial load, reloads) are applied silently to ICandleCreator.Candles and signalled by Reloaded - re-read the list there instead of expecting ICandleCreator.OnNewCandle per historical candle.

Threading: ICandleCreator.OnNewCandle, ICandleCreator.OnRemoveCandle and ICandleCreator.OnCandleChanged fire on the SOURCE instrument's data-processing thread — for another instrument this is a different thread than the chart's own callbacks. Handlers must be fast (a slow handler stalls that instrument's data pipeline); use IIndicatorDataProvider.DoActionInGuiThread for UI work. Loaded continuations run by normal task-scheduling rules (thread pool), not on the source thread. Read ICandleCreator.Candles from the candle events (or copy a snapshot there) — the list is appended on the source thread.

Member Function Documentation

◆ GetCandleByTime()

IndicatorCandle? ATAS.Indicators.ICandleSeriesSubscription.GetCandleByTime ( DateTime  time)

The last candle that had started at or before the given time, or null when the series has no such candle. Binary search; call from a candle event or the chart's calculation callbacks (the list is appended on the source instrument's data thread).

LOOKAHEAD WARNING: the returned candle may still have been FORMING at time - on historical data its OHLCV are the final values, which were not known at that moment. An indicator that reads them for historical chart bars looks into the future and will repaint (its historical and live values diverge). For historical calculations use GetClosedCandleByTime; use this method for the live forming value only.

◆ GetClosedCandleByTime()

IndicatorCandle? ATAS.Indicators.ICandleSeriesSubscription.GetClosedCandleByTime ( DateTime  time)

The last candle that was already CLOSED at the given time (its successor had started at or before time ), or null when the series has no such candle. This is the anti-repaint lookup for historical calculations: the returned candle's values were fully known at time , so historical and live results match. Conservative by construction - a candle is only considered closed once the next one exists. Same threading rules as GetCandleByTime.

◆ LoadMoreHistoryAsync()

Task ATAS.Indicators.ICandleSeriesSubscription.LoadMoreHistoryAsync ( int  days)

Deepens the loaded history to at least the given number of trading days without resubscribing. The returned task is the new Loaded. No-op (returns the current Loaded) when the series is already at least that deep. The host clamps the depth the same way as the initial request.

Property Documentation

◆ Instrument

string ATAS.Indicators.ICandleSeriesSubscription.Instrument
get

The resolved instrument name (chart's instrument when CandleSeriesRequest.Instrument is null or empty).

◆ IsLoaded

bool ATAS.Indicators.ICandleSeriesSubscription.IsLoaded
get

True when history is loaded and live updates are flowing.

◆ Loaded

Task ATAS.Indicators.ICandleSeriesSubscription.Loaded
get

Completes when history is loaded and live updates are flowing; faults with the load error otherwise. Replaced with a new task when the source resets (reconnect/rollover) and the series reloads.

◆ Request

CandleSeriesRequest ATAS.Indicators.ICandleSeriesSubscription.Request
get

The request this subscription was created from.

Event Documentation

◆ Reloaded

Action<ICandleSeriesSubscription>? ATAS.Indicators.ICandleSeriesSubscription.Reloaded

Raised every time the series content is rebuilt: after the initial history load AND after automatic reloads (source reset on reconnect/rollover/replay transitions, deeper history). Consumers should re-read ICandleCreator.Candles and recalculate - the Loaded task instance is replaced on reloads, so a one-shot continuation on it misses them. When a reload FAILED the series is empty and Loaded is faulted with the reason. A handler attached after the series is already loaded is invoked immediately (replay-on-attach), so this event alone is sufficient to drive a consumer. Threading: fires on background/data threads, and on the attaching thread for the replay-on-attach delivery - never assume the UI thread.


The documentation for this interface was generated from the following file: