Skip to main content
ExchangeTrackerFactory (interface: IExchangeTrackerFactory) creates live data trackers that maintain a rolling, in-memory dataset fed by WebSocket streams. Three types of trackers are available:
  • Kline tracker — maintains a sliding window of OHLCV candles
  • Trade tracker — maintains a sliding window of recent public trades
  • User data tracker — maintains real-time account state (balances, orders, positions)
Inject IExchangeTrackerFactory through dependency injection after calling services.AddCryptoClients().

Kline tracker

CreateKlineTracker

exchange
string
required
Exchange name (e.g. "Binance", "Bybit").
symbol
SharedSymbol
required
The symbol to track.
interval
SharedKlineInterval
required
Candlestick interval (e.g. SharedKlineInterval.OneHour, SharedKlineInterval.FiveMinutes).
limit
int?
Maximum number of candles to keep in memory. When reached, the oldest candle is evicted. Pass null for no limit.
period
TimeSpan?
Maximum age of candles to keep. Candles older than this are discarded. Pass null for no time limit.
exchangeParameters
ExchangeParameters?
Exchange-specific parameters.
Returns IKlineTracker?null if the exchange does not support kline tracking for the given symbol.
var tracker = factory.CreateKlineTracker(
    "Binance",
    new SharedSymbol(TradingMode.Spot, "BTC", "USDT"),
    SharedKlineInterval.OneHour,
    limit: 100);

if (tracker != null)
{
    await tracker.StartAsync();

    // Access current candles
    foreach (var kline in tracker.Klines)
        Console.WriteLine($"{kline.OpenTime:u}  O={kline.OpenPrice}  C={kline.ClosePrice}");
}

Trade tracker

CreateTradeTracker

exchange
string
required
Exchange name.
symbol
SharedSymbol
required
The symbol to track.
limit
int?
Maximum number of trades to keep in memory.
period
TimeSpan?
Maximum age of trades to retain.
exchangeParameters
ExchangeParameters?
Exchange-specific parameters.
Returns ITradeTracker?null if the exchange does not support trade tracking for the symbol.
var tracker = factory.CreateTradeTracker(
    "Bybit",
    new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT"),
    limit: 500,
    period: TimeSpan.FromMinutes(5));

if (tracker != null)
{
    await tracker.StartAsync();

    foreach (var trade in tracker.Trades)
        Console.WriteLine($"{trade.Timestamp:u}  {trade.Price} x {trade.Quantity}  {trade.Side}");
}

Spot user data tracker

User data trackers require authentication. There are two modes: shared credentials (credentials were already set on the client at startup) and explicit credentials (passed at tracker creation time, useful for multi-user/multi-account scenarios).

CreateUserSpotDataTracker — shared credentials (single exchange)

exchange
string
required
Exchange name.
config
SpotUserDataTrackerConfig?
Optional configuration for the tracker.
Returns IUserSpotDataTracker?
var tracker = factory.CreateUserSpotDataTracker("Binance");
if (tracker != null)
{
    await tracker.StartAsync();
    Console.WriteLine($"USDT balance: {tracker.Balances["USDT"]?.Available}");
}

CreateUserSpotDataTrackers — shared credentials (all or filtered exchanges)

config
SpotUserDataTrackerConfig?
Optional tracker configuration.
exchanges
string[]?
Optional list of exchange names to restrict to. When omitted, trackers are created for all supporting exchanges.
Returns IUserSpotDataTracker[]
// Create trackers for all exchanges that were configured with credentials
var trackers = factory.CreateUserSpotDataTrackers();
foreach (var t in trackers)
    await t.StartAsync();

CreateUserSpotDataTracker — explicit credentials (single exchange)

exchange
string
required
Exchange name.
userIdentifier
string
required
An arbitrary string that uniquely identifies this user/account (used for internal keying).
credentials
ExchangeCredentials
required
Credentials object containing credentials for the specified exchange.
config
SpotUserDataTrackerConfig?
Optional tracker configuration.
environment
string?
Optional environment name (e.g. "Live", "Testnet"). Uses the exchange default when omitted.
Returns IUserSpotDataTracker?
var credentials = new ExchangeCredentials
{
    Binance = new BinanceCredentials("api-key", "api-secret")
};

var tracker = factory.CreateUserSpotDataTracker(
    "Binance",
    userIdentifier: "user-42",
    credentials: credentials);

CreateUserSpotDataTracker — explicit credentials (all or filtered exchanges)

userIdentifier
string
required
Unique identifier for the user.
credentials
ExchangeCredentials
required
Credentials for each exchange.
config
SpotUserDataTrackerConfig?
Optional tracker configuration.
environments
Dictionary<string, string>?
Per-exchange environment names.
exchanges
string[]?
Restrict to a subset of exchanges.
Returns IUserSpotDataTracker[]

Futures user data tracker

CreateUserFuturesDataTracker — shared credentials (single exchange)

exchange
string
required
Exchange name.
tradeMode
TradingMode
required
The futures trading mode (e.g. TradingMode.PerpetualLinear, TradingMode.PerpetualInverse).
config
FuturesUserDataTrackerConfig?
Optional tracker configuration.
exchangeParameters
ExchangeParameters?
Exchange-specific parameters. Some exchanges require additional parameters:
  • Bitget: "ProductType""UsdtFutures" or "UsdcFutures"
  • GateIo: "SettleAsset" (e.g. "usdt") and "UserId" (numeric)
  • HTX: "MarginMode"SharedMarginMode.Isolated or SharedMarginMode.Cross
Returns IUserFuturesDataTracker?
var tracker = factory.CreateUserFuturesDataTracker(
    "Binance",
    TradingMode.PerpetualLinear);

if (tracker != null)
{
    await tracker.StartAsync();
    foreach (var position in tracker.Positions)
        Console.WriteLine($"{position.Symbol}  qty={position.Quantity}  pnl={position.UnrealizedPnl}");
}

CreateUserFuturesDataTrackers — shared credentials (all or filtered exchanges)

tradeMode
TradingMode
required
Futures trading mode.
config
FuturesUserDataTrackerConfig?
Optional tracker configuration.
exchangeParameters
ExchangeParameters?
Exchange-specific parameters.
exchanges
string[]?
Restrict to a subset of exchanges.
Returns IUserFuturesDataTracker[]

CreateUserFuturesDataTracker — explicit credentials (single exchange)

exchange
string
required
Exchange name.
tradeMode
TradingMode
required
Futures trading mode.
userIdentifier
string
required
Unique identifier for the user/account.
credentials
ExchangeCredentials
required
Credentials.
config
FuturesUserDataTrackerConfig?
Optional tracker configuration.
environment
string?
Optional environment name.
exchangeParameters
ExchangeParameters?
Exchange-specific parameters.
Returns IUserFuturesDataTracker?

CreateUserFuturesDataTracker — explicit credentials (all or filtered exchanges)

userIdentifier
string
required
Unique identifier for the user.
tradingMode
TradingMode
required
Futures trading mode.
credentials
ExchangeCredentials
required
Credentials for each exchange.
config
FuturesUserDataTrackerConfig?
Optional configuration.
environments
Dictionary<string, string>?
Per-exchange environment names.
exchanges
string[]?
Restrict to a subset of exchanges.
Returns IUserFuturesDataTracker[]

Exchange-specific tracker factories

Each exchange exposes a typed tracker factory with exchange-native tracker creation methods.
PropertyType
AsterIAsterTrackerFactory
BinanceIBinanceTrackerFactory
BingXIBingXTrackerFactory
BitfinexIBitfinexTrackerFactory
BitgetIBitgetTrackerFactory
BitMartIBitMartTrackerFactory
BitMEXIBitMEXTrackerFactory
BitstampIBitstampTrackerFactory
BloFinIBloFinTrackerFactory
BybitIBybitTrackerFactory
CoinbaseICoinbaseTrackerFactory
CoinExICoinExTrackerFactory
CoinWICoinWTrackerFactory
CryptoComICryptoComTrackerFactory
DeepCoinIDeepCoinTrackerFactory
GateIoIGateIoTrackerFactory
HTXIHTXTrackerFactory
HyperLiquidIHyperLiquidTrackerFactory
KrakenIKrakenTrackerFactory
KucoinIKucoinTrackerFactory
MexcIMexcTrackerFactory
OKXIOKXTrackerFactory
ToobitIToobitTrackerFactory
UpbitIUpbitTrackerFactory
WhiteBitIWhiteBitTrackerFactory
XTIXTTrackerFactory
Polymarket does not have a tracker factory and is absent from this list.

Full usage example

using CryptoClients.Net;
using CryptoExchange.Net.SharedApis;

var factory = serviceProvider.GetRequiredService<IExchangeTrackerFactory>();

// --- Kline tracker ---
var klineTracker = factory.CreateKlineTracker(
    "Binance",
    new SharedSymbol(TradingMode.Spot, "BTC", "USDT"),
    SharedKlineInterval.FifteenMinutes,
    limit: 96); // 24 hours of 15m candles

await klineTracker!.StartAsync();

// --- Trade tracker ---
var tradeTracker = factory.CreateTradeTracker(
    "Bybit",
    new SharedSymbol(TradingMode.PerpetualLinear, "ETH", "USDT"),
    period: TimeSpan.FromMinutes(10));

await tradeTracker!.StartAsync();

// --- Spot user data tracker (using pre-configured credentials) ---
var userTracker = factory.CreateUserSpotDataTracker("Binance");
await userTracker!.StartAsync();

await Task.Delay(2000);

Console.WriteLine($"Latest candle close: {klineTracker.Klines.LastOrDefault()?.ClosePrice}");
Console.WriteLine($"Recent trades: {tradeTracker.Trades.Count}");
Console.WriteLine($"USDT balance: {userTracker.Balances.GetValueOrDefault("USDT")?.Available}");

Build docs developers (and LLMs) love