ExchangeOrderBookFactory (interface: IExchangeOrderBookFactory) creates locally-maintained ISymbolOrderBook instances that stay in sync with an exchange’s order book in real time via WebSocket.
Inject IExchangeOrderBookFactory through dependency injection or resolve it from the service container after calling services.AddCryptoClients().
Methods
Create(SharedSymbol, ...)
Create a live order book for a symbol across all exchanges (or a specified subset) that support that symbol.
The symbol to create order books for. Use
TradingMode.Spot, TradingMode.PerpetualLinear, etc. to specify the market.Minimum number of price levels to maintain on each side. The factory selects the smallest depth tier supported by the exchange that satisfies this requirement. If the requested depth exceeds all supported tiers, the largest available tier is used. Pass
null for the exchange default.Optional list of exchange names to restrict the result to. When omitted, order books are created for every exchange that supports the symbol.
Exchange-specific parameters. For example, Bitget requires a
ProductType parameter ("UsdtFutures" or "UsdcFutures").ISymbolOrderBook[] — one entry per supporting exchange.
Create(string exchange, SharedSymbol, ...)
Create a live order book for a symbol on a specific exchange.
The exchange name (e.g.
"Binance", "Bybit", "OKX").The symbol to subscribe to.
Minimum order book depth. See the description above.
Exchange-specific parameters.
ISymbolOrderBook? — null if the exchange does not support the symbol or trading mode.
Exchange-specific factories
Each exchange has a dedicated factory property with exchange-nativeCreate methods that expose exchange-specific options not available through the shared API.
| Property | Type |
|---|---|
Aster | IAsterOrderBookFactory |
Binance | IBinanceOrderBookFactory |
BingX | IBingXOrderBookFactory |
Bitfinex | IBitfinexOrderBookFactory |
Bitget | IBitgetOrderBookFactory |
BitMart | IBitMartOrderBookFactory |
BitMEX | IBitMEXOrderBookFactory |
Bitstamp | IBitstampOrderBookFactory |
BloFin | IBloFinOrderBookFactory |
Bybit | IBybitOrderBookFactory |
Coinbase | ICoinbaseOrderBookFactory |
CoinEx | ICoinExOrderBookFactory |
CoinW | ICoinWOrderBookFactory |
CryptoCom | ICryptoComOrderBookFactory |
DeepCoin | IDeepCoinOrderBookFactory |
GateIo | IGateIoOrderBookFactory |
HTX | IHTXOrderBookFactory |
HyperLiquid | IHyperLiquidOrderBookFactory |
Kraken | IKrakenOrderBookFactory |
Kucoin | IKucoinOrderBookFactory |
Mexc | IMexcOrderBookFactory |
OKX | IOKXOrderBookFactory |
Polymarket | IPolymarketOrderBookFactory |
Toobit | IToobitOrderBookFactory |
Upbit | IUpbitOrderBookFactory |
WhiteBit | IWhiteBitOrderBookFactory |
XT | IXTOrderBookFactory |
Supported depths by exchange
TheminimalDepth parameter is mapped to the nearest supported tier for each exchange. The table below shows supported levels; null indicates the full order book is available.
| Exchange | Supported depth levels |
|---|---|
| Aster | 5, 10, 20 (or full) |
| Binance | 5, 10, 20 (or full) |
| BingX | 5, 10, 20, 50, 100 |
| Bitfinex | 1, 25, 100, 250 |
| Bitget | 5, 15 (or full) |
| BitMart | 5, 20, 50 (or full) |
| BitMEX | 25 (or full) |
| Bitstamp | Full |
| BloFin | 5, 400 |
| Bybit | 1, 50, 200, 1000 |
| Coinbase | Full |
| CoinEx | 5, 10, 20, 50 |
| CoinW | Full |
| CryptoCom | 10, 50 |
| DeepCoin | Full |
| GateIo | 20, 50, 100 (or full) |
| HTX | 5, 20, 150, 400 (or full) |
| HyperLiquid | Full |
| Kraken | 10, 25, 100, 500, 1000 |
| Kucoin | 5, 50 (or full) |
| Mexc | 5, 10, 20 (or full) |
| OKX | 1, 5, 400 (or full) |
| Toobit | Full |
| Upbit | 1, 5, 15, 30 |
| WhiteBit | 1, 5, 10, 20, 30, 50, 100 (or full) |
| XT | 5, 10, 20, 50 (or full) |
When
minimalDepth is set higher than all supported levels, the largest fixed tier is used unless the exchange supports a full order book, in which case null (full) is used.