- All client libraries support and encourage usage via the Dotnet dependency injection system. Add all necesary services per exchange by calling the Add[Library]();
extension method on the service collection, or use AddCryptoClients()
to add all exchange services in a single class. Options for the clients can be passed as parameters.
+ All client libraries support and encourage usage via the Dotnet dependency injection system. Add all necesary services per exchange by calling the Add[Library]();
extension method on the service collection, or use AddCryptoClients()
to add all exchange services in a single class. Options for the clients can be passed as parameters or read from the configuration. See Options.
When adding a library to the service collection (see Dependency Injection) the options for the clients can be provided as argument to the calls. Options are split between the REST and the websocket client.
+When adding a library to the service collection (see Dependency Injection) the options for the clients can be provided as argument to the calls or read from configuration.
builder.Services.AddBinance(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBinance(builder.Configuration.GetSection("Binance"));
builder.Services.AddBingX(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBingX(builder.Configuration.GetSection("BingX"));
builder.Services.AddBitfinex(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBitfinex(builder.Configuration.GetSection("Bitfinex"));
builder.Services.AddBitget(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBitget(builder.Configuration.GetSection("Bitget"));
builder.Services.AddBitMart(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBitMart(builder.Configuration.GetSection("BitMart"));
builder.Services.AddBybit(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddBybit(builder.Configuration.GetSection("Bybit"));
builder.Services.AddCoinbase(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddCoinbase(builder.Configuration.GetSection("Coinbase"));
builder.Services.AddCoinGecko(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- });
+ options => {
+ options.RequestTimeout = TimeSpan.FromSeconds(30);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddCoinGecko(builder.Configuration.GetSection("CoinGecko"));
builder.Services.AddCoinEx(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddCoinEx(builder.Configuration.GetSection("CoinEx"));
builder.Services.AddCryptoCom(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddCryptoCom(builder.Configuration.GetSection("CryptoCom"));
builder.Services.AddGateIo(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddGateIo(builder.Configuration.GetSection("GateIo"));
builder.Services.AddHTX(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddHTX(builder.Configuration.GetSection("HTX"));
builder.Services.AddKraken(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddKraken(builder.Configuration.GetSection("Kraken"));
builder.Services.AddKucoin(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddKucoin(builder.Configuration.GetSection("Kucoin"));
builder.Services.AddMexc(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddMexc(builder.Configuration.GetSection("Mexc"));
builder.Services.AddOKX(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddOKX(builder.Configuration.GetSection("OKX"));
builder.Services.AddWhiteBit(
- restOptions => {
- restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
- },
- socketOptions => {
- socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
- });
+ options => {
+ options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+ options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+ });
+
+// OR
+
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddWhiteBit(builder.Configuration.GetSection("WhiteBit"));