Table of Contents

Interface ICandlestickSubscriptionSet

Namespace
WhalesSecret.TradeScriptLib.API.TradingV1.MarketData
Assembly
WhalesSecret.TradeScriptLib.dll

Set of candlestick subscriptions.

public interface ICandlestickSubscriptionSet : IAsyncDisposable
Inherited Members
Extension Methods

Remarks

The implementation is thread-safe.

Warning: Do not run multiple asynchronous methods in this class simultaneously for the same candle width. It may lead to unexpected results as the individual subscriptions are meant to provide a continuous series of updates (separately for each candle width) and there is a single information per subscription and candle width about the last update that the subscription consumed.

For similar reasons, it is not allowed to mix calls to batch calls (WhenAnyNewClosedCandlestickAsync(CandleWidth) and WhenAnyNewCandlestickUpdateAsync(CandleWidth)) with other calls in this class that may alter the internal state of any subscription for the given candle width. After calling StartBatchMonitoring(CandleWidth, CancellationToken) and before disposing its return value, calling other methods that may alter the internal state will cause InvalidStateException to be raised. This restriction applies to:

Methods

GetCandlesticksAsync(SymbolPair, CandleWidth, DateTime, DateTime, CancellationToken)

Sends a request to retrieve historical candlestick data.

GetLatestCandlestickUpdate(SymbolPair, CandleWidth)

Gets the latest candlestick update for the given candle width and symbol pair.

GetLatestClosedCandlestick(SymbolPair, CandleWidth)

Gets the latest closed candlestick for the given candle width and symbol pair.

StartBatchMonitoring(CandleWidth, CancellationToken)

Starts a batch monitoring operation on all subscriptions in the set for the given candle width. After this method is called, the caller can use WhenAnyNewClosedCandlestickAsync(CandleWidth) and WhenAnyNewCandlestickUpdateAsync(CandleWidth).

TryRemoveSubscription(SymbolPair, out ICandlestickSubscription?)

Removes the given symbol pair from this subscription set.

TryRemoveSubscriptionSubsetAsync(IReadOnlyList<SymbolPair>)

Removes the given symbol pairs from this subscription set.

WaitNextCandlestickUpdateAsync(SymbolPair, CandleWidth, CancellationToken)

Waits for a candlestick update newer than the given time for the given candle width and the symbol pair.

WaitNextClosedCandlestickAsync(SymbolPair, CandleWidth, CancellationToken)

Waits for a closed candlestick newer than the last consumed closed candlestick for the given candle width and symbol pair.

WhenAnyNewCandlestickUpdateAsync(CandleWidth)

Waits for a new candlestick update for the given candle width on any subscription in the set.

WhenAnyNewClosedCandlestickAsync(CandleWidth)

Waits for a new closed candlestick for the given candle width on any subscription in the set.