Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Mar 6, 2024
1 parent 135627c commit 0ddfedd
Show file tree
Hide file tree
Showing 9 changed files with 455 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CryptoExchange.Net.Converters;
using CryptoExchange.Net.Converters.JsonNet;
using CryptoExchange.Net.Objects;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down
190 changes: 187 additions & 3 deletions BingX.Net/BingX.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions BingX.Net/Clients/FuturesApi/BingXSocketClientFuturesApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ internal BingXSocketClientFuturesApi(ILogger logger, BingXSocketOptions options)
protected override AuthenticationProvider CreateAuthenticationProvider(ApiCredentials credentials)
=> new BingXAuthenticationProvider(credentials);

/// <inheritdoc />
public async Task<CallResult<UpdateSubscription>> SubscribeToBingXUpdatesAsync(Action<DataEvent<object>> onMessage, CancellationToken ct = default)
{
var subscription = new BingXSubscription<object>(_logger, "TOOD", "", onMessage, false);
return await SubscribeAsync(subscription, ct).ConfigureAwait(false);
}
///// <inheritdoc />
//public async Task<CallResult<UpdateSubscription>> SubscribeToBingXUpdatesAsync(Action<DataEvent<object>> onMessage, CancellationToken ct = default)
//{
// var subscription = new BingXSubscription<object>(_logger, "TOOD", "", onMessage, false);
// return await SubscribeAsync(subscription, ct).ConfigureAwait(false);
//}

/// <inheritdoc />
public override string? GetListenerIdentifier(IMessageAccessor message)
Expand Down
47 changes: 39 additions & 8 deletions BingX.Net/Clients/SpotApi/BingXRestClientSpotApiExchangeData.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using CryptoExchange.Net;
using CryptoExchange.Net.Converters;
using CryptoExchange.Net.Objects;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using BingX.Net.Enums;
using BingX.Net.Interfaces.Clients.SpotApi;
using BingX.Net.Objects.Models;
using BingX.Net.Objects.Internal;
using CryptoExchange.Net.Converters.SystemTextJson;

namespace BingX.Net.Clients.SpotApi
{
Expand Down Expand Up @@ -56,12 +52,47 @@ public async Task<WebCallResult<IEnumerable<BingXSymbol>>> GetSymbolsAsync(strin
/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BingXTrade>>> GetRecentTradesAsync(string symbol, int? limit = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection();
parameters.AddOptional("symbol", symbol);
var parameters = new ParameterCollection
{
{ "symbol", symbol }
};
parameters.AddOptional("limit", limit);
return await _baseClient.SendRequestInternal<IEnumerable<BingXTrade>>(_baseClient.GetUri("/openApi/spot/v1/market/trades"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
}

#endregion

#region Get Order Book

/// <inheritdoc />
public async Task<WebCallResult<BingXOrderBook>> GetOrderBookAsync(string symbol, int? limit = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection
{
{ "symbol", symbol }
};
parameters.AddOptional("limit", limit);
return await _baseClient.SendRequestInternal<BingXOrderBook>(_baseClient.GetUri("/openApi/spot/v1/market/depth"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
}

#endregion

#region Get Klines

/// <inheritdoc />
public async Task<WebCallResult<IEnumerable<BingXKline>>> GetKlinesAsync(string symbol, KlineInterval interval, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection
{
{ "symbol", symbol },
{ "interval", EnumConverter.GetString(interval) }
};
parameters.AddOptionalMilliseconds("startTime", startTime);
parameters.AddOptionalMilliseconds("endTime", endTime);
parameters.AddOptional("limit", limit);
return await _baseClient.SendRequestInternal<IEnumerable<BingXKline>>(_baseClient.GetUri("/openApi/spot/v1/market/kline"), HttpMethod.Get, ct, parameters).ConfigureAwait(false);
}

#endregion
}
}
Loading

0 comments on commit 0ddfedd

Please sign in to comment.