Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CryptoExchange.Net ratelimit update #204

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ByBit.Net/Bybit.Net.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -52,6 +52,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CryptoExchange.Net" Version="7.2.0" />
<PackageReference Include="CryptoExchange.Net" Version="7.3.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal async Task<WebCallResult<BybitResult<T>>> SendRequestWrapperAsync<T>(
Dictionary<string, object>? parameters = null,
bool signed = false) where T : class
{
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<BybitResult<T>>(default);

Expand All @@ -93,10 +93,9 @@ internal async Task<WebCallResult<IEnumerable<T>>> SendRequestListAsync<T>(
HttpMethod method,
CancellationToken cancellationToken,
Dictionary<string, object>? parameters = null,
bool signed = false,
bool ignoreRatelimit = false)
bool signed = false)
{
var result = await base.SendRequestAsync<BybitCopyTradingResult<BybitList<T>>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitCopyTradingResult<BybitList<T>>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<IEnumerable<T>>(default);

Expand All @@ -111,10 +110,9 @@ internal async Task<WebCallResult<T>> SendRequestAsync<T>(
HttpMethod method,
CancellationToken cancellationToken,
Dictionary<string, object>? parameters = null,
bool signed = false,
bool ignoreRatelimit = false)
bool signed = false)
{
var result = await base.SendRequestAsync<BybitCopyTradingResult<T>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitCopyTradingResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<T>(default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ internal async Task<WebCallResult<BybitResult<T>>> SendRequestWrapperAsync<T>(
HttpMethod method,
CancellationToken cancellationToken,
Dictionary<string, object>? parameters = null,
bool signed = false,
bool ignoreRatelimit = false) where T : class
bool signed = false) where T : class
{
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<BybitResult<T>>(default);

Expand All @@ -104,7 +103,7 @@ internal async Task<WebCallResult<IEnumerable<T>>> SendRequestListAsync<T>(
bool signed = false,
bool ignoreRatelimit = false)
{
var result = await base.SendRequestAsync<BybitCopyTradingResult<BybitList<T>>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitCopyTradingResult<BybitList<T>>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<IEnumerable<T>>(default);

Expand All @@ -122,7 +121,7 @@ internal async Task<WebCallResult<T>> SendRequestAsync<T>(
bool signed = false,
bool ignoreRatelimit = false)
{
var result = await base.SendRequestAsync<BybitCopyTradingResult<T>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitCopyTradingResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<T>(default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public async Task<WebCallResult<IEnumerable<BybitDerivativesRiskLimit>>> GetRisk
/// <inheritdoc />
public async Task<WebCallResult<DateTime>> GetServerTimeAsync(CancellationToken ct = default)
{
var result = await _baseClient.SendRequestWrapperAsync<BybitDerivativesServerTime>(_baseClient.GetUrl("/v3/public/time"), HttpMethod.Get, ct, null, ignoreRatelimit: true).ConfigureAwait(false);
var result = await _baseClient.SendRequestWrapperAsync<BybitDerivativesServerTime>(_baseClient.GetUrl("/v3/public/time"), HttpMethod.Get, ct, null).ConfigureAwait(false);
if (!result)
return result.As<DateTime>(default);

Expand Down
2 changes: 1 addition & 1 deletion ByBit.Net/Clients/SpotApi/BybitRestClientBaseSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal async Task<WebCallResult<T>> SendRequestAsync<T>(
bool signed = false,
bool ignoreRatelimit = false)
{
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, ignoreRatelimit: ignoreRatelimit).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<T>(default);

Expand Down
6 changes: 3 additions & 3 deletions ByBit.Net/Clients/V5/BybitRestClientApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal async Task<WebCallResult<BybitExtResult<T, U>>> SendRequestFullResponse
Dictionary<string, object>? parameters = null,
bool signed = false)
{
return await base.SendRequestAsync<BybitExtResult<T, U>>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false);
return await base.SendRequestAsync<BybitExtResult<T, U>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
}

internal async Task<WebCallResult<T>> SendRequestAsync<T>(
Expand All @@ -120,7 +120,7 @@ internal async Task<WebCallResult<T>> SendRequestAsync<T>(
Dictionary<string, object>? parameters = null,
bool signed = false)
{
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitResult<T>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.As<T>(default);

Expand All @@ -137,7 +137,7 @@ internal async Task<WebCallResult> SendRequestAsync(
Dictionary<string, object>? parameters = null,
bool signed = false)
{
var result = await base.SendRequestAsync<BybitResult<object>>(uri, method, cancellationToken, parameters, signed).ConfigureAwait(false);
var result = await base.SendRequestAsync<BybitResult<object>>(uri, method, cancellationToken, parameters, signed, requestWeight: 0).ConfigureAwait(false);
if (!result)
return result.AsDataless();

Expand Down
4 changes: 1 addition & 3 deletions Bybit.UnitTests/JsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ public class JsonTests
private JsonToObjectComparer<BybitRestClient> _comparer = new JsonToObjectComparer<BybitRestClient>((json) => TestHelpers.CreateResponseClient(json, x =>
{
x.ApiCredentials = new CryptoExchange.Net.Authentication.ApiCredentials("123", "123");
x.SpotOptions.RateLimiters = new List<IRateLimiter>();
x.RateLimiterEnabled = false;
x.SpotOptions.OutputOriginalData = true;
x.DerivativesOptions.RateLimiters = new List<IRateLimiter>();
x.DerivativesOptions.OutputOriginalData = true;
x.V5Options.RateLimiters = new List<IRateLimiter>();
x.V5Options.OutputOriginalData = true;
},
System.Net.HttpStatusCode.OK));
Expand Down
Loading