diff --git a/docs/Clients.md b/docs/Clients.md index dea379c..a03786b 100644 --- a/docs/Clients.md +++ b/docs/Clients.md @@ -11,15 +11,15 @@ Each implementation generally provides two different clients, which will be the The rest client gives access to the Rest endpoint of the API. Rest endpoints are accessed by sending an HTTP request and receiving a response. The client is split in different sub-clients, which are named API Clients. These API clients are then again split in different topics. Typically a Rest client will look like this: - [ExchangeName]RestClient - - SpotApi - - Account - - ExchangeData - - Trading - - FuturesApi - - Account - - ExchangeData - - Trading - + - SpotApi + - Account + - ExchangeData + - Trading + - FuturesApi + - Account + - ExchangeData + - Trading + This rest client has 2 different API clients, the `SpotApi` and the `FuturesApi`, each offering their own set of endpoints. *Requesting ticker info on the spot API* @@ -64,8 +64,8 @@ When processing the result of a call it should always be checked for success. No var callResult = await kucoinClient.SpotApi.ExchangeData.GetTickersAsync(); if(!callResult.Success) { - Console.WriteLine("Request failed: " + callResult.Error); - return; + Console.WriteLine("Request failed: " + callResult.Error); + return; } Console.WriteLine("Result: " + callResult.Data); @@ -78,8 +78,8 @@ Just like the Rest client is divided in Rest Api clients, the Socket client is d ```csharp - KucoinSocketClient - - SpotStreams - - FuturesStreams + - SpotStreams + - FuturesStreams ``` *Subscribing to updates for all tickers on the Spot Api* @@ -95,7 +95,7 @@ await kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(DataHandle private static void DataHandler(DataEvent updateData) { - // Process updateData + // Process updateData } ``` @@ -103,7 +103,7 @@ private static void DataHandler(DataEvent updateData) ```csharp await kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(updateData => { - // Process updateData + // Process updateData }); ``` @@ -122,16 +122,16 @@ Subscribing to a stream will return a `CallResult` object. T var subscriptionResult = await kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(DataHandler); if(!subscriptionResult.Success) { - Console.WriteLine("Failed to connect: " + subscriptionResult.Error); - return; + Console.WriteLine("Failed to connect: " + subscriptionResult.Error); + return; } subscriptionResult.Data.ConnectionLost += () => { - Console.WriteLine("Connection lost"); + Console.WriteLine("Connection lost"); }; subscriptionResult.Data.ConnectionRestored += (time) => { - Console.WriteLine("Connection restored"); + Console.WriteLine("Connection restored"); }; ``` diff --git a/docs/FAQ.md b/docs/FAQ.md index 0175998..9087c13 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -28,7 +28,7 @@ private void SomeMethod() { var socketClient = new BinanceSocketClient(); socketClient.Spot.SubscribeToOrderBookUpdates("BTCUSDT", data => { - // Handle data + // Handle data }); } ``` @@ -41,7 +41,7 @@ private BinanceSocketClient _socketClient = new BinanceSocketClient(); private void SomeMethod() { _socketClient.Spot.SubscribeToOrderBookUpdates("BTCUSDT", data => { - // Handle data + // Handle data }); } @@ -52,7 +52,7 @@ Yes, generally these are all supported and can be configured by setting the Envi ```csharp var client = new BinanceRestClient(options => { - options.Environment = BinanceEnvironment.Testnet; + options.Environment = BinanceEnvironment.Testnet; }); ``` diff --git a/docs/Logging.md b/docs/Logging.md index efa6326..1f37bf5 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -10,7 +10,7 @@ The library offers extensive logging, which depends on the dotnet `Microsoft.Ext ```csharp IServiceCollection services = new ServiceCollection(); services - .AddBinance() + .AddBinance() .AddLogging(options => { options.SetMinimumLevel(LogLevel.Trace); @@ -66,8 +66,8 @@ IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection.AddBinance(); serviceCollection.AddLogging(options => { - options.SetMinimumLevel(LogLevel.Trace); - options.AddConsole(); + options.SetMinimumLevel(LogLevel.Trace); + options.AddConsole(); }).BuildServiceProvider(); var client = serviceCollection.GetRequiredService(); @@ -91,7 +91,7 @@ By default the `OriginalData` property in the `WebCallResult`/`DataEvent` object ```csharp var client = new BinanceClient(options => { - options.OutputOriginalData = true + options.OutputOriginalData = true }); ``` @@ -103,7 +103,7 @@ var originallyReceivedData = tickerResult.OriginalData; // Socket update await client.SpotStreams.SubscribeToAllTickerUpdatesAsync(update => { - var originallyRecievedData = update.OriginalData; + var originallyRecievedData = update.OriginalData; }); ``` diff --git a/docs/Migration Guide.md b/docs/Migration Guide.md index 94723cf..4b3b51b 100644 --- a/docs/Migration Guide.md +++ b/docs/Migration Guide.md @@ -27,9 +27,9 @@ The HttpClient will now be received by the DI container instead of having to pas ```csharp var client = new BinanceClient(new BinanceClientOptions(){ OutputOriginalData = true, - SpotApiOptions = new RestApiOptions { - BaseAddress = BinanceApiAddresses.TestNet.RestClientAddress - } + SpotApiOptions = new RestApiOptions { + BaseAddress = BinanceApiAddresses.TestNet.RestClientAddress + } // Other options }); ``` @@ -38,7 +38,7 @@ var client = new BinanceClient(new BinanceClientOptions(){ ```csharp var client = new BinanceClient(options => { options.OutputOriginalData = true; - options.Environment = BinanceEnvironment.Testnet; + options.Environment = BinanceEnvironment.Testnet; // Other options }); ``` @@ -53,10 +53,10 @@ With the change in options providing the DI extension methods for the IServiceCo ```csharp builder.Services.AddKucoin((restOpts, socketOpts) => { - restOpts.LogLevel = LogLevel.Debug; - restOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS"); - socketOpts.LogLevel = LogLevel.Debug; - socketOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS"); + restOpts.LogLevel = LogLevel.Debug; + restOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS"); + socketOpts.LogLevel = LogLevel.Debug; + socketOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS"); }, ServiceLifetime.Singleton); ``` diff --git a/docs/Options.md b/docs/Options.md index a4c9273..eb67426 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -12,8 +12,8 @@ Each implementation can be configured using client options. There are 2 ways to BinanceClient.SetDefaultOptions(options => { - options.OutputOriginalData = true; - options.ApiCredentials = new ApiCredentials("KEY", "SECRET"); + options.OutputOriginalData = true; + options.ApiCredentials = new ApiCredentials("KEY", "SECRET"); }); ``` @@ -23,8 +23,8 @@ BinanceClient.SetDefaultOptions(options => var client = new BinanceClient(options => { - options.OutputOriginalData = true; - options.ApiCredentials = new ApiCredentials("KEY", "SECRET"); + options.OutputOriginalData = true; + options.ApiCredentials = new ApiCredentials("KEY", "SECRET"); }); ``` @@ -34,12 +34,12 @@ When calling `SetDefaultOptions` each client created after that will use the opt BinanceClient.SetDefaultOptions(options => { - options.OutputOriginalData = true; + options.OutputOriginalData = true; }); var client = new BinanceClient(options => { - options.OutputOriginalData = false; + options.OutputOriginalData = false; }); ``` @@ -54,8 +54,8 @@ The options are divided in two categories. The basic options, which will apply t var client = new BinanceRestClient(options => { - options.ApiCredentials = new ApiCredentials("GENERAL-KEY", "GENERAL-SECRET"), - options.SpotOptions.ApiCredentials = new ApiCredentials("SPOT-KEY", "SPOT-SECRET"); + options.ApiCredentials = new ApiCredentials("GENERAL-KEY", "GENERAL-SECRET"), + options.SpotOptions.ApiCredentials = new ApiCredentials("SPOT-KEY", "SPOT-SECRET"); }); ``` diff --git a/docs/Orderbooks.md b/docs/Orderbooks.md index 82852d7..a529bc9 100644 --- a/docs/Orderbooks.md +++ b/docs/Orderbooks.md @@ -18,15 +18,15 @@ book.OnStatusChange += (oldState, newState) => Console.WriteLine($"State changed var startResult = await book.StartAsync(); if (!startResult.Success) { - Console.WriteLine("Failed to start order book: " + startResult.Error); - return; + Console.WriteLine("Failed to start order book: " + startResult.Error); + return; } while(true) { - Console.Clear(); - Console.WriteLine(book.ToString(3); - await Task.Delay(500); + Console.Clear(); + Console.WriteLine(book.ToString(3); + await Task.Delay(500); } ``` diff --git a/docs/RateLimiter.md b/docs/RateLimiter.md index a968f02..7f7f591 100644 --- a/docs/RateLimiter.md +++ b/docs/RateLimiter.md @@ -13,12 +13,12 @@ A rate limiter can be configured in the options like so: ```csharp new ClientOptions { - RateLimitingBehaviour = RateLimitingBehaviour.Wait, - RateLimiters = new List - { - new RateLimiter() - .AddTotalRateLimit(50, TimeSpan.FromSeconds(10)) - } + RateLimitingBehaviour = RateLimitingBehaviour.Wait, + RateLimiters = new List + { + new RateLimiter() + .AddTotalRateLimit(50, TimeSpan.FromSeconds(10)) + } } ``` @@ -26,8 +26,8 @@ This will add a rate limiter for 50 requests per 10 seconds. A rate limiter can have multiple limits: ```csharp new RateLimiter() - .AddTotalRateLimit(50, TimeSpan.FromSeconds(10)) - .AddEndpointLimit("/api/order", 10, TimeSpan.FromSeconds(2)) + .AddTotalRateLimit(50, TimeSpan.FromSeconds(10)) + .AddEndpointLimit("/api/order", 10, TimeSpan.FromSeconds(2)) ``` This adds another limit of 10 requests per 2 seconds in addition to the 50 requests per 10 seconds limit. These are the available rate limit configurations: