Skip to content

Commit

Permalink
CryptoExchange.Net ratelimit update (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf authored Apr 17, 2024
1 parent 2fa5b2d commit 4296e6c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Bitfinex.Net.UnitTests/JsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class JsonTests
private JsonToObjectComparer<IBitfinexRestClient> _comparer = new JsonToObjectComparer<IBitfinexRestClient>((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;
}, System.Net.HttpStatusCode.OK));

Expand Down
5 changes: 3 additions & 2 deletions Bitfinex.Net.UnitTests/TestImplementations/TestSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class TestSocket: IWebsocket
#pragma warning disable 0067
public event Func<Task> OnReconnected;
public event Func<Task> OnReconnecting;
public event Func<int, Task> OnRequestRateLimited;
#pragma warning restore 0067
public event Func<int, Task> OnRequestSent;
public event Action<WebSocketMessageType, ReadOnlyMemory<byte>> OnStreamMessage;
Expand Down Expand Up @@ -50,12 +51,12 @@ public class TestSocket: IWebsocket
public TimeSpan KeepAliveInterval { get; set; }
public Func<Task<Uri>> GetReconnectionUrl { get; set; }

public async Task<bool> ConnectAsync()
public async Task<CallResult> ConnectAsync()
{
await Task.Delay(OpenTime);
Connected = CanConnect;
OnOpen?.Invoke();
return true;
return CanConnect ? new CallResult(null) : new CallResult(new CantConnectError());
}

public void Send(int requestId, string data, int weight)
Expand Down
2 changes: 1 addition & 1 deletion Bitfinex.Net/Bitfinex.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,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 @@ -54,7 +54,7 @@ internal Task<WebCallResult<T>> SendRequestAsync<T>(
CancellationToken cancellationToken,
Dictionary<string, object>? parameters = null,
bool signed = false) where T : class
=> base.SendRequestAsync<T>(uri, method, cancellationToken, parameters, signed);
=> base.SendRequestAsync<T>(uri, method, cancellationToken, parameters, signed, requestWeight: 0);

internal Uri GetUrl(string endpoint, string version)
{
Expand Down
2 changes: 1 addition & 1 deletion Bitfinex.Net/Clients/SpotApi/BitfinexRestClientSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal Task<WebCallResult<T>> SendRequestAsync<T>(
CancellationToken cancellationToken,
Dictionary<string, object>? parameters = null,
bool signed = false) where T : class
=> base.SendRequestAsync<T>(uri, method, cancellationToken, parameters, signed);
=> base.SendRequestAsync<T>(uri, method, cancellationToken, parameters, signed, requestWeight: 0);

internal Uri GetUrl(string endpoint, string version)
{
Expand Down

0 comments on commit 4296e6c

Please sign in to comment.