Skip to content

Commit

Permalink
CryptoExchange.Net v8.0.0, shared interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf authored Sep 27, 2024
1 parent 6c64320 commit 1fb2a1a
Show file tree
Hide file tree
Showing 32 changed files with 2,419 additions and 60 deletions.
2 changes: 1 addition & 1 deletion BingX.Net.UnitTests/Subscriptions/Spot/Ticker.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> { "id": "|1|", "reqType": "sub", "dataType": "BTC-USDT@ticker" }
< { "id": "|1|", "code": 0, "msg": "" }
=
{"code":0,"timestamp":1714641292823,"data":{"e":"24hTicker","E":1714641292821,"s":"BTC-USDT","p":458.94,"P":"0.80%","o":57341.78,"h":59464.03,"l":56633.32,"c":57800.72,"v":2012.11,"q":115994192.64,"O":1714554892821,"C":1714641292821,"A":57800.78,"a":1.62801,"B":57800.27,"b":1.59514}}
{"code":0,"timestamp":1727163468055,"dataType":"BTC-USDT@ticker","data":{"e":"24hTicker","E":1727163468053,"s":"ETH-USDT","p":-2.29,"P":"-0.09%","o":2644.56,"h":2702.79,"l":2609.68,"c":2642.27,"v":13865.37,"q":36747069.40,"O":1727077068053,"C":1727163468053,"A":2642.30,"a":21.552,"B":2642.23,"b":3.136416}}
4 changes: 2 additions & 2 deletions BingX.Net/BingX.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup Label="Deterministic Build" Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -52,6 +52,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CryptoExchange.Net" Version="7.11.2" />
<PackageReference Include="CryptoExchange.Net" Version="8.0.0" />
</ItemGroup>
</Project>
163 changes: 150 additions & 13 deletions BingX.Net/BingX.Net.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
using BingX.Net.Objects.Internal;
using CryptoExchange.Net.Converters.MessageParsing;
using BingX.Net.Interfaces.Clients.PerpetualFuturesApi;
using BingX.Net.Interfaces.Clients.SpotApi;
using CryptoExchange.Net.SharedApis;

namespace BingX.Net.Clients.PerpetualFuturesApi
{
/// <inheritdoc cref="IBingXRestClientPerpetualFuturesApi" />
internal class BingXRestClientPerpetualFuturesApi : RestApiClient, IBingXRestClientPerpetualFuturesApi
internal partial class BingXRestClientPerpetualFuturesApi : RestApiClient, IBingXRestClientPerpetualFuturesApi
{
#region fields
internal static TimeSyncState _timeSyncState = new TimeSyncState("Perpetual Futures Api");
Expand Down Expand Up @@ -53,7 +55,8 @@ internal BingXRestClientPerpetualFuturesApi(ILogger logger, HttpClient? httpClie
#endregion

/// <inheritdoc />
public override string FormatSymbol(string baseAsset, string quoteAsset) => baseAsset.ToUpperInvariant() + "-" + quoteAsset.ToUpperInvariant();
public override string FormatSymbol(string baseAsset, string quoteAsset, TradingMode tradingMode, DateTime? deliverTime = null) => baseAsset.ToUpperInvariant() + "-" + quoteAsset.ToUpperInvariant();
public IBingXRestClientPerpetualFuturesApiShared SharedClient => this;

/// <inheritdoc />
protected override IMessageSerializer CreateSerializer() => new SystemTextJsonMessageSerializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public async Task<WebCallResult<BingXFuturesTradingFees>> GetTradingFeesAsync(Ca
/// <inheritdoc />
public async Task<WebCallResult<string>> StartUserStreamAsync(CancellationToken ct = default)
{
if (_baseClient.AuthenticationProvider == null)
return new WebCallResult<string>(new NoApiCredentialsError());

var request = _definitions.GetOrCreate(HttpMethod.Post, "/openApi/user/auth/userDataStream", BingXExchange.RateLimiter.RestAccount1, 1, false,
limitGuard: new SingleLimitGuard(5, TimeSpan.FromSeconds(1), RateLimitWindowType.Sliding, keySelector: SingleLimitGuard.PerApiKey));
var result = await _baseClient.SendRawAsync<BingXListenKey>(request, null, ct).ConfigureAwait(false);
Expand All @@ -91,6 +94,9 @@ public async Task<WebCallResult<string>> StartUserStreamAsync(CancellationToken
/// <inheritdoc />
public async Task<WebCallResult> KeepAliveUserStreamAsync(string listenKey, CancellationToken ct = default)
{
if (_baseClient.AuthenticationProvider == null)
return new WebCallResult(new NoApiCredentialsError());

var parameters = new ParameterCollection
{
{ "listenKey", listenKey }
Expand All @@ -107,6 +113,9 @@ public async Task<WebCallResult> KeepAliveUserStreamAsync(string listenKey, Canc
/// <inheritdoc />
public async Task<WebCallResult> StopUserStreamAsync(string listenKey, CancellationToken ct = default)
{
if (_baseClient.AuthenticationProvider == null)
return new WebCallResult(new NoApiCredentialsError());

var parameters = new ParameterCollection
{
{ "listenKey", listenKey }
Expand Down
Loading

0 comments on commit 1fb2a1a

Please sign in to comment.