Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Apr 12, 2024
1 parent cedc5f9 commit f793ca0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
6 changes: 4 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,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CryptoExchange.Net" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CryptoExchange.Net\CryptoExchange.Net\CryptoExchange.Net.csproj" />
</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

0 comments on commit f793ca0

Please sign in to comment.