Skip to content

Commit

Permalink
Merge branch 'cryptoexchange-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Aug 25, 2023
2 parents dfee50f + 5dc67ef commit 4724bc8
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 54 deletions.
12 changes: 7 additions & 5 deletions ByBit.Net/Bybit.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<PropertyGroup>
<PackageId>Bybit.Net</PackageId>
<Authors>JKorf</Authors>
<PackageVersion>3.0.6</PackageVersion>
<AssemblyVersion>3.0.6</AssemblyVersion>
<FileVersion>3.0.6</FileVersion>
<PackageVersion>3.0.7</PackageVersion>
<AssemblyVersion>3.0.7</AssemblyVersion>
<FileVersion>3.0.7</FileVersion>
<Description>Bybit.Net is a .Net wrapper for the Bybit API. It includes all features the API provides, REST API and Websocket, using clear and readable objects including but not limited to Reading market info, Placing and managing orders and Reading balances and funds</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>Bybit Bybit.Net C# .Net CryptoCurrency Exchange API wrapper</PackageTags>
Expand All @@ -20,7 +20,7 @@
<PackageIcon>icon.png</PackageIcon>
<NeutralLanguage>en</NeutralLanguage>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes>3.0.6 - Changed V5 API body content type from formdata to json</PackageReleaseNotes>
<PackageReleaseNotes>3.0.7 - Updated CryptoExchange.Net</PackageReleaseNotes>7
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>Bybit.Net.xml</DocumentationFile>
Expand All @@ -42,7 +42,6 @@
<None Include="Icon\icon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CryptoExchange.Net" Version="6.0.0" />
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -52,4 +51,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CryptoExchange.Net" Version="6.1.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -275,7 +275,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -315,7 +315,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -273,7 +273,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -308,7 +308,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -524,7 +524,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
4 changes: 2 additions & 2 deletions ByBit.Net/Clients/SpotApi/BybitSocketClientBaseSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -192,7 +192,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
}

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (!isCheckable)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -473,7 +473,7 @@ protected override async Task<bool> UnsubscribeAsync(SocketConnection connection
var message = new BybitRequestMessage { Operation = "unsubscribe", Parameters = requestParams };

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
8 changes: 4 additions & 4 deletions ByBit.Net/Clients/V5/BybitSocketClientBaseApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToTradeUpdatesAsync(I

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => "publicTrade." + s).ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => "publicTrade." + s).ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToOrderbookUpdatesAsy

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"orderbook.{depth}.{s}").ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"orderbook.{depth}.{s}").ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}

Expand Down Expand Up @@ -126,7 +126,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToKlineUpdatesAsync(I

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"kline.{EnumConverter.GetString(interval)}.{s}").ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"kline.{EnumConverter.GetString(interval)}.{s}").ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToLiquidationUpdatesA

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"liquidation.{s}").ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"liquidation.{s}").ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}
}
Expand Down
10 changes: 5 additions & 5 deletions ByBit.Net/Clients/V5/BybitSocketClientLinearApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal BybitSocketClientLinearApi(ILogger log, BybitSocketOptions options)
{
SendPeriodic("Ping", options.V5Options.PingInterval, (connection) =>
{
return new BybitV5RequestMessage("ping", Array.Empty<object>(), NextId().ToString());
return new BybitV5RequestMessage("ping", Array.Empty<object>(), ExchangeHelpers.NextId().ToString());
});
AddGenericHandler("Heartbeat", (evnt) => { });
}
Expand Down Expand Up @@ -59,7 +59,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToTickerUpdatesAsync(

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"tickers.{s}").ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"tickers.{s}").ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}

Expand All @@ -86,7 +86,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -196,10 +196,10 @@ protected override bool MessageMatchesHandler(SocketConnection socketConnection,
protected override async Task<bool> UnsubscribeAsync(SocketConnection connection, SocketSubscription subscriptionToUnsub)
{
var requestParams = ((BybitV5RequestMessage)subscriptionToUnsub.Request!).Parameters;
var message = new BybitV5RequestMessage("unsubscribe", requestParams, NextId().ToString());
var message = new BybitV5RequestMessage("unsubscribe", requestParams, ExchangeHelpers.NextId().ToString());

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
10 changes: 5 additions & 5 deletions ByBit.Net/Clients/V5/BybitSocketClientOptionApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal BybitSocketClientOptionApi(ILogger log, BybitSocketOptions options)
{
SendPeriodic("Ping", options.V5Options.PingInterval, (connection) =>
{
return new BybitV5RequestMessage("ping", Array.Empty<object>(), NextId().ToString());
return new BybitV5RequestMessage("ping", Array.Empty<object>(), ExchangeHelpers.NextId().ToString());
});
AddGenericHandler("Heartbeat", (evnt) => { });
}
Expand Down Expand Up @@ -55,7 +55,7 @@ public async Task<CallResult<UpdateSubscription>> SubscribeToTickerUpdatesAsync(

return await SubscribeAsync(
BaseAddress + _baseEndpoint,
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"tickers.{s}").ToArray(), NextId().ToString()),
new BybitV5RequestMessage("subscribe", symbols.Select(s => $"tickers.{s}").ToArray(), ExchangeHelpers.NextId().ToString()),
null, false, internalHandler, ct).ConfigureAwait(false);
}

Expand All @@ -82,7 +82,7 @@ protected override async Task<CallResult<bool>> AuthenticateSocketAsync(SocketCo

var result = false;
var error = "unspecified error";
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, data =>
await socketConnection.SendAndWaitAsync(authRequest, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down Expand Up @@ -201,10 +201,10 @@ protected override bool MessageMatchesHandler(SocketConnection socketConnection,
protected override async Task<bool> UnsubscribeAsync(SocketConnection connection, SocketSubscription subscriptionToUnsub)
{
var requestParams = ((BybitV5RequestMessage)subscriptionToUnsub.Request!).Parameters;
var message = new BybitV5RequestMessage("unsubscribe", requestParams, NextId().ToString());
var message = new BybitV5RequestMessage("unsubscribe", requestParams, ExchangeHelpers.NextId().ToString());

var result = false;
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, data =>
await connection.SendAndWaitAsync(message, ClientOptions.RequestTimeout, null, 1, data =>
{
if (data.Type != JTokenType.Object)
return false;
Expand Down
Loading

0 comments on commit 4724bc8

Please sign in to comment.