From 22cd2268ab9dd33c96c0ead25467a53778730ae4 Mon Sep 17 00:00:00 2001 From: JKorf Date: Thu, 8 Feb 2024 21:59:53 +0100 Subject: [PATCH] wip --- docs/index.html | 403 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 375 insertions(+), 28 deletions(-) diff --git a/docs/index.html b/docs/index.html index a8f7a5c..6f04a6a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -171,7 +171,8 @@

Installation

-

@@ -352,10 +344,365 @@

Setting options

-

Via dependency injection

-

Via constructor

-

Via SetDefaultOptions

+ Dependency injection +

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.

+ +
+
+
builder.Services.AddBinance(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddBitfinex(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddBitget(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddBybit(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddCoinGecko(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  });
+
+
+
builder.Services.AddCoinEx(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddHuobi(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddKraken(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddKucoin(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddMexc(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddOKX(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+ Client constructor +

When creating a client via the constructor options can be provided as parameters

+ +
+
+
var binanceRestClient = new BinanceRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new BitfinexRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new BitgetRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new BybitRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new CoinGeckoRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new CoinExRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new HuobiRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new KrakenRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new KucoinRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new MexcRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new OKXRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+ + SetDefaultOptions +

The options can be defined in the static SetDefaultOptions method on the client BEFORE creating the client. Any client created after this call will use the specified options

+ +
+
+
BinanceRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new BinanceRestClient();
+
+
+
BitfinexRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new BitfinexRestClient();
+
+
+
BitgetRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new BitgetRestClient();
+
+
+
BybitRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new BybitRestClient();
+
+
+
CoinGeckoRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new CoinGeckoRestClient();
+
+
+
CoinExRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new CoinExRestClient();
+
+
+
HuobiRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new HuobiRestClient();
+
+
+
KrakenRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new KrakenRestClient();
+
+
+
KucoinRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new KucoinRestClient();
+
+
+
MexcRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new MexcRestClient();
+
+
+
OKXRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new OKXRestClient();
+
+
+