Table of Contents

Interface IOrderBookSubscriptionSet

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

Set of order update book subscriptions.

public interface IOrderBookSubscriptionSet : IAsyncDisposable
Inherited Members
Extension Methods

Remarks

The implementation is thread-safe.

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

For similar reasons, it is not allowed to mix calls to WhenAnyNewOrderBookAsync() with other calls in this class that may alter the internal state of any subscription. After calling StartBatchMonitoring(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

GetOrderBookAsync(SymbolPair, CancellationToken)

Get the latest order book snapshot for this subscription or waits for the first order book snapshot to be received for the subscription of the given symbol pair if none is available.

GetOrderBookAsync(SymbolPair, OrderBookGetMode, CancellationToken)

Gets an up-to-date order book for the subscribed symbol pair that satisfies getMode requirement.

StartBatchMonitoring(CancellationToken)

Starts a batch monitoring operation on all subscriptions in the set. After this method is called, the caller can use WhenAnyNewOrderBookAsync().

TryGetLatestOrderBook(SymbolPair, out OrderBook?)

Gets the latest order book snapshot if it is available from the subscription specified by its symbol pair.

TryRemoveSubscription(SymbolPair, out IOrderBookSubscription?)

Removes the given symbol pair from this subscription set.

TryRemoveSubscriptionSubsetAsync(IReadOnlyList<SymbolPair>)

Removes the given symbol pairs from this subscription set.

WhenAnyNewOrderBookAsync()

Waits for a new order book on any subscription in the set.