Skip to main content
CryptoExchange.Net defines a set of SharedApis interfaces that describe common functionality available across multiple exchanges. Every exchange client in CryptoClients.Net implements the interfaces it supports, accessible via the SharedClient property on each API group. Writing against these interfaces means your business logic does not need to know which exchange it is talking to — the same code works on Binance, Bybit, Kraken, or any other supported exchange.

Accessing shared clients

IExchangeRestClient and IExchangeSocketClient expose helper methods to retrieve shared-interface implementations by interface type, trading mode, or exchange name.
var client = new ExchangeRestClient();

// Get the ISpotTickerRestClient for Binance
ISpotTickerRestClient? binanceTicker = client.GetSpotTickerClient("Binance");

// Get ISpotTickerRestClient implementations for every exchange that supports it
IEnumerable<ISpotTickerRestClient> allTicker = client.GetSpotTickerClients();

// Access a shared client directly from an exchange property
ISpotTickerRestClient krakenTicker = client.Kraken.SpotApi.SharedClient;

Writing exchange-agnostic code

The pattern below works identically for any exchange that supports ISpotTickerRestClient:
async Task<ExchangeWebResult<SharedSpotTicker>> GetTickerAsync(
    ISpotTickerRestClient tickerClient,
    SharedSymbol symbol)
{
    return await tickerClient.GetSpotTickerAsync(new GetTickerRequest(symbol));
}

var client = new ExchangeRestClient();
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");

var binanceResult = await GetTickerAsync(client.Binance.SpotApi.SharedClient, symbol);
var kucoinResult  = await GetTickerAsync(client.Kucoin.SpotApi.SharedClient, symbol);
var okxResult     = await GetTickerAsync(client.OKX.UnifiedApi.SharedClient, symbol);
Using GetSpotTickerClient(exchange) to make this fully dynamic:
var client = new ExchangeRestClient();
var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");

// The exchange name can come from config, a database, or user input
var tickerClient = client.GetSpotTickerClient("Kraken")!;
var result = await tickerClient.GetSpotTickerAsync(new GetTickerRequest(symbol));
Console.WriteLine($"Kraken ETH/USDT: {result.Data.LastPrice}");
This is the pattern used in the example minimal API from the README.

REST shared interfaces

InterfaceDescription
ISpotTickerRestClientRetrieve spot ticker data for one or all symbols
ISpotSymbolRestClientList available spot trading pairs
IKlineRestClientFetch OHLCV candlestick data
IOrderBookRestClientQuery the order book snapshot
IRecentTradeRestClientRetrieve recent public trades
ITradeHistoryRestClientFetch historical public trades (paginated)
IBookTickerRestClientGet best bid/ask price
IAssetsRestClientList supported assets and networks
InterfaceDescription
ISpotOrderRestClientPlace, cancel, and query spot orders
ISpotOrderClientIdRestClientLook up spot orders by client order ID
ISpotTriggerOrderRestClientPlace and manage spot trigger (stop) orders
IBalanceRestClientRetrieve account balances
IDepositRestClientQuery deposit history
IWithdrawRestClientSubmit withdrawals
IWithdrawalRestClientQuery withdrawal history
ITransferRestClientMove funds between account types
IFeeRestClientRetrieve maker/taker fee rates
InterfaceDescription
IFuturesTickerRestClientFutures ticker (includes mark/index price, funding)
IFuturesSymbolRestClientList available futures contracts
IFundingRateRestClientHistorical and predicted funding rates
IMarkPriceKlineRestClientMark price klines for futures
IIndexPriceKlineRestClientIndex price klines for futures
IOpenInterestRestClientOpen interest data
InterfaceDescription
IFuturesOrderRestClientPlace, cancel, and query futures orders
IFuturesOrderClientIdRestClientLook up futures orders by client order ID
IFuturesTriggerOrderRestClientPlace and manage futures trigger orders
IFuturesTpSlRestClientTake-profit / stop-loss management
ILeverageRestClientGet and set position leverage
IPositionModeRestClientHedge vs one-way position mode
IPositionHistoryRestClientHistorical positions
IListenKeyRestClientCreate and renew listen keys for user data streams

Socket shared interfaces

InterfaceDescription
ITickerSocketClientReal-time ticker updates for a single symbol
ITickersSocketClientReal-time ticker updates for all symbols
ITradeSocketClientLive public trade feed
IKlineSocketClientCandlestick / OHLCV updates
IOrderBookSocketClientOrder book snapshot updates
IBookTickerSocketClientBest bid/ask streaming
InterfaceDescription
IBalanceSocketClientAccount balance change notifications
ISpotOrderSocketClientSpot order state updates
IFuturesOrderSocketClientFutures order state updates
IUserTradeSocketClientTrade execution notifications
IPositionSocketClientFutures position updates

Getting shared clients by type

IExchangeRestClient provides a GetXxxClients() / GetXxxClient(exchange) pair for every interface, with optional TradingMode filtering where relevant:
var client = new ExchangeRestClient();

// All exchanges that can return klines in spot mode
IEnumerable<IKlineRestClient> klineClients =
    client.GetKlineClients(TradingMode.Spot);

// Futures order client for a specific exchange
IFuturesOrderRestClient? futuresOrders =
    client.GetFuturesOrderClient(TradingMode.PerpetualLinear, "Bybit");

// All balance clients regardless of trading mode
IEnumerable<IBalanceRestClient> balanceClients =
    client.GetBalancesClients();

// Balance client filtered by account type
IEnumerable<IBalanceRestClient> spotBalanceClients =
    client.GetBalancesClients(SharedAccountType.Spot);
Use GetExchangeSharedClients(exchange, tradingMode) to enumerate all shared interfaces that an exchange exposes, which is useful for feature detection at runtime.

Symbol discovery helpers

var client = new ExchangeRestClient();

// Which exchanges list ETH/USDT as a spot symbol?
string[] exchanges = await client.GetExchangesSupportingSpotSymbolAsync("ETHUSDT");

// Get all spot symbols containing BTC across all exchanges
Dictionary<string, SharedSymbol[]> byExchange =
    await client.GetSpotSymbolsForBaseAssetAsync("BTC");

// Does Binance support this spot symbol?
ExchangeResult<bool> supported =
    await client.SupportsSpotSymbolAsync(
        "Binance",
        new SharedSymbol(TradingMode.Spot, "ETH", "USDT"));

Build docs developers (and LLMs) love