Method TryGetLatestOrderBook
- Namespace
- WhalesSecret.TradeScriptLib.API.TradingV1.MarketData
- Assembly
- WhalesSecret.TradeScriptLib.dll
TryGetLatestOrderBook(SymbolPair, out OrderBook?)
Gets the latest order book snapshot if it is available from the subscription specified by its symbol pair.
bool TryGetLatestOrderBook(SymbolPair symbolPair, out OrderBook? orderBook)
Parameters
symbolPair
SymbolPairSymbol pair of the subscription whose order book to get.
orderBook
OrderBook?If the function succeeds, this is filled with an order book snapshot.
Returns
- bool
true
when an order book snapshot is available,false
otherwise.
Remarks
There are some corner cases when this method can return false
:
- Order book update subscription is acknowledged by an exchange but it takes time to actually get order book updates then.
- The connection with the exchange is lost and thus we cannot really return the latest order book as it might be obsolete.
Exceptions
- InvalidArgumentException
Thrown if the set does not contain a subscription for the given symbol pair.
- InvalidStateException
Thrown if the method is called while batch monitoring operation is active.