From f793ca0582e1693256b6009d1d20faec867daaa0 Mon Sep 17 00:00:00 2001 From: JKorf Date: Fri, 12 Apr 2024 16:50:51 +0200 Subject: [PATCH] wip --- ByBit.Net/Bybit.Net.csproj | 6 ++++-- .../CopyTradingApi/BybitRestClientCopyTradingApi.cs | 12 +++++------- .../DerivativesApi/BybitRestClientDerivativesApi.cs | 9 ++++----- .../BybitRestClientDerivativesApiExchangeData.cs | 2 +- .../Clients/SpotApi/BybitRestClientBaseSpotApi.cs | 2 +- ByBit.Net/Clients/V5/BybitRestClientApi.cs | 6 +++--- Bybit.UnitTests/JsonTests.cs | 4 +--- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/ByBit.Net/Bybit.Net.csproj b/ByBit.Net/Bybit.Net.csproj index d8e00d1e..18419f05 100644 --- a/ByBit.Net/Bybit.Net.csproj +++ b/ByBit.Net/Bybit.Net.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;netstandard2.1 enable @@ -52,6 +52,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + + + \ No newline at end of file diff --git a/ByBit.Net/Clients/CopyTradingApi/BybitRestClientCopyTradingApi.cs b/ByBit.Net/Clients/CopyTradingApi/BybitRestClientCopyTradingApi.cs index 60b8098e..4386746c 100644 --- a/ByBit.Net/Clients/CopyTradingApi/BybitRestClientCopyTradingApi.cs +++ b/ByBit.Net/Clients/CopyTradingApi/BybitRestClientCopyTradingApi.cs @@ -78,7 +78,7 @@ internal async Task>> SendRequestWrapperAsync( Dictionary? parameters = null, bool signed = false) where T : class { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As>(default); @@ -93,10 +93,9 @@ internal async Task>> SendRequestListAsync( HttpMethod method, CancellationToken cancellationToken, Dictionary? parameters = null, - bool signed = false, - bool ignoreRatelimit = false) + bool signed = false) { - var result = await base.SendRequestAsync>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As>(default); @@ -111,10 +110,9 @@ internal async Task> SendRequestAsync( HttpMethod method, CancellationToken cancellationToken, Dictionary? parameters = null, - bool signed = false, - bool ignoreRatelimit = false) + bool signed = false) { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As(default); diff --git a/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApi.cs b/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApi.cs index 452ee86f..84d6f0a5 100644 --- a/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApi.cs +++ b/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApi.cs @@ -83,10 +83,9 @@ internal async Task>> SendRequestWrapperAsync( HttpMethod method, CancellationToken cancellationToken, Dictionary? parameters = null, - bool signed = false, - bool ignoreRatelimit = false) where T : class + bool signed = false) where T : class { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As>(default); @@ -104,7 +103,7 @@ internal async Task>> SendRequestListAsync( bool signed = false, bool ignoreRatelimit = false) { - var result = await base.SendRequestAsync>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As>(default); @@ -122,7 +121,7 @@ internal async Task> SendRequestAsync( bool signed = false, bool ignoreRatelimit = false) { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As(default); diff --git a/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApiExchangeData.cs b/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApiExchangeData.cs index 142c6dc3..bb7b31af 100644 --- a/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApiExchangeData.cs +++ b/ByBit.Net/Clients/DerivativesApi/BybitRestClientDerivativesApiExchangeData.cs @@ -253,7 +253,7 @@ public async Task>> GetRisk /// public async Task> GetServerTimeAsync(CancellationToken ct = default) { - var result = await _baseClient.SendRequestWrapperAsync(_baseClient.GetUrl("/v3/public/time"), HttpMethod.Get, ct, null, ignoreRatelimit: true).ConfigureAwait(false); + var result = await _baseClient.SendRequestWrapperAsync(_baseClient.GetUrl("/v3/public/time"), HttpMethod.Get, ct, null).ConfigureAwait(false); if (!result) return result.As(default); diff --git a/ByBit.Net/Clients/SpotApi/BybitRestClientBaseSpotApi.cs b/ByBit.Net/Clients/SpotApi/BybitRestClientBaseSpotApi.cs index fd279e4e..5ce4ceaf 100644 --- a/ByBit.Net/Clients/SpotApi/BybitRestClientBaseSpotApi.cs +++ b/ByBit.Net/Clients/SpotApi/BybitRestClientBaseSpotApi.cs @@ -77,7 +77,7 @@ internal async Task> SendRequestAsync( bool signed = false, bool ignoreRatelimit = false) { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As(default); diff --git a/ByBit.Net/Clients/V5/BybitRestClientApi.cs b/ByBit.Net/Clients/V5/BybitRestClientApi.cs index 259a49f3..7901cf68 100644 --- a/ByBit.Net/Clients/V5/BybitRestClientApi.cs +++ b/ByBit.Net/Clients/V5/BybitRestClientApi.cs @@ -110,7 +110,7 @@ internal async Task>> SendRequestFullResponse Dictionary? parameters = null, bool signed = false) { - return await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false); + return await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); } internal async Task> SendRequestAsync( @@ -120,7 +120,7 @@ internal async Task> SendRequestAsync( Dictionary? parameters = null, bool signed = false) { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.As(default); @@ -137,7 +137,7 @@ internal async Task SendRequestAsync( Dictionary? parameters = null, bool signed = false) { - var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false); + var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false); if (!result) return result.AsDataless(); diff --git a/Bybit.UnitTests/JsonTests.cs b/Bybit.UnitTests/JsonTests.cs index 577ad1c6..7d26d81d 100644 --- a/Bybit.UnitTests/JsonTests.cs +++ b/Bybit.UnitTests/JsonTests.cs @@ -15,11 +15,9 @@ public class JsonTests private JsonToObjectComparer _comparer = new JsonToObjectComparer((json) => TestHelpers.CreateResponseClient(json, x => { x.ApiCredentials = new CryptoExchange.Net.Authentication.ApiCredentials("123", "123"); - x.SpotOptions.RateLimiters = new List(); + x.RatelimiterEnabled = false; x.SpotOptions.OutputOriginalData = true; - x.DerivativesOptions.RateLimiters = new List(); x.DerivativesOptions.OutputOriginalData = true; - x.V5Options.RateLimiters = new List(); x.V5Options.OutputOriginalData = true; }, System.Net.HttpStatusCode.OK));