ccxt 4.5.22 → 4.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/bullish.js +11 -0
  5. package/dist/cjs/src/base/Exchange.js +3 -2
  6. package/dist/cjs/src/base/ws/WsClient.js +15 -0
  7. package/dist/cjs/src/binance.js +159 -36
  8. package/dist/cjs/src/bingx.js +2 -1
  9. package/dist/cjs/src/bitmart.js +1 -0
  10. package/dist/cjs/src/bullish.js +2919 -0
  11. package/dist/cjs/src/bybit.js +34 -37
  12. package/dist/cjs/src/gate.js +2 -2
  13. package/dist/cjs/src/htx.js +4 -1
  14. package/dist/cjs/src/hyperliquid.js +115 -12
  15. package/dist/cjs/src/kucoin.js +22 -3
  16. package/dist/cjs/src/mexc.js +7 -0
  17. package/dist/cjs/src/okx.js +117 -63
  18. package/dist/cjs/src/paradex.js +78 -3
  19. package/dist/cjs/src/pro/binance.js +131 -29
  20. package/dist/cjs/src/pro/bullish.js +781 -0
  21. package/dist/cjs/src/pro/coinbase.js +2 -2
  22. package/dist/cjs/src/pro/hyperliquid.js +75 -15
  23. package/dist/cjs/src/pro/upbit.js +28 -82
  24. package/js/ccxt.d.ts +8 -2
  25. package/js/ccxt.js +6 -2
  26. package/js/src/abstract/binance.d.ts +1 -0
  27. package/js/src/abstract/binancecoinm.d.ts +1 -0
  28. package/js/src/abstract/binanceus.d.ts +1 -0
  29. package/js/src/abstract/binanceusdm.d.ts +1 -0
  30. package/js/src/abstract/bingx.d.ts +1 -0
  31. package/js/src/abstract/bullish.d.ts +65 -0
  32. package/js/src/abstract/bullish.js +5 -0
  33. package/js/src/abstract/kucoin.d.ts +15 -0
  34. package/js/src/abstract/kucoinfutures.d.ts +15 -0
  35. package/js/src/abstract/mexc.d.ts +7 -0
  36. package/js/src/abstract/myokx.d.ts +90 -39
  37. package/js/src/abstract/okx.d.ts +90 -39
  38. package/js/src/abstract/okxus.d.ts +90 -39
  39. package/js/src/base/Exchange.d.ts +1 -1
  40. package/js/src/base/Exchange.js +3 -2
  41. package/js/src/base/ws/Client.d.ts +1 -0
  42. package/js/src/base/ws/WsClient.js +15 -0
  43. package/js/src/binance.d.ts +14 -5
  44. package/js/src/binance.js +159 -36
  45. package/js/src/bingx.js +2 -1
  46. package/js/src/bitmart.js +1 -0
  47. package/js/src/bullish.d.ts +446 -0
  48. package/js/src/bullish.js +2912 -0
  49. package/js/src/bybit.js +34 -37
  50. package/js/src/gate.js +2 -2
  51. package/js/src/htx.js +4 -1
  52. package/js/src/hyperliquid.d.ts +24 -0
  53. package/js/src/hyperliquid.js +115 -12
  54. package/js/src/kucoin.js +22 -3
  55. package/js/src/mexc.js +7 -0
  56. package/js/src/okx.js +117 -63
  57. package/js/src/paradex.d.ts +15 -1
  58. package/js/src/paradex.js +78 -3
  59. package/js/src/pro/binance.d.ts +7 -0
  60. package/js/src/pro/binance.js +131 -29
  61. package/js/src/pro/bullish.d.ts +108 -0
  62. package/js/src/pro/bullish.js +774 -0
  63. package/js/src/pro/coinbase.js +2 -2
  64. package/js/src/pro/hyperliquid.d.ts +13 -1
  65. package/js/src/pro/hyperliquid.js +75 -15
  66. package/js/src/pro/upbit.d.ts +0 -1
  67. package/js/src/pro/upbit.js +28 -82
  68. package/package.json +2 -2
package/dist/cjs/ccxt.js CHANGED
@@ -42,6 +42,7 @@ var btcalpha = require('./src/btcalpha.js');
42
42
  var btcbox = require('./src/btcbox.js');
43
43
  var btcmarkets = require('./src/btcmarkets.js');
44
44
  var btcturk = require('./src/btcturk.js');
45
+ var bullish = require('./src/bullish.js');
45
46
  var bybit = require('./src/bybit.js');
46
47
  var cex = require('./src/cex.js');
47
48
  var coinbase = require('./src/coinbase.js');
@@ -139,6 +140,7 @@ var bittrade$1 = require('./src/pro/bittrade.js');
139
140
  var bitvavo$1 = require('./src/pro/bitvavo.js');
140
141
  var blockchaincom$1 = require('./src/pro/blockchaincom.js');
141
142
  var blofin$1 = require('./src/pro/blofin.js');
143
+ var bullish$1 = require('./src/pro/bullish.js');
142
144
  var bybit$1 = require('./src/pro/bybit.js');
143
145
  var cex$1 = require('./src/pro/cex.js');
144
146
  var coinbase$1 = require('./src/pro/coinbase.js');
@@ -194,7 +196,7 @@ var xt$1 = require('./src/pro/xt.js');
194
196
 
195
197
  //-----------------------------------------------------------------------------
196
198
  // this is updated by vss.js when building
197
- const version = '4.5.22';
199
+ const version = '4.5.23';
198
200
  Exchange["default"].ccxtVersion = version;
199
201
  const exchanges = {
200
202
  'alpaca': alpaca["default"],
@@ -231,6 +233,7 @@ const exchanges = {
231
233
  'btcbox': btcbox["default"],
232
234
  'btcmarkets': btcmarkets["default"],
233
235
  'btcturk': btcturk["default"],
236
+ 'bullish': bullish["default"],
234
237
  'bybit': bybit["default"],
235
238
  'cex': cex["default"],
236
239
  'coinbase': coinbase["default"],
@@ -330,6 +333,7 @@ const pro = {
330
333
  'bitvavo': bitvavo$1["default"],
331
334
  'blockchaincom': blockchaincom$1["default"],
332
335
  'blofin': blofin$1["default"],
336
+ 'bullish': bullish$1["default"],
333
337
  'bybit': bybit$1["default"],
334
338
  'cex': cex$1["default"],
335
339
  'coinbase': coinbase$1["default"],
@@ -468,6 +472,7 @@ exports.btcalpha = btcalpha["default"];
468
472
  exports.btcbox = btcbox["default"];
469
473
  exports.btcmarkets = btcmarkets["default"];
470
474
  exports.btcturk = btcturk["default"];
475
+ exports.bullish = bullish["default"];
471
476
  exports.bybit = bybit["default"];
472
477
  exports.cex = cex["default"];
473
478
  exports.coinbase = coinbase["default"];
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange$1 = require('../base/Exchange.js');
6
+
7
+ // -------------------------------------------------------------------------------
8
+ class Exchange extends Exchange$1["default"] {
9
+ }
10
+
11
+ exports["default"] = Exchange;
@@ -4826,7 +4826,8 @@ class Exchange {
4826
4826
  if (e instanceof errors.OperationFailed) {
4827
4827
  if (i < retries) {
4828
4828
  if (this.verbose) {
4829
- this.log('Request failed with the error: ' + e.toString() + ', retrying ' + (i + 1).toString() + ' of ' + retries.toString() + '...');
4829
+ const index = i + 1;
4830
+ this.log('Request failed with the error: ' + e.toString() + ', retrying ' + index.toString() + ' of ' + retries.toString() + '...');
4830
4831
  }
4831
4832
  if ((retryDelay !== undefined) && (retryDelay !== 0)) {
4832
4833
  await this.sleep(retryDelay);
@@ -5073,7 +5074,7 @@ class Exchange {
5073
5074
  }
5074
5075
  return this.safeMarketStructure({ 'symbol': marketId, 'marketId': marketId });
5075
5076
  }
5076
- marketOrNull(symbol) {
5077
+ marketOrNull(symbol = undefined) {
5077
5078
  if (symbol === undefined) {
5078
5079
  return undefined;
5079
5080
  }
@@ -29,6 +29,21 @@ class WsClient extends Client["default"] {
29
29
  }
30
30
  this.connectionStarted = time.milliseconds();
31
31
  this.setConnectionTimeout();
32
+ const connectionHeaders = {};
33
+ if (this.cookies !== undefined) {
34
+ let cookieStr = '';
35
+ const cookiesKeys = Object.keys(this.cookies);
36
+ for (let i = 0; i < cookiesKeys.length; i++) {
37
+ const key = cookiesKeys[i];
38
+ const value = this.cookies[key];
39
+ cookieStr += key + '=' + value;
40
+ if (i < cookiesKeys.length - 1) {
41
+ cookieStr += '; ';
42
+ }
43
+ }
44
+ connectionHeaders['Cookie'] = cookieStr;
45
+ this.options['headers'] = Object.assign(this.options['headers'] || {}, connectionHeaders);
46
+ }
32
47
  if (platform.isNode) {
33
48
  this.connection = new WebSocketPlatform(this.url, this.protocols, this.options);
34
49
  }
@@ -826,6 +826,7 @@ class binance extends binance$1["default"] {
826
826
  'time': 1,
827
827
  'exchangeInfo': 1,
828
828
  'depth': { 'cost': 2, 'byLimit': [[50, 2], [100, 5], [500, 10], [1000, 20]] },
829
+ 'rpiDepth': 20,
829
830
  'trades': 5,
830
831
  'historicalTrades': 20,
831
832
  'aggTrades': 20,
@@ -903,8 +904,9 @@ class binance extends binance$1["default"] {
903
904
  'symbolConfig': 5,
904
905
  'accountConfig': 5,
905
906
  'convert/orderStatus': 5,
907
+ // conditional orders
906
908
  'algoOrder': 1,
907
- 'openAlgoOrders': 1,
909
+ 'openAlgoOrders': { 'cost': 1, 'noSymbol': 40 },
908
910
  'allAlgoOrders': 5,
909
911
  },
910
912
  'post': {
@@ -924,6 +926,7 @@ class binance extends binance$1["default"] {
924
926
  'feeBurn': 1,
925
927
  'convert/getQuote': 200,
926
928
  'convert/acceptQuote': 20,
929
+ // conditional orders
927
930
  'algoOrder': 1,
928
931
  },
929
932
  'put': {
@@ -936,6 +939,7 @@ class binance extends binance$1["default"] {
936
939
  'order': 1,
937
940
  'allOpenOrders': 1,
938
941
  'listenKey': 1,
942
+ // conditional orders
939
943
  'algoOrder': 1,
940
944
  'algoOpenOrders': 1,
941
945
  },
@@ -3991,13 +3995,15 @@ class binance extends binance$1["default"] {
3991
3995
  * @method
3992
3996
  * @name binance#fetchOrderBook
3993
3997
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
3994
- * @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book // spot
3995
- * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book // swap
3996
- * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Order-Book // future
3997
- * @see https://developers.binance.com/docs/derivatives/option/market-data/Order-Book // option
3998
+ * @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book // spot
3999
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book // swap
4000
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book-RPI // swap rpi
4001
+ * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Order-Book // future
4002
+ * @see https://developers.binance.com/docs/derivatives/option/market-data/Order-Book // option
3998
4003
  * @param {string} symbol unified symbol of the market to fetch the order book for
3999
4004
  * @param {int} [limit] the maximum amount of order book entries to return
4000
4005
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4006
+ * @param {boolean} [params.rpi] *future only* set to true to use the RPI endpoint
4001
4007
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
4002
4008
  */
4003
4009
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
@@ -4014,7 +4020,16 @@ class binance extends binance$1["default"] {
4014
4020
  response = await this.eapiPublicGetDepth(this.extend(request, params));
4015
4021
  }
4016
4022
  else if (market['linear']) {
4017
- response = await this.fapiPublicGetDepth(this.extend(request, params));
4023
+ const rpi = this.safeValue(params, 'rpi', false);
4024
+ params = this.omit(params, 'rpi');
4025
+ if (rpi) {
4026
+ // rpi limit only supports 1000
4027
+ request['limit'] = 1000;
4028
+ response = await this.fapiPublicGetRpiDepth(this.extend(request, params));
4029
+ }
4030
+ else {
4031
+ response = await this.fapiPublicGetDepth(this.extend(request, params));
4032
+ }
4018
4033
  }
4019
4034
  else if (market['inverse']) {
4020
4035
  response = await this.dapiPublicGetDepth(this.extend(request, params));
@@ -5636,7 +5651,10 @@ class binance extends binance$1["default"] {
5636
5651
  'NEW': 'open',
5637
5652
  'PARTIALLY_FILLED': 'open',
5638
5653
  'ACCEPTED': 'open',
5654
+ 'TRIGGERING': 'open',
5639
5655
  'FILLED': 'closed',
5656
+ 'TRIGGERED': 'closed',
5657
+ 'FINISHED': 'closed',
5640
5658
  'CANCELED': 'canceled',
5641
5659
  'CANCELLED': 'canceled',
5642
5660
  'PENDING_CANCEL': 'canceling',
@@ -6129,12 +6147,52 @@ class binance extends binance$1["default"] {
6129
6147
  // "priceProtect": false
6130
6148
  // }
6131
6149
  //
6150
+ // createOrder, fetchOrder, fetchOpenOrders, fetchOrders, cancelOrderWs, createOrderWs: linear swap conditional order
6151
+ //
6152
+ // {
6153
+ // "algoId": 3358,
6154
+ // "clientAlgoId": "yT58zmV3DSzMBQxc5tAJXU",
6155
+ // "algoType": "CONDITIONAL",
6156
+ // "orderType": "STOP",
6157
+ // "symbol": "BTCUSDT",
6158
+ // "side": "BUY",
6159
+ // "positionSide": "BOTH",
6160
+ // "timeInForce": "GTC",
6161
+ // "quantity": "0.002",
6162
+ // "algoStatus": "NEW",
6163
+ // "triggerPrice": "100000.00",
6164
+ // "price": "102000.00",
6165
+ // "icebergQuantity": null,
6166
+ // "selfTradePreventionMode": "EXPIRE_MAKER",
6167
+ // "workingType": "CONTRACT_PRICE",
6168
+ // "priceMatch": "NONE",
6169
+ // "closePosition": false,
6170
+ // "priceProtect": false,
6171
+ // "reduceOnly": false,
6172
+ // "createTime": 1763458576201,
6173
+ // "updateTime": 1763458576201,
6174
+ // "triggerTime": 0,
6175
+ // "goodTillDate": 0
6176
+ // }
6177
+ //
6178
+ // cancelOrder: linear swap conditional
6179
+ //
6180
+ // {
6181
+ // "algoId": 3358,
6182
+ // "clientAlgoId": "yT58zmV3DSzMBQxc5tAJXU",
6183
+ // "code": "200",
6184
+ // "msg": "success"
6185
+ // }
6186
+ //
6132
6187
  const code = this.safeString(order, 'code');
6133
6188
  if (code !== undefined) {
6134
6189
  // cancelOrders/createOrders might have a partial success
6135
- return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
6190
+ const msg = this.safeString(order, 'msg');
6191
+ if ((code !== '200') && !((msg === 'success') || (msg === 'The operation of cancel all open order is done.'))) {
6192
+ return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
6193
+ }
6136
6194
  }
6137
- const status = this.parseOrderStatus(this.safeString2(order, 'status', 'strategyStatus'));
6195
+ const status = this.parseOrderStatus(this.safeStringN(order, ['status', 'strategyStatus', 'algoStatus']));
6138
6196
  const marketId = this.safeString(order, 'symbol');
6139
6197
  const isContract = ('positionSide' in order) || ('cumQuote' in order);
6140
6198
  const marketType = isContract ? 'contract' : 'spot';
@@ -6174,7 +6232,7 @@ class binance extends binance$1["default"] {
6174
6232
  if (type === 'limit_maker') {
6175
6233
  type = 'limit';
6176
6234
  }
6177
- const stopPriceString = this.safeString(order, 'stopPrice');
6235
+ const stopPriceString = this.safeString2(order, 'stopPrice', 'triggerPrice');
6178
6236
  const triggerPrice = this.parseNumber(this.omitZero(stopPriceString));
6179
6237
  const feeCost = this.safeNumber(order, 'fee');
6180
6238
  let fee = undefined;
@@ -6187,8 +6245,8 @@ class binance extends binance$1["default"] {
6187
6245
  }
6188
6246
  return this.safeOrder({
6189
6247
  'info': order,
6190
- 'id': this.safeString2(order, 'strategyId', 'orderId'),
6191
- 'clientOrderId': this.safeString2(order, 'clientOrderId', 'newClientStrategyId'),
6248
+ 'id': this.safeStringN(order, ['strategyId', 'orderId', 'algoId']),
6249
+ 'clientOrderId': this.safeStringN(order, ['clientOrderId', 'newClientStrategyId', 'clientAlgoId']),
6192
6250
  'timestamp': timestamp,
6193
6251
  'datetime': this.iso8601(timestamp),
6194
6252
  'lastTradeTimestamp': lastTradeTimestamp,
@@ -6309,6 +6367,7 @@ class binance extends binance$1["default"] {
6309
6367
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
6310
6368
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order
6311
6369
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order
6370
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Algo-Order
6312
6371
  * @param {string} symbol unified symbol of the market to create an order in
6313
6372
  * @param {string} type 'market' or 'limit' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP'
6314
6373
  * @param {string} side 'buy' or 'sell'
@@ -6377,7 +6436,13 @@ class binance extends binance$1["default"] {
6377
6436
  }
6378
6437
  }
6379
6438
  else {
6380
- response = await this.fapiPrivatePostOrder(request);
6439
+ if (isConditional) {
6440
+ request['algoType'] = 'CONDITIONAL';
6441
+ response = await this.fapiPrivatePostAlgoOrder(request);
6442
+ }
6443
+ else {
6444
+ response = await this.fapiPrivatePostOrder(request);
6445
+ }
6381
6446
  }
6382
6447
  }
6383
6448
  else if (market['inverse']) {
@@ -6427,7 +6492,7 @@ class binance extends binance$1["default"] {
6427
6492
  */
6428
6493
  const market = this.market(symbol);
6429
6494
  const marketType = this.safeString(params, 'type', market['type']);
6430
- const clientOrderId = this.safeString2(params, 'newClientOrderId', 'clientOrderId');
6495
+ const clientOrderId = this.safeStringN(params, ['clientAlgoId', 'newClientOrderId', 'clientOrderId']);
6431
6496
  const initialUppercaseType = type.toUpperCase();
6432
6497
  const isMarketOrder = initialUppercaseType === 'MARKET';
6433
6498
  const isLimitOrder = initialUppercaseType === 'LIMIT';
@@ -6541,7 +6606,10 @@ class binance extends binance$1["default"] {
6541
6606
  }
6542
6607
  }
6543
6608
  }
6544
- const clientOrderIdRequest = isPortfolioMarginConditional ? 'newClientStrategyId' : 'newClientOrderId';
6609
+ let clientOrderIdRequest = isPortfolioMarginConditional ? 'newClientStrategyId' : 'newClientOrderId';
6610
+ if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
6611
+ clientOrderIdRequest = 'clientAlgoId';
6612
+ }
6545
6613
  if (clientOrderId === undefined) {
6546
6614
  const broker = this.safeDict(this.options, 'broker', {});
6547
6615
  const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-TKT5PX2F';
@@ -6719,7 +6787,12 @@ class binance extends binance$1["default"] {
6719
6787
  }
6720
6788
  }
6721
6789
  if (stopPrice !== undefined) {
6722
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
6790
+ if (market['linear'] && market['swap'] && !isPortfolioMargin) {
6791
+ request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
6792
+ }
6793
+ else {
6794
+ request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
6795
+ }
6723
6796
  }
6724
6797
  }
6725
6798
  if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined) && (this.safeString(request, 'timeInForce') === undefined)) {
@@ -6831,11 +6904,13 @@ class binance extends binance$1["default"] {
6831
6904
  * @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order
6832
6905
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
6833
6906
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
6907
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Algo-Order
6834
6908
  * @param {string} id the order id
6835
6909
  * @param {string} symbol unified symbol of the market the order was made in
6836
6910
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6837
6911
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
6838
6912
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch an order in a portfolio margin account
6913
+ * @param {boolean} [params.trigger] set to true if you would like to fetch a trigger or conditional order
6839
6914
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
6840
6915
  */
6841
6916
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -6853,19 +6928,26 @@ class binance extends binance$1["default"] {
6853
6928
  const request = {
6854
6929
  'symbol': market['id'],
6855
6930
  };
6856
- const clientOrderId = this.safeString2(params, 'origClientOrderId', 'clientOrderId');
6931
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
6932
+ const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'clientAlgoId']);
6857
6933
  if (clientOrderId !== undefined) {
6858
6934
  if (market['option']) {
6859
6935
  request['clientOrderId'] = clientOrderId;
6860
6936
  }
6937
+ else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
6938
+ request['clientAlgoId'] = clientOrderId;
6939
+ }
6861
6940
  else {
6862
6941
  request['origClientOrderId'] = clientOrderId;
6863
6942
  }
6864
6943
  }
6944
+ else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
6945
+ request['algoId'] = id;
6946
+ }
6865
6947
  else {
6866
6948
  request['orderId'] = id;
6867
6949
  }
6868
- params = this.omit(params, ['type', 'clientOrderId', 'origClientOrderId']);
6950
+ params = this.omit(params, ['type', 'clientOrderId', 'origClientOrderId', 'stop', 'trigger', 'conditional', 'clientAlgoId']);
6869
6951
  let response = undefined;
6870
6952
  if (market['option']) {
6871
6953
  response = await this.eapiPrivateGetOrder(this.extend(request, params));
@@ -6875,7 +6957,12 @@ class binance extends binance$1["default"] {
6875
6957
  response = await this.papiGetUmOrder(this.extend(request, params));
6876
6958
  }
6877
6959
  else {
6878
- response = await this.fapiPrivateGetOrder(this.extend(request, params));
6960
+ if (isConditional) {
6961
+ response = await this.fapiPrivateGetAlgoOrder(this.extend(request, params));
6962
+ }
6963
+ else {
6964
+ response = await this.fapiPrivateGetOrder(this.extend(request, params));
6965
+ }
6879
6966
  }
6880
6967
  }
6881
6968
  else if (market['inverse']) {
@@ -6915,6 +7002,7 @@ class binance extends binance$1["default"] {
6915
7002
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders
6916
7003
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders
6917
7004
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders
7005
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-All-Algo-Orders
6918
7006
  * @param {string} symbol unified market symbol of the market orders were made in
6919
7007
  * @param {int} [since] the earliest time in ms to fetch orders for
6920
7008
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -6969,7 +7057,12 @@ class binance extends binance$1["default"] {
6969
7057
  }
6970
7058
  }
6971
7059
  else {
6972
- response = await this.fapiPrivateGetAllOrders(this.extend(request, params));
7060
+ if (isConditional) {
7061
+ response = await this.fapiPrivateGetAllAlgoOrders(this.extend(request, params));
7062
+ }
7063
+ else {
7064
+ response = await this.fapiPrivateGetAllOrders(this.extend(request, params));
7065
+ }
6973
7066
  }
6974
7067
  }
6975
7068
  else if (market['inverse']) {
@@ -7194,6 +7287,7 @@ class binance extends binance$1["default"] {
7194
7287
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Conditional-Orders
7195
7288
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Orders
7196
7289
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Conditional-Orders
7290
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Current-All-Algo-Open-Orders
7197
7291
  * @param {string} symbol unified market symbol
7198
7292
  * @param {int} [since] the earliest time in ms to fetch open orders for
7199
7293
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -7251,7 +7345,12 @@ class binance extends binance$1["default"] {
7251
7345
  }
7252
7346
  }
7253
7347
  else {
7254
- response = await this.fapiPrivateGetOpenOrders(this.extend(request, params));
7348
+ if (isConditional) {
7349
+ response = await this.fapiPrivateGetOpenAlgoOrders(this.extend(request, params));
7350
+ }
7351
+ else {
7352
+ response = await this.fapiPrivateGetOpenOrders(this.extend(request, params));
7353
+ }
7255
7354
  }
7256
7355
  }
7257
7356
  else if (this.isInverse(type, subType)) {
@@ -7611,6 +7710,7 @@ class binance extends binance$1["default"] {
7611
7710
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order
7612
7711
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order
7613
7712
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order
7713
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Algo-Order
7614
7714
  * @param {string} id order id
7615
7715
  * @param {string} symbol unified symbol of the market the order was made in
7616
7716
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -7634,11 +7734,14 @@ class binance extends binance$1["default"] {
7634
7734
  const request = {
7635
7735
  'symbol': market['id'],
7636
7736
  };
7637
- const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId']);
7737
+ const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'clientAlgoId']);
7638
7738
  if (clientOrderId !== undefined) {
7639
7739
  if (market['option']) {
7640
7740
  request['clientOrderId'] = clientOrderId;
7641
7741
  }
7742
+ else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
7743
+ request['clientAlgoId'] = clientOrderId;
7744
+ }
7642
7745
  else {
7643
7746
  if (isPortfolioMargin && isConditional) {
7644
7747
  request['newClientStrategyId'] = clientOrderId;
@@ -7652,11 +7755,14 @@ class binance extends binance$1["default"] {
7652
7755
  if (isPortfolioMargin && isConditional) {
7653
7756
  request['strategyId'] = id;
7654
7757
  }
7758
+ else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
7759
+ request['algoId'] = id;
7760
+ }
7655
7761
  else {
7656
7762
  request['orderId'] = id;
7657
7763
  }
7658
7764
  }
7659
- params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional']);
7765
+ params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional', 'clientAlgoId']);
7660
7766
  let response = undefined;
7661
7767
  if (market['option']) {
7662
7768
  response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
@@ -7671,7 +7777,12 @@ class binance extends binance$1["default"] {
7671
7777
  }
7672
7778
  }
7673
7779
  else {
7674
- response = await this.fapiPrivateDeleteOrder(this.extend(request, params));
7780
+ if (isConditional) {
7781
+ response = await this.fapiPrivateDeleteAlgoOrder(this.extend(request, params));
7782
+ }
7783
+ else {
7784
+ response = await this.fapiPrivateDeleteOrder(this.extend(request, params));
7785
+ }
7675
7786
  }
7676
7787
  }
7677
7788
  else if (market['inverse']) {
@@ -7717,6 +7828,7 @@ class binance extends binance$1["default"] {
7717
7828
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders
7718
7829
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Conditional-Orders
7719
7830
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-All-Open-Orders-on-a-Symbol
7831
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-All-Algo-Open-Orders
7720
7832
  * @param {string} symbol unified market symbol of the market to cancel orders in
7721
7833
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7722
7834
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
@@ -7772,13 +7884,24 @@ class binance extends binance$1["default"] {
7772
7884
  }
7773
7885
  }
7774
7886
  else {
7775
- response = await this.fapiPrivateDeleteAllOpenOrders(this.extend(request, params));
7776
- //
7777
- // {
7778
- // "code": 200,
7779
- // "msg": "The operation of cancel all open order is done."
7780
- // }
7781
- //
7887
+ if (isConditional) {
7888
+ response = await this.fapiPrivateDeleteAlgoOpenOrders(this.extend(request, params));
7889
+ //
7890
+ // {
7891
+ // "code": 200,
7892
+ // "msg": "The operation of cancel all open order is done."
7893
+ // }
7894
+ //
7895
+ }
7896
+ else {
7897
+ response = await this.fapiPrivateDeleteAllOpenOrders(this.extend(request, params));
7898
+ //
7899
+ // {
7900
+ // "code": 200,
7901
+ // "msg": "The operation of cancel all open order is done."
7902
+ // }
7903
+ //
7904
+ }
7782
7905
  }
7783
7906
  }
7784
7907
  else if (market['inverse']) {
@@ -10803,7 +10926,7 @@ class binance extends binance$1["default"] {
10803
10926
  // }
10804
10927
  // ]
10805
10928
  //
10806
- return this.parsePosition(response[0], market);
10929
+ return this.parseOptionPosition(response[0], market);
10807
10930
  }
10808
10931
  /**
10809
10932
  * @method
@@ -10860,11 +10983,11 @@ class binance extends binance$1["default"] {
10860
10983
  //
10861
10984
  const result = [];
10862
10985
  for (let i = 0; i < response.length; i++) {
10863
- result.push(this.parsePosition(response[i], market));
10986
+ result.push(this.parseOptionPosition(response[i], market));
10864
10987
  }
10865
10988
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
10866
10989
  }
10867
- parsePosition(position, market = undefined) {
10990
+ parseOptionPosition(position, market = undefined) {
10868
10991
  //
10869
10992
  // {
10870
10993
  // "entryPrice": "27.70000000",
@@ -12199,13 +12322,13 @@ class binance extends binance$1["default"] {
12199
12322
  getExceptionsByUrl(url, exactOrBroad) {
12200
12323
  let marketType = undefined;
12201
12324
  const hostname = (this.hostname !== undefined) ? this.hostname : 'binance.com';
12202
- if (url.startsWith('https://api.' + hostname + '/') || url.startsWith('https://testnet.binance.vision')) {
12325
+ if (url.startsWith('https://api.' + hostname + '/') || url.startsWith('https://demo-api') || url.startsWith('https://testnet.binance.vision')) {
12203
12326
  marketType = 'spot';
12204
12327
  }
12205
- else if (url.startsWith('https://dapi.' + hostname + '/') || url.startsWith('https://testnet.binancefuture.com/dapi')) {
12328
+ else if (url.startsWith('https://dapi.' + hostname + '/') || url.startsWith('https://demo-dapi') || url.startsWith('https://testnet.binancefuture.com/dapi')) {
12206
12329
  marketType = 'inverse';
12207
12330
  }
12208
- else if (url.startsWith('https://fapi.' + hostname + '/') || url.startsWith('https://testnet.binancefuture.com/fapi')) {
12331
+ else if (url.startsWith('https://fapi.' + hostname + '/') || url.startsWith('https://demo-fapi') || url.startsWith('https://testnet.binancefuture.com/fapi')) {
12209
12332
  marketType = 'linear';
12210
12333
  }
12211
12334
  else if (url.startsWith('https://eapi.' + hostname + '/')) {
@@ -215,6 +215,7 @@ class bingx extends bingx$1["default"] {
215
215
  'get': {
216
216
  'market/depth': 1,
217
217
  'market/kline': 1,
218
+ 'ticker/price': 1,
218
219
  },
219
220
  },
220
221
  },
@@ -5441,7 +5442,7 @@ class bingx extends bingx$1["default"] {
5441
5442
  '3': 'rejected',
5442
5443
  '4': 'pending',
5443
5444
  '5': 'rejected',
5444
- '6': 'ok',
5445
+ '6': 'pending',
5445
5446
  };
5446
5447
  return this.safeString(statuses, status, status);
5447
5448
  }
@@ -526,6 +526,7 @@ class bitmart extends bitmart$1["default"] {
526
526
  'broad': {
527
527
  'You contract account available balance not enough': errors.InsufficientFunds,
528
528
  'you contract account available balance not enough': errors.InsufficientFunds,
529
+ 'This trading pair does not support API trading': errors.BadSymbol, // {"message":"This trading pair does not support API trading","code":51008,"trace":"5d3ebd46-4e7a-4505-b37b-74464f398f01","data":{}}
529
530
  },
530
531
  },
531
532
  'commonCurrencies': {