diff --git a/BingX.Net/BingX.Net.xml b/BingX.Net/BingX.Net.xml index 6de8383..4ee0831 100644 --- a/BingX.Net/BingX.Net.xml +++ b/BingX.Net/BingX.Net.xml @@ -248,6 +248,9 @@ + + + @@ -263,12 +266,18 @@ + + + + + + @@ -514,6 +523,9 @@ + + + @@ -1416,7 +1428,7 @@ Get list of contracts - + Filter by symbol name Cancellation token @@ -1425,7 +1437,7 @@ Get order book for a symbol - + Symbol name Number of rows in the book, 5, 10, 20, 50, 100, 500 or 1000 @@ -1435,7 +1447,7 @@ Get list of the most recent trades - + Symbol name Number of results @@ -1455,17 +1467,25 @@ - Get the current funding rate - + Get the current funding rate for a symbol + Symbol Cancellation token + + + Get the current funding rate for all symbols + + + Cancellation token + + Get funding rate history - + Symbol Filter by start time @@ -1477,7 +1497,7 @@ Get kline history - + Symbol Kline interval @@ -1490,7 +1510,7 @@ Get open interest - + Symbol Cancellation token @@ -1498,17 +1518,25 @@ - Get ticker (24h price stats) - + Get ticker (24h price stats) for a symbol + Symbol Cancellation token + + + Get ticker (24h price stats) for all symbols + + + Cancellation token + + Get the best ask and bid info - + Symbol Cancellation token @@ -1517,7 +1545,7 @@ Get mark price klines - + Symbol Kline interval @@ -1529,13 +1557,21 @@ - Get the last trade price - + Get the last trade price for a symbol + Symbol Cancellation token + + + Get the last trade price for all symbols + + + Cancellation token + + BingX futures trading endpoints, placing and mananging orders. @@ -2137,13 +2173,21 @@ - Get the last trade + Get the last trade for a symbol Symbol Cancellation token + + + Get the last trade for all symbols + + + Cancellation token + + Get the current best book prices @@ -4485,6 +4529,11 @@ Last trade info + + + Symbol + + Timestamp diff --git a/BingX.Net/Clients/PerpetualFuturesApi/BingXRestClientPerpetualFuturesApiExchangeData.cs b/BingX.Net/Clients/PerpetualFuturesApi/BingXRestClientPerpetualFuturesApiExchangeData.cs index 72b0d3a..50664ea 100644 --- a/BingX.Net/Clients/PerpetualFuturesApi/BingXRestClientPerpetualFuturesApiExchangeData.cs +++ b/BingX.Net/Clients/PerpetualFuturesApi/BingXRestClientPerpetualFuturesApiExchangeData.cs @@ -117,6 +117,17 @@ public async Task> GetFundingRateAsync(string sy #endregion + #region Get Funding Rates + + /// + public async Task>> GetFundingRatesAsync(CancellationToken ct = default) + { + var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/swap/v2/quote/premiumIndex", BingXExchange.RateLimiter.RestMarket, 1); + return await _baseClient.SendAsync>(request, null, ct).ConfigureAwait(false); + } + + #endregion + #region Get Funding Rate History /// @@ -207,6 +218,17 @@ public async Task> GetTickerAsync(string symbo #endregion + #region Get Ticker + + /// + public async Task>> GetTickersAsync(CancellationToken ct = default) + { + var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/swap/v2/quote/ticker", BingXExchange.RateLimiter.RestMarket, 1); + return await _baseClient.SendAsync>(request, null, ct).ConfigureAwait(false); + } + + #endregion + #region Get Book Ticker /// @@ -229,15 +251,26 @@ public async Task> GetBookTickerAsync(stri /// public async Task> GetLastTradePriceAsync(string symbol, CancellationToken ct = default) { - var parameters = new ParameterCollection() - { - { "symbol", symbol } - }; + var parameters = new ParameterCollection(); + parameters.Add("symbol", symbol); parameters.AddOptionalMillisecondsString("timestamp", DateTime.UtcNow); var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/swap/v1/ticker/price", BingXExchange.RateLimiter.RestMarket, 1); return await _baseClient.SendAsync(request, parameters, ct).ConfigureAwait(false); } #endregion + + #region Get Last Trade Prices + + /// + public async Task>> GetLastTradePricesAsync(CancellationToken ct = default) + { + var parameters = new ParameterCollection(); + parameters.AddOptionalMillisecondsString("timestamp", DateTime.UtcNow); + var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/swap/v1/ticker/price", BingXExchange.RateLimiter.RestMarket, 1); + return await _baseClient.SendAsync>(request, parameters, ct).ConfigureAwait(false); + } + + #endregion } } diff --git a/BingX.Net/Clients/SpotApi/BingXRestClientSpotApiExchangeData.cs b/BingX.Net/Clients/SpotApi/BingXRestClientSpotApiExchangeData.cs index a34f1ea..ecb35d9 100644 --- a/BingX.Net/Clients/SpotApi/BingXRestClientSpotApiExchangeData.cs +++ b/BingX.Net/Clients/SpotApi/BingXRestClientSpotApiExchangeData.cs @@ -158,7 +158,24 @@ public async Task> GetLastTradeAsync(string symbol var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/spot/v1/ticker/price", BingXExchange.RateLimiter.RestMarket, 1, false); var result = await _baseClient.SendAsync>(request, parameters, ct).ConfigureAwait(false); - return result.As(result.Data?.Single().Trades.Single()); + var tradeResult = result.As(result.Data?.Single().Trades.Single()); + if (!tradeResult) + return tradeResult; + + tradeResult.Data.Symbol = symbol; + return tradeResult; + } + + #endregion + + #region Get Last Trades + + /// + public async Task>> GetLastTradesAsync(CancellationToken ct = default) + { + var request = _definitions.GetOrCreate(HttpMethod.Get, "/openApi/spot/v1/ticker/price", BingXExchange.RateLimiter.RestMarket, 1, false); + var result = await _baseClient.SendAsync>(request, null, ct).ConfigureAwait(false); + return result.As>(result.Data?.Select(x => x.Trades.Single() with { Symbol = x.Symbol })); } #endregion diff --git a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiAccount.cs b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiAccount.cs index b343cc4..fc12943 100644 --- a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiAccount.cs +++ b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiAccount.cs @@ -15,7 +15,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount { /// /// Get balance info - /// + /// /// /// Cancellation token /// @@ -44,7 +44,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount /// /// Generate a listen key used for subscribing to user data streams with the socket client - /// + /// /// /// /// @@ -70,7 +70,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount /// /// Get the current margin mode for a symbol - /// + /// /// /// Symbol /// Cancellation token @@ -79,7 +79,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount /// /// Change the margin mode for a symbol - /// + /// /// = /// Symbol /// New margin mode @@ -109,7 +109,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount /// /// Adjust isolated margin for a position - /// + /// /// /// Symbol /// Quantity to adjust with @@ -121,7 +121,7 @@ public interface IBingXRestClientPerpetualFuturesApiAccount /// /// Get current position mode - /// + /// /// /// Symbol /// Cancellation token diff --git a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiExchangeData.cs b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiExchangeData.cs index 23bb894..df41743 100644 --- a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiExchangeData.cs +++ b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiExchangeData.cs @@ -23,7 +23,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get list of contracts - /// + /// /// /// Filter by symbol name /// Cancellation token @@ -32,7 +32,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get order book for a symbol - /// + /// /// /// Symbol name /// Number of rows in the book, 5, 10, 20, 50, 100, 500 or 1000 @@ -42,7 +42,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get list of the most recent trades - /// + /// /// /// Symbol name /// Number of results @@ -62,17 +62,25 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData Task>> GetTradeHistoryAsync(string symbol, long? fromId = null, int? limit = null, CancellationToken ct = default); /// - /// Get the current funding rate - /// + /// Get the current funding rate for a symbol + /// /// /// Symbol /// Cancellation token /// Task> GetFundingRateAsync(string symbol, CancellationToken ct = default); + /// + /// Get the current funding rate for all symbols + /// + /// + /// Cancellation token + /// + Task>> GetFundingRatesAsync(CancellationToken ct = default); + /// /// Get funding rate history - /// + /// /// /// Symbol /// Filter by start time @@ -84,7 +92,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get kline history - /// + /// /// /// Symbol /// Kline interval @@ -97,7 +105,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get open interest - /// + /// /// /// Symbol /// Cancellation token @@ -105,17 +113,25 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData Task> GetOpenInterestAsync(string symbol, CancellationToken ct = default); /// - /// Get ticker (24h price stats) - /// + /// Get ticker (24h price stats) for a symbol + /// /// /// Symbol /// Cancellation token /// Task> GetTickerAsync(string symbol, CancellationToken ct = default); + /// + /// Get ticker (24h price stats) for all symbols + /// + /// + /// Cancellation token + /// + Task>> GetTickersAsync(CancellationToken ct = default); + /// /// Get the best ask and bid info - /// + /// /// /// Symbol /// Cancellation token @@ -124,7 +140,7 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData /// /// Get mark price klines - /// + /// /// /// Symbol /// Kline interval @@ -136,12 +152,20 @@ public interface IBingXRestClientPerpetualFuturesApiExchangeData Task>> GetMarkPriceKlinesAsync(string symbol, KlineInterval interval, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, CancellationToken ct = default); /// - /// Get the last trade price - /// + /// Get the last trade price for a symbol + /// /// /// Symbol /// Cancellation token /// Task> GetLastTradePriceAsync(string symbol, CancellationToken ct = default); + + /// + /// Get the last trade price for all symbols + /// + /// + /// Cancellation token + /// + Task>> GetLastTradePricesAsync(CancellationToken ct = default); } } diff --git a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiTrading.cs b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiTrading.cs index dcd78b8..7392163 100644 --- a/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiTrading.cs +++ b/BingX.Net/Interfaces/Clients/PerpetualFuturesApi/IBingXRestClientPerpetualFuturesApiTrading.cs @@ -15,7 +15,7 @@ public interface IBingXRestClientPerpetualFuturesApiTrading { /// /// Get positions - /// + /// /// /// Symbol /// Cancellation token @@ -24,7 +24,7 @@ public interface IBingXRestClientPerpetualFuturesApiTrading /// /// Place a new test order. Order won't actually get placed - /// + /// /// /// Symbol /// Order side @@ -85,7 +85,7 @@ Task> PlaceTestOrderAsync( /// /// Place a new order - /// + /// /// /// Symbol /// Order side @@ -145,6 +145,7 @@ Task> PlaceOrderAsync( /// /// Place multiple new orders in one go + /// /// /// Orders to place /// Cancellation token @@ -155,7 +156,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Get an order - /// + /// /// /// Symbol /// Order id. Either this or clientOrderId should be provided @@ -166,7 +167,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Cancel an order - /// + /// /// /// Symbol /// Order id. Either this or clientOrderId should be provided @@ -177,7 +178,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Close all positions. Positions will be closed via market order - /// + /// /// /// Only close for a specific symbol /// Cancellation token @@ -186,6 +187,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Cancel multiple orders on a symbol + /// /// /// The symbol /// The ids of orders to cancel @@ -205,7 +207,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Get all open orders - /// + /// /// /// Filter by symbol /// Cancellation token @@ -227,7 +229,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Get closed orders - /// + /// /// /// Filter by symbol /// Filter by order id @@ -240,7 +242,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Get user trade history - /// + /// /// /// Filter by order id /// Filter by start time @@ -251,7 +253,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Cancel all order after a set period. Can be called contineously to maintain a rolling timeout - /// + /// /// /// True to activate the trigger, false to disable the trigger /// Seconds after which to cancel all orders, between 10 and 120 @@ -261,7 +263,7 @@ Task>> PlaceMultipleOrderAsync( /// /// Close a position by its id - /// + /// /// /// The id of the position to close /// Cancellation token diff --git a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiAccount.cs b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiAccount.cs index bee29d9..1f978a5 100644 --- a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiAccount.cs +++ b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiAccount.cs @@ -23,7 +23,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get deposit history - /// + /// /// /// /// @@ -37,7 +37,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get withdrawal history - /// + /// /// /// /// @@ -53,7 +53,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get asset info - /// + /// /// /// /// Cancellation token @@ -77,7 +77,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get deposit addresses - /// + /// /// /// The asset /// Offset @@ -88,7 +88,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Universal transfer - /// + /// /// /// Transfer type /// Asset to transfer @@ -99,7 +99,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get universal transfer history - /// + /// /// /// Transaction type /// Filter by id @@ -113,7 +113,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Transfer internal to an account on the BingX platform - /// + /// /// /// Asset /// Target account type @@ -128,7 +128,7 @@ public interface IBingXRestClientSpotApiAccount /// /// Get internal transfer history - /// + /// /// /// Asset /// Client order id diff --git a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiExchangeData.cs b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiExchangeData.cs index a0feb89..79b99c9 100644 --- a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiExchangeData.cs +++ b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiExchangeData.cs @@ -23,7 +23,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get symbol information - /// + /// /// /// The symbol /// Cancellation token @@ -32,7 +32,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get a list of the most recent trades - /// + /// /// /// The symbol /// Max amount of results @@ -42,7 +42,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get the orderbook for a symbol - /// + /// /// /// The symbol /// Max amount of results @@ -52,7 +52,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get kline/candlestick data - /// + /// /// /// The symbol /// Kline interval @@ -65,7 +65,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get ticker (24h price statistics) - /// + /// /// /// Filter by symbol /// Cancellation token @@ -74,7 +74,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get aggregated order book - /// + /// /// /// Symbol /// Book depth @@ -84,17 +84,25 @@ public interface IBingXRestClientSpotApiExchangeData Task> GetAggregatedOrderBookAsync(string symbol, int limit, int mergeDepth, CancellationToken ct = default); /// - /// Get the last trade - /// + /// Get the last trade for a symbol + /// /// /// Symbol /// Cancellation token /// Task> GetLastTradeAsync(string symbol, CancellationToken ct = default); + /// + /// Get the last trade for all symbols + /// + /// + /// Cancellation token + /// + Task>> GetLastTradesAsync(CancellationToken ct = default); + /// /// Get the current best book prices - /// + /// /// /// Symbol /// Cancellation token @@ -103,7 +111,7 @@ public interface IBingXRestClientSpotApiExchangeData /// /// Get historic trades - /// + /// /// /// Symbol /// Amount or results diff --git a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiTrading.cs b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiTrading.cs index 06f4284..2138fb9 100644 --- a/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiTrading.cs +++ b/BingX.Net/Interfaces/Clients/SpotApi/IBingXRestClientSpotApiTrading.cs @@ -15,7 +15,7 @@ public interface IBingXRestClientSpotApiTrading { /// /// Place a new order - /// + /// /// /// Symbol /// Order side @@ -31,7 +31,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Place multiple orders - /// + /// /// /// Orders to place /// Cancellation token @@ -40,7 +40,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Cancel an active order - /// + /// /// /// Symbol /// Order id, either this or clientOrderId should be provided @@ -51,7 +51,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Cancel multiple active orders - /// + /// /// /// Symbol /// The order ids to cancel @@ -62,7 +62,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Cancel all active orders on a symbol - /// + /// /// /// Symbol /// Cancellation token @@ -71,7 +71,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Cancel all order after a set period. Can be called contineously to maintain a rolling timeout - /// + /// /// /// True to activate the trigger, false to disable the trigger /// Seconds after which to cancel all orders, between 10 and 120 @@ -81,7 +81,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Get an order by orderId or clientOrderId - /// + /// /// /// Symbol /// Order id, either this or clientOrderId should be provided @@ -92,7 +92,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Get open orders - /// + /// /// /// Filter by symbol /// Cancellation token @@ -101,7 +101,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Get order history - /// + /// /// /// Filter by symbol /// Filter by order id @@ -117,7 +117,7 @@ public interface IBingXRestClientSpotApiTrading /// /// Get user trade history - /// + /// /// /// Filter by symbol /// Filter by order id diff --git a/BingX.Net/Objects/Models/BingXLastTrade.cs b/BingX.Net/Objects/Models/BingXLastTrade.cs index 676a063..102e967 100644 --- a/BingX.Net/Objects/Models/BingXLastTrade.cs +++ b/BingX.Net/Objects/Models/BingXLastTrade.cs @@ -17,6 +17,11 @@ internal record BingXLastTradeWrapper /// public record BingXLastTrade { + /// + /// Symbol + /// + public string Symbol { get; set; } = string.Empty; + /// /// Timestamp /// @@ -47,5 +52,6 @@ public record BingXLastTrade /// [JsonPropertyName("type")] public int Type { get; set; } + } }