Prerequisites
- .NET 8.0 or later (or .NET Standard 2.0+ for older targets)
- A .NET project (console, web API, or otherwise)
Install the package
Add CryptoClients.Net to your project via the .NET CLI:Or using the Package Manager Console in Visual Studio:
Create a client
There are two main entry points —
ExchangeRestClient for REST APIs and ExchangeSocketClient for WebSocket streams. You can construct them directly or register them via dependency injection.Make your first REST request
Request a spot ticker from a single exchange using the unified shared interface:The
SharedSymbol type lets you specify a trading pair in a normalized format that works across all exchanges — no need to know each exchange’s symbol convention.Request data from multiple exchanges at once
One of the key features of CryptoClients.Net is the ability to query multiple exchanges with a single call. All requests run in parallel and results are returned together:You can also use
GetSpotTickerAsyncEnumerable to process results as they arrive instead of waiting for all exchanges to respond:To query all supported exchanges, omit the exchange list entirely — the client will send requests to every exchange that supports the requested endpoint.
Subscribe to WebSocket streams
Use This subscribes to ticker updates on Binance and OKX simultaneously. The same callback receives updates from both exchanges, each tagged with the exchange name in
ExchangeSocketClient to subscribe to live data. Subscriptions are automatically managed — connections are kept alive and reconnected if they drop.data.Exchange.Using dependency injection in ASP.NET Core
TheAddCryptoClients extension method registers all clients with the DI container. You can configure options inline or load them from appsettings.json:
IExchangeRestClient or IExchangeSocketClient into any service:
Exchange-specific clients
When you need access to exchange-specific endpoints that aren’t part of the shared interface, use the typed clients exposed directly onExchangeRestClient:
Next steps
Installation
See all installation options including GitHub Packages and framework compatibility
REST client
Learn how the ExchangeRestClient works in depth
Shared interfaces
Write exchange-agnostic logic using common interfaces
Configuration
Configure credentials, rate limiting, environments, and more