The shared spot interfaces expose a consistent, exchange-agnostic API surface for spot trading operations. Each interface is implemented by one or more exchange clients and can be retrieved from IExchangeRestClient by name, by trading mode, or across all exchanges at once.
Each interface has three access patterns on IExchangeRestClient:
// Get the client for a single exchange (returns null if not supported)ISpotTickerRestClient? client = restClient.GetSpotTickerClient("Binance");// Get clients for all exchanges that implement the interfaceIEnumerable<ISpotTickerRestClient> clients = restClient.GetSpotTickerClients();
Methods that return IEnumerable only include exchanges that actually implement the interface. Not every exchange supports every interface.
ISpotTickerRestClient
Retrieve 24-hour price ticker data for spot symbols.Client access
// Single exchangeISpotTickerRestClient? client = restClient.GetSpotTickerClient("Binance");// All exchangesIEnumerable<ISpotTickerRestClient> clients = restClient.GetSpotTickerClients();
Methods on IExchangeRestClient
// Single symbol on a specific exchangeTask<ExchangeWebResult<SharedSpotTicker>> GetSpotTickerAsync( string exchange, GetTickerRequest request, CancellationToken ct = default);// Single symbol across all (or filtered) exchanges — wait for allTask<ExchangeWebResult<SharedSpotTicker>[]> GetSpotTickerAsync( GetTickerRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// Single symbol across all exchanges — stream results as they arriveIAsyncEnumerable<ExchangeWebResult<SharedSpotTicker>> GetSpotTickerAsyncEnumerable( GetTickerRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// All symbols on a specific exchangeTask<ExchangeWebResult<SharedSpotTicker[]>> GetSpotTickerAsync( string exchange, GetTickersRequest request, CancellationToken ct = default);// All symbols across all (or filtered) exchanges — wait for allTask<ExchangeWebResult<SharedSpotTicker[]>[]> GetSpotTickersAsync( GetTickersRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// All symbols across all exchanges — stream results as they arriveIAsyncEnumerable<ExchangeWebResult<SharedSpotTicker[]>> GetSpotTickersAsyncEnumerable( GetTickersRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);
Example
// Fetch ETH/USDT ticker from Binancevar ticker = await restClient.GetSpotTickerAsync("Binance", new GetTickerRequest(new SharedSymbol(TradingMode.Spot, "ETH", "USDT")));// Fetch ETH/USDT ticker from every supporting exchange simultaneouslyawait foreach (var result in restClient.GetSpotTickerAsyncEnumerable( new GetTickerRequest(new SharedSymbol(TradingMode.Spot, "ETH", "USDT")))){ Console.WriteLine($"{result.Exchange}: {result.Data?.LastPrice}");}
ISpotSymbolRestClient
List all available spot trading pairs on an exchange.Client access
// All symbols on a specific exchangeTask<ExchangeWebResult<SharedSpotSymbol[]>> GetSpotSymbolsAsync( string exchange, GetSymbolsRequest request, CancellationToken ct = default);// All symbols across all (or filtered) exchanges — wait for allTask<ExchangeWebResult<SharedSpotSymbol[]>[]> GetSpotSymbolsAsync( GetSymbolsRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// All symbols across all exchanges — stream results as they arriveIAsyncEnumerable<ExchangeWebResult<SharedSpotSymbol[]>> GetSpotSymbolsAsyncEnumerable( GetSymbolsRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// Helper: find which exchanges list a symbol with a given base assetTask<Dictionary<string, SharedSymbol[]>> GetSpotSymbolsForBaseAssetAsync(string baseAsset);Task<ExchangeResult<SharedSymbol[]>> GetSpotSymbolsForBaseAssetAsync(string exchange, string baseAsset);// Helper: find which exchanges support a specific symbolTask<string[]> GetExchangesSupportingSpotSymbolAsync(string symbolName);Task<string[]> GetExchangesSupportingSpotSymbolAsync(SharedSymbol symbol);Task<ExchangeResult<bool>> SupportsSpotSymbolAsync(string exchange, SharedSymbol symbol);
Example
// All exchanges that list BTC as a base assetvar byExchange = await restClient.GetSpotSymbolsForBaseAssetAsync("BTC");foreach (var (exchange, symbols) in byExchange) Console.WriteLine($"{exchange}: {symbols.Length} BTC pairs");
ISpotOrderRestClient
Place, retrieve, and cancel spot orders, as well as query trade history.Client access
// Place a new spot orderTask<ExchangeWebResult<SharedId>> PlaceSpotOrderAsync( string exchange, PlaceSpotOrderRequest request, CancellationToken ct = default);// Retrieve a specific order by exchange order idTask<ExchangeWebResult<SharedSpotOrder>> GetSpotOrderAsync( string exchange, GetOrderRequest request, CancellationToken ct = default);// Retrieve all fills for a specific orderTask<ExchangeWebResult<SharedUserTrade[]>> GetSpotOrderTradesAsync( string exchange, GetOrderTradesRequest request, CancellationToken ct = default);// Cancel an open spot orderTask<ExchangeWebResult<SharedId>> CancelSpotOrderAsync( string exchange, CancelOrderRequest request, CancellationToken ct = default);// Get open orders (optionally filtered to a symbol)Task<ExchangeWebResult<SharedSpotOrder[]>> GetSpotOpenOrdersAsync( string exchange, GetOpenOrdersRequest request, CancellationToken ct = default);// Get closed/historical orders for a symbolTask<ExchangeWebResult<SharedSpotOrder[]>> GetSpotClosedOrdersAsync( string exchange, GetClosedOrdersRequest request, PageRequest? pageRequest = null, CancellationToken ct = default);// Get user trade history for a symbolTask<ExchangeWebResult<SharedUserTrade[]>> GetSpotUserTradesAsync( string exchange, GetUserTradesRequest request, PageRequest? pageRequest = null, CancellationToken ct = default);
Example
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");// Place a market buy order for 0.1 ETHvar order = await restClient.PlaceSpotOrderAsync("Binance", new PlaceSpotOrderRequest( symbol, SharedOrderSide.Buy, SharedOrderType.Market, quantity: 0.1m));// Cancel the orderawait restClient.CancelSpotOrderAsync("Binance", new CancelOrderRequest(symbol, order.Data.Id));
ISpotOrderClientIdRestClient
Retrieve or cancel spot orders using a client-assigned order ID rather than the exchange’s own order ID.Client access
// Retrieve an order by client order idTask<ExchangeWebResult<SharedSpotOrder>> GetSpotOrderByClientOrderIdAsync( string exchange, GetOrderRequest request, CancellationToken ct = default);// Cancel an order by client order idTask<ExchangeWebResult<SharedId>> CancelSpotOrderByClientOrderIdAsync( string exchange, CancelOrderRequest request, CancellationToken ct = default);
// Place a spot order that triggers at a specific priceTask<ExchangeWebResult<SharedId>> PlaceSpotTriggerOrderAsync( string exchange, PlaceSpotTriggerOrderRequest request, CancellationToken ct = default);// Cancel a pending spot trigger orderTask<ExchangeWebResult<SharedId>> CancelSpotTriggerOrderAsync( string exchange, CancelOrderRequest request, CancellationToken ct = default);
IBalanceRestClient
Retrieve account balances. Supports filtering by trading mode or account type.Client access
// All exchangesIEnumerable<IBalanceRestClient> clients = restClient.GetBalancesClients();// Filter by trading modeIEnumerable<IBalanceRestClient> spotClients = restClient.GetBalancesClients(TradingMode.Spot);// Filter by account typeIEnumerable<IBalanceRestClient> fundingClients = restClient.GetBalancesClients(SharedAccountType.Funding);// Single exchange by trading modeIBalanceRestClient? client = restClient.GetBalancesClient(TradingMode.Spot, "Binance");
Methods on IExchangeRestClient
// Balances from a specific exchangeTask<ExchangeWebResult<SharedBalance[]>> GetBalancesAsync( string exchange, GetBalancesRequest request, CancellationToken ct = default);// Balances from all (or filtered) exchanges — wait for allTask<ExchangeWebResult<SharedBalance[]>[]> GetBalancesAsync( GetBalancesRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);// Stream as results arriveIAsyncEnumerable<ExchangeWebResult<SharedBalance[]>> GetBalancesAsyncEnumerable( GetBalancesRequest request, IEnumerable<string>? exchanges = null, CancellationToken ct = default);
Example
var balances = await restClient.GetBalancesAsync("Binance", new GetBalancesRequest(TradingMode.Spot));foreach (var b in balances.Data ?? []) Console.WriteLine($"{b.Asset}: {b.Available}");
IKlineRestClient
Fetch OHLCV candlestick (kline) data. Supports pagination via PageRequest.Client access
var klines = await restClient.GetKlinesAsync("Binance", new GetKlinesRequest( new SharedSymbol(TradingMode.Spot, "BTC", "USDT"), SharedKlineInterval.OneHour, startTime: DateTime.UtcNow.AddDays(-7)));
IOrderBookRestClient
Retrieve a snapshot of the current order book for a symbol.Client access
var book = await restClient.GetOrderBookAsync("Binance", new GetOrderBookRequest( new SharedSymbol(TradingMode.Spot, "BTC", "USDT"), limit: 20));Console.WriteLine($"Best bid: {book.Data?.Bids.First().Price}");Console.WriteLine($"Best ask: {book.Data?.Asks.First().Price}");
IRecentTradeRestClient
Fetch the most recent public trades executed on the exchange.Client access