From 87722f2d289fee457c0b6f2b6f320eb2d2aeb0cf Mon Sep 17 00:00:00 2001 From: JKorf Date: Tue, 26 Mar 2024 09:33:14 +0100 Subject: [PATCH] BingX example docs --- docs/index.html | 58 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index b957e2f..95a7fa1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2326,7 +2326,10 @@ This adds another limit of 10 requests per 2 seconds for the order endpoint in a CryptoRestClient + + @@ -2452,6 +2461,9 @@ await spotClient.GetTickerAsync(spotClient.GetSymbolName("BTC", "USDT"));
await binanceClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT");
+
+
+
await bingXClient.SpotApi.ExchangeData.GetTickersAsync("BTC-USDT");
await bitfinexClient.SpotApi.ExchangeData.GetTickerAsync("tBTCUST");
@@ -2504,6 +2516,9 @@ await spotClient.GetTickerAsync(spotClient.GetSymbolName("BTC", "USDT")); + @@ -2540,6 +2555,9 @@ await spotClient.GetBalancesAsync();
await binanceClient.SpotApi.Account.GetBalancesAsync();
+
+
+
await bingXClient.SpotApi.Account.GetBalancesAsync();
await bitfinexClient.SpotApi.Account.GetBalancesAsync();
@@ -2596,6 +2614,9 @@ var result = await huobiClient.SpotApi.Account.GetBalancesAsync(); + @@ -2632,6 +2653,9 @@ await spotClient.PlaceOrderAsync(spotClient.GetSymbolName("BTC", "USDT"), Common
await binanceClient.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", OrderSide.Buy, SpotOrderType.Limit, 0.1m, price: 50000, timeInForce: TimeInForce.GoodTillCanceled);
+
+
+
await bingXClient.SpotApi.Trading.PlaceOrderAsync("BTC-USDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000);
await bitfinexClient.SpotApi.Trading.PlaceOrderAsync("tBTCUST", OrderSide.Buy, OrderType.Limit, 0.1m, 50000);
@@ -2685,6 +2709,9 @@ var result = await huobiClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCU + @@ -2717,6 +2744,11 @@ var result = await huobiClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCU
await binanceSocketClient.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETHUSDT", data => {
     // Handle update
+});
+
+
+
await bingXSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-USDT", data => {
+    // Handle update
 });
@@ -2786,6 +2818,9 @@ var result = await huobiClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCU + @@ -2830,7 +2865,26 @@ _ = Task.Run(async () => { while (true) { await Task.Delay(Timespan.FromMinutes(30)); - await binanceClient.SpotApi.Account.KeepAliveUserStreamAsync(token.Data); + await binanceClient.SpotApi.Account.KeepAliveUserStreamAsync(listenKey.Data); + } +}); +
+
+
// Retrieve the listen key
+var listenKey = await bingXRestClient.SpotApi.Account.StartUserStreamAsync();
+
+// Subscribe using the key
+await bingXSocketClient.SpotApi.SubscribeToBalanceUpdatesAsync(listenKey.Data, data => {
+    // Handle update
+});
+
+// The listen key will stay valid for 60 minutes, after this no updates will be send anymore
+// To extend the life time of the listen key it is recommended to call the KeepAliveUserStreamAsync method every 30 minutes
+_ = Task.Run(async () => {
+    while (true)
+    {
+        await Task.Delay(Timespan.FromMinutes(30));
+        await bingXClient.SpotApi.Account.KeepAliveUserStreamAsync(listenKey.Data);
     }
 });