ccxt 4.5.45 → 4.5.47

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 (91) hide show
  1. package/README.md +5 -6
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -6
  4. package/dist/cjs/src/aftermath.js +1 -1
  5. package/dist/cjs/src/backpack.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +27 -0
  7. package/dist/cjs/src/binance.js +23 -17
  8. package/dist/cjs/src/bitfinex.js +6 -11
  9. package/dist/cjs/src/bitget.js +9 -4
  10. package/dist/cjs/src/bitmart.js +144 -21
  11. package/dist/cjs/src/bitmex.js +46 -0
  12. package/dist/cjs/src/bitstamp.js +14 -1
  13. package/dist/cjs/src/bittrade.js +1 -1
  14. package/dist/cjs/src/blofin.js +137 -29
  15. package/dist/cjs/src/bybit.js +58 -56
  16. package/dist/cjs/src/bydfi.js +102 -100
  17. package/dist/cjs/src/gate.js +37 -2
  18. package/dist/cjs/src/hollaex.js +1 -1
  19. package/dist/cjs/src/kraken.js +39 -29
  20. package/dist/cjs/src/kucoin.js +2161 -462
  21. package/dist/cjs/src/lighter.js +2 -2
  22. package/dist/cjs/src/okx.js +75 -58
  23. package/dist/cjs/src/paradex.js +2 -6
  24. package/dist/cjs/src/pro/bittrade.js +4 -0
  25. package/dist/cjs/src/pro/bydfi.js +19 -19
  26. package/dist/cjs/src/pro/gate.js +79 -54
  27. package/dist/cjs/src/pro/grvt.js +6 -4
  28. package/dist/cjs/src/pro/htx.js +4 -4
  29. package/dist/cjs/src/pro/lighter.js +1 -1
  30. package/dist/cjs/src/pro/okx.js +1 -1
  31. package/dist/cjs/src/whitebit.js +21 -2
  32. package/index.d.cts +2 -0
  33. package/js/ccxt.d.ts +2 -8
  34. package/js/ccxt.js +2 -6
  35. package/js/src/abstract/bitmart.d.ts +7 -0
  36. package/js/src/abstract/blofin.d.ts +28 -12
  37. package/js/src/abstract/bydfi.d.ts +29 -29
  38. package/js/src/abstract/kraken.d.ts +36 -29
  39. package/js/src/abstract/kucoin.d.ts +2 -0
  40. package/js/src/abstract/kucoinfutures.d.ts +2 -0
  41. package/js/src/aftermath.js +1 -1
  42. package/js/src/backpack.js +1 -1
  43. package/js/src/base/Exchange.d.ts +2 -0
  44. package/js/src/base/Exchange.js +27 -0
  45. package/js/src/binance.js +23 -17
  46. package/js/src/bitfinex.js +6 -11
  47. package/js/src/bitget.d.ts +1 -1
  48. package/js/src/bitget.js +9 -4
  49. package/js/src/bitmart.d.ts +18 -4
  50. package/js/src/bitmart.js +144 -21
  51. package/js/src/bitmex.d.ts +12 -0
  52. package/js/src/bitmex.js +46 -0
  53. package/js/src/bitstamp.js +14 -1
  54. package/js/src/bittrade.js +1 -1
  55. package/js/src/blofin.d.ts +2 -0
  56. package/js/src/blofin.js +137 -29
  57. package/js/src/bybit.d.ts +1 -0
  58. package/js/src/bybit.js +58 -56
  59. package/js/src/bydfi.d.ts +31 -31
  60. package/js/src/bydfi.js +102 -100
  61. package/js/src/gate.js +37 -2
  62. package/js/src/hollaex.js +1 -1
  63. package/js/src/kraken.js +39 -29
  64. package/js/src/kucoin.d.ts +249 -8
  65. package/js/src/kucoin.js +2161 -462
  66. package/js/src/lighter.js +2 -2
  67. package/js/src/okx.d.ts +1 -0
  68. package/js/src/okx.js +75 -58
  69. package/js/src/paradex.d.ts +0 -1
  70. package/js/src/paradex.js +2 -6
  71. package/js/src/pro/bittrade.js +4 -0
  72. package/js/src/pro/bydfi.d.ts +18 -18
  73. package/js/src/pro/bydfi.js +19 -19
  74. package/js/src/pro/gate.d.ts +2 -2
  75. package/js/src/pro/gate.js +79 -54
  76. package/js/src/pro/grvt.js +6 -4
  77. package/js/src/pro/htx.js +4 -4
  78. package/js/src/pro/lighter.js +1 -1
  79. package/js/src/pro/okx.js +1 -1
  80. package/js/src/whitebit.d.ts +1 -1
  81. package/js/src/whitebit.js +21 -2
  82. package/package.json +2 -2
  83. package/dist/cjs/src/abstract/coincatch.js +0 -11
  84. package/dist/cjs/src/coincatch.js +0 -5495
  85. package/dist/cjs/src/pro/coincatch.js +0 -1563
  86. package/js/src/abstract/coincatch.d.ts +0 -97
  87. package/js/src/abstract/coincatch.js +0 -5
  88. package/js/src/coincatch.d.ts +0 -788
  89. package/js/src/coincatch.js +0 -5488
  90. package/js/src/pro/coincatch.d.ts +0 -207
  91. package/js/src/pro/coincatch.js +0 -1556
@@ -201,16 +201,16 @@ class bydfi extends bydfi$1["default"] {
201
201
  'public': {
202
202
  'get': {
203
203
  'v1/public/api_limits': 1,
204
- 'v1/swap/market/exchange_info': 1,
205
- 'v1/swap/market/depth': 1,
206
- 'v1/swap/market/trades': 1,
207
- 'v1/swap/market/klines': 1,
208
- 'v1/swap/market/ticker/24hr': 1,
209
- 'v1/swap/market/ticker/price': 1,
210
- 'v1/swap/market/mark_price': 1,
211
- 'v1/swap/market/funding_rate': 1,
212
- 'v1/swap/market/funding_rate_history': 1,
213
- 'v1/swap/market/risk_limit': 1, // https://developers.bydfi.com/en/swap/market#risk-limit
204
+ 'v1/fapi/market/exchange_info': 1,
205
+ 'v1/fapi/market/depth': 1,
206
+ 'v1/fapi/market/trades': 1,
207
+ 'v1/fapi/market/klines': 1,
208
+ 'v1/fapi/market/ticker/24hr': 1,
209
+ 'v1/fapi/market/ticker/price': 1,
210
+ 'v1/fapi/market/mark_price': 1,
211
+ 'v1/fapi/market/funding_rate': 1,
212
+ 'v1/fapi/market/funding_rate_history': 1,
213
+ 'v1/fapi/market/risk_limit': 1, // https://developers.bydfi.com/en/futures/market#risk-limit
214
214
  },
215
215
  },
216
216
  'private': {
@@ -219,16 +219,16 @@ class bydfi extends bydfi$1["default"] {
219
219
  'v1/account/transfer_records': 1,
220
220
  'v1/spot/deposit_records': 1,
221
221
  'v1/spot/withdraw_records': 1,
222
- 'v1/swap/trade/open_order': 1,
223
- 'v1/swap/trade/plan_order': 1,
224
- 'v1/swap/trade/leverage': 1,
225
- 'v1/swap/trade/history_order': 1,
226
- 'v1/swap/trade/history_trade': 1,
227
- 'v1/swap/trade/position_history': 1,
228
- 'v1/swap/trade/positions': 1,
229
- 'v1/swap/account/balance': 1,
230
- 'v1/swap/user_data/assets_margin': 1,
231
- 'v1/swap/user_data/position_side/dual': 1,
222
+ 'v1/fapi/trade/open_order': 1,
223
+ 'v1/fapi/trade/plan_order': 1,
224
+ 'v1/fapi/trade/leverage': 1,
225
+ 'v1/fapi/trade/history_order': 1,
226
+ 'v1/fapi/trade/history_trade': 1,
227
+ 'v1/fapi/trade/position_history': 1,
228
+ 'v1/fapi/trade/positions': 1,
229
+ 'v1/fapi/account/balance': 1,
230
+ 'v1/fapi/user_data/assets_margin': 1,
231
+ 'v1/fapi/user_data/position_side/dual': 1,
232
232
  'v1/agent/teams': 1,
233
233
  'v1/agent/agent_links': 1,
234
234
  'v1/agent/regular_overview': 1,
@@ -241,15 +241,15 @@ class bydfi extends bydfi$1["default"] {
241
241
  },
242
242
  'post': {
243
243
  'v1/account/transfer': 1,
244
- 'v1/swap/trade/place_order': 1,
245
- 'v1/swap/trade/batch_place_order': 1,
246
- 'v1/swap/trade/edit_order': 1,
247
- 'v1/swap/trade/batch_edit_order': 1,
248
- 'v1/swap/trade/cancel_all_order': 1,
249
- 'v1/swap/trade/leverage': 1,
250
- 'v1/swap/trade/batch_leverage_margin': 1,
251
- 'v1/swap/user_data/margin_type': 1,
252
- 'v1/swap/user_data/position_side/dual': 1,
244
+ 'v1/fapi/trade/place_order': 1,
245
+ 'v1/fapi/trade/batch_place_order': 1,
246
+ 'v1/fapi/trade/edit_order': 1,
247
+ 'v1/fapi/trade/batch_edit_order': 1,
248
+ 'v1/fapi/trade/cancel_all_order': 1,
249
+ 'v1/fapi/trade/leverage': 1,
250
+ 'v1/fapi/trade/batch_leverage_margin': 1,
251
+ 'v1/fapi/user_data/margin_type': 1,
252
+ 'v1/fapi/user_data/position_side/dual': 1,
253
253
  'v1/agent/internal_withdrawal': 1, // https://developers.bydfi.com/en/agent/#internal-withdrawal
254
254
  },
255
255
  },
@@ -381,13 +381,15 @@ class bydfi extends bydfi$1["default"] {
381
381
  },
382
382
  'accountsByType': {
383
383
  'spot': 'SPOT',
384
- 'swap': 'SWAP',
385
- 'funding': 'FUND',
384
+ 'swap': 'UMFUTURE',
385
+ 'funding': 'FUNDING',
386
+ 'inverse': 'CMFUTURE',
386
387
  },
387
388
  'accountsById': {
388
389
  'SPOT': 'spot',
389
- 'SWAP': 'swap',
390
- 'FUND': 'funding',
390
+ 'UMFUTURE': 'swap',
391
+ 'FUNDING': 'funding',
392
+ 'CMFUTURE': 'inverse',
391
393
  },
392
394
  },
393
395
  });
@@ -396,12 +398,12 @@ class bydfi extends bydfi$1["default"] {
396
398
  * @method
397
399
  * @name bydfi#fetchMarkets
398
400
  * @description retrieves data on all markets for bydfi
399
- * @see https://developers.bydfi.com/en/swap/market#fetching-trading-rules-and-pairs
401
+ * @see https://developers.bydfi.com/en/futures/market#fetching-trading-rules-and-pairs
400
402
  * @param {object} [params] extra parameters specific to the exchange API endpoint
401
403
  * @returns {object[]} an array of objects representing market data
402
404
  */
403
405
  async fetchMarkets(params = {}) {
404
- const response = await this.publicGetV1SwapMarketExchangeInfo(params);
406
+ const response = await this.publicGetV1FapiMarketExchangeInfo(params);
405
407
  //
406
408
  // {
407
409
  // "code": "200",
@@ -556,7 +558,7 @@ class bydfi extends bydfi$1["default"] {
556
558
  * @method
557
559
  * @name bydfi#fetchOrderBook
558
560
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
559
- * @see https://developers.bydfi.com/en/swap/market#depth-information
561
+ * @see https://developers.bydfi.com/en/futures/market#depth-information
560
562
  * @param {string} symbol unified symbol of the market to fetch the order book for
561
563
  * @param {int} [limit] the maximum amount of order book entries to return, could be 5, 10, 20, 50, 100, 500 or 1000 (default 500)
562
564
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -572,7 +574,7 @@ class bydfi extends bydfi$1["default"] {
572
574
  if (limit !== undefined) {
573
575
  request['limit'] = this.getClosestLimit(limit);
574
576
  }
575
- const response = await this.publicGetV1SwapMarketDepth(this.extend(request, params));
577
+ const response = await this.publicGetV1FapiMarketDepth(this.extend(request, params));
576
578
  //
577
579
  // {
578
580
  // "code": 200,
@@ -620,7 +622,7 @@ class bydfi extends bydfi$1["default"] {
620
622
  * @method
621
623
  * @name bydfi#fetchTrades
622
624
  * @description get the list of most recent trades for a particular symbol
623
- * @see https://developers.bydfi.com/en/swap/market#recent-trades
625
+ * @see https://developers.bydfi.com/en/futures/market#recent-trades
624
626
  * @param {string} symbol unified symbol of the market to fetch trades for
625
627
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
626
628
  * @param {int} [limit] the maximum amount of trades to fetch (default 500, max 1000)
@@ -637,7 +639,7 @@ class bydfi extends bydfi$1["default"] {
637
639
  if (limit !== undefined) {
638
640
  request['limit'] = limit;
639
641
  }
640
- const response = await this.publicGetV1SwapMarketTrades(this.extend(request, params));
642
+ const response = await this.publicGetV1FapiMarketTrades(this.extend(request, params));
641
643
  //
642
644
  // {
643
645
  // "code": 200,
@@ -662,7 +664,7 @@ class bydfi extends bydfi$1["default"] {
662
664
  * @method
663
665
  * @name bydfi#fetchMyTrades
664
666
  * @description fetch all trades made by the user
665
- * @see https://developers.bydfi.com/en/swap/trade#historical-trades-query
667
+ * @see https://developers.bydfi.com/en/futures/trade#historical-trades-query
666
668
  * @param {string} symbol unified market symbol
667
669
  * @param {int} [since] the earliest time in ms to fetch trades for
668
670
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -697,7 +699,7 @@ class bydfi extends bydfi$1["default"] {
697
699
  if (limit !== undefined) {
698
700
  request['limit'] = limit;
699
701
  }
700
- const response = await this.privateGetV1SwapTradeHistoryTrade(this.extend(request, params));
702
+ const response = await this.privateGetV1FapiTradeHistoryTrade(this.extend(request, params));
701
703
  //
702
704
  // {
703
705
  // "code": 200,
@@ -804,7 +806,7 @@ class bydfi extends bydfi$1["default"] {
804
806
  * @method
805
807
  * @name bydfi#fetchOHLCV
806
808
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
807
- * @see https://developers.bydfi.com/en/swap/market#candlestick-data
809
+ * @see https://developers.bydfi.com/en/futures/market#candlestick-data
808
810
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
809
811
  * @param {string} timeframe the length of time each candle represents
810
812
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -852,7 +854,7 @@ class bydfi extends bydfi$1["default"] {
852
854
  if (limit !== undefined) {
853
855
  request['limit'] = limit;
854
856
  }
855
- const response = await this.publicGetV1SwapMarketKlines(this.extend(request, params));
857
+ const response = await this.publicGetV1FapiMarketKlines(this.extend(request, params));
856
858
  //
857
859
  // {
858
860
  // "code": 200,
@@ -899,7 +901,7 @@ class bydfi extends bydfi$1["default"] {
899
901
  /**
900
902
  * @method
901
903
  * @name bydfi#fetchTickers
902
- * @see https://developers.bydfi.com/en/swap/market#24hr-price-change-statistics
904
+ * @see https://developers.bydfi.com/en/futures/market#24hr-price-change-statistics
903
905
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
904
906
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
905
907
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -907,7 +909,7 @@ class bydfi extends bydfi$1["default"] {
907
909
  */
908
910
  async fetchTickers(symbols = undefined, params = {}) {
909
911
  await this.loadMarkets();
910
- const response = await this.publicGetV1SwapMarketTicker24hr(params);
912
+ const response = await this.publicGetV1FapiMarketTicker24hr(params);
911
913
  //
912
914
  // {
913
915
  // "code": 200,
@@ -933,7 +935,7 @@ class bydfi extends bydfi$1["default"] {
933
935
  * @method
934
936
  * @name bydfi#fetchTicker
935
937
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
936
- * @see https://developers.bydfi.com/en/swap/market#24hr-price-change-statistics
938
+ * @see https://developers.bydfi.com/en/futures/market#24hr-price-change-statistics
937
939
  * @param {string} symbol unified symbol of the market to fetch the ticker for
938
940
  * @param {object} [params] extra parameters specific to the exchange API endpoint
939
941
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -944,7 +946,7 @@ class bydfi extends bydfi$1["default"] {
944
946
  const request = {
945
947
  'symbol': market['id'],
946
948
  };
947
- const response = await this.publicGetV1SwapMarketTicker24hr(this.extend(request, params));
949
+ const response = await this.publicGetV1FapiMarketTicker24hr(this.extend(request, params));
948
950
  const data = this.safeList(response, 'data', []);
949
951
  const ticker = this.safeDict(data, 0, {});
950
952
  return this.parseTicker(ticker, market);
@@ -995,7 +997,7 @@ class bydfi extends bydfi$1["default"] {
995
997
  * @method
996
998
  * @name bydfi#fetchFundingRate
997
999
  * @description fetch the current funding rate
998
- * @see https://developers.bydfi.com/en/swap/market#recent-funding-rate
1000
+ * @see https://developers.bydfi.com/en/futures/market#recent-funding-rate
999
1001
  * @param {string} symbol unified market symbol
1000
1002
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1001
1003
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/?id=funding-rate-structure}
@@ -1006,7 +1008,7 @@ class bydfi extends bydfi$1["default"] {
1006
1008
  const request = {
1007
1009
  'symbol': market['id'],
1008
1010
  };
1009
- const response = await this.publicGetV1SwapMarketFundingRate(this.extend(request, params));
1011
+ const response = await this.publicGetV1FapiMarketFundingRate(this.extend(request, params));
1010
1012
  //
1011
1013
  // {
1012
1014
  // "code": 200,
@@ -1061,7 +1063,7 @@ class bydfi extends bydfi$1["default"] {
1061
1063
  * @method
1062
1064
  * @name bydfi#fetchFundingRateHistory
1063
1065
  * @description fetches historical funding rate prices
1064
- * @see https://developers.bydfi.com/en/swap/market#historical-funding-rates
1066
+ * @see https://developers.bydfi.com/en/futures/market#historical-funding-rates
1065
1067
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1066
1068
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1067
1069
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure} to fetch
@@ -1089,7 +1091,7 @@ class bydfi extends bydfi$1["default"] {
1089
1091
  if (until !== undefined) {
1090
1092
  request['endTime'] = until;
1091
1093
  }
1092
- const response = await this.publicGetV1SwapMarketFundingRateHistory(this.extend(request, params));
1094
+ const response = await this.publicGetV1FapiMarketFundingRateHistory(this.extend(request, params));
1093
1095
  //
1094
1096
  // {
1095
1097
  // "code": 200,
@@ -1131,7 +1133,7 @@ class bydfi extends bydfi$1["default"] {
1131
1133
  * @method
1132
1134
  * @name bydfi#createOrder
1133
1135
  * @description create a trade order
1134
- * @see https://developers.bydfi.com/en/swap/trade#placing-an-order
1136
+ * @see https://developers.bydfi.com/en/futures/trade#placing-an-order
1135
1137
  * @param {string} symbol unified symbol of the market to create an order in
1136
1138
  * @param {string} type 'market' or 'limit'
1137
1139
  * @param {string} side 'buy' or 'sell'
@@ -1159,7 +1161,7 @@ class bydfi extends bydfi$1["default"] {
1159
1161
  let wallet = 'W001';
1160
1162
  [wallet, params] = this.handleOptionAndParams(params, 'createOrder', 'wallet', wallet);
1161
1163
  orderRequest = this.extend(orderRequest, { 'wallet': wallet });
1162
- const response = await this.privatePostV1SwapTradePlaceOrder(orderRequest);
1164
+ const response = await this.privatePostV1FapiTradePlaceOrder(orderRequest);
1163
1165
  //
1164
1166
  // {
1165
1167
  // "code": 200,
@@ -1312,7 +1314,7 @@ class bydfi extends bydfi$1["default"] {
1312
1314
  * @method
1313
1315
  * @name bydfi#createOrders
1314
1316
  * @description create a list of trade orders
1315
- * @see https://developers.bydfi.com/en/swap/trade#batch-order-placement
1317
+ * @see https://developers.bydfi.com/en/futures/trade#batch-order-placement
1316
1318
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1317
1319
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1318
1320
  * @param {string} [params.wallet] The unique code of a sub-wallet. W001 is the default wallet and the main wallet code of the contract
@@ -1342,7 +1344,7 @@ class bydfi extends bydfi$1["default"] {
1342
1344
  'wallet': wallet,
1343
1345
  'orders': ordersRequests,
1344
1346
  };
1345
- const response = await this.privatePostV1SwapTradeBatchPlaceOrder(this.extend(request, params));
1347
+ const response = await this.privatePostV1FapiTradeBatchPlaceOrder(this.extend(request, params));
1346
1348
  const data = this.safeList(response, 'data', []);
1347
1349
  return this.parseOrders(data);
1348
1350
  }
@@ -1350,7 +1352,7 @@ class bydfi extends bydfi$1["default"] {
1350
1352
  * @method
1351
1353
  * @name bydfi#editOrder
1352
1354
  * @description edit a trade order
1353
- * @see https://developers.bydfi.com/en/swap/trade#order-modification
1355
+ * @see https://developers.bydfi.com/en/futures/trade#order-modification
1354
1356
  * @param {string} id order id (mandatory if params.clientOrderId is not provided)
1355
1357
  * @param {string} [symbol] unified symbol of the market to create an order in
1356
1358
  * @param {string} [type] not used by bydfi editOrder
@@ -1368,7 +1370,7 @@ class bydfi extends bydfi$1["default"] {
1368
1370
  let wallet = 'W001';
1369
1371
  [wallet, params] = this.handleOptionAndParams(params, 'editOrder', 'wallet', wallet);
1370
1372
  request['wallet'] = wallet;
1371
- const response = await this.privatePostV1SwapTradeEditOrder(request);
1373
+ const response = await this.privatePostV1FapiTradeEditOrder(request);
1372
1374
  const data = this.safeDict(response, 'data', {});
1373
1375
  return this.parseOrder(data);
1374
1376
  }
@@ -1376,7 +1378,7 @@ class bydfi extends bydfi$1["default"] {
1376
1378
  * @method
1377
1379
  * @name bydfi#editOrders
1378
1380
  * @description edit a list of trade orders
1379
- * @see https://developers.bydfi.com/en/swap/trade#batch-order-modification
1381
+ * @see https://developers.bydfi.com/en/futures/trade#batch-order-modification
1380
1382
  * @param {Array} orders list of orders to edit, each object should contain the parameters required by editOrder, namely id, symbol, amount, price and params
1381
1383
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1382
1384
  * @param {string} [params.wallet] The unique code of a sub-wallet. W001 is the default wallet and the main wallet code of the contract
@@ -1406,7 +1408,7 @@ class bydfi extends bydfi$1["default"] {
1406
1408
  'wallet': wallet,
1407
1409
  'editOrders': ordersRequests,
1408
1410
  };
1409
- const response = await this.privatePostV1SwapTradeBatchEditOrder(this.extend(request, params));
1411
+ const response = await this.privatePostV1FapiTradeBatchEditOrder(this.extend(request, params));
1410
1412
  const data = this.safeList(response, 'data', []);
1411
1413
  return this.parseOrders(data);
1412
1414
  }
@@ -1436,7 +1438,7 @@ class bydfi extends bydfi$1["default"] {
1436
1438
  * @method
1437
1439
  * @name bydfi#cancelAllOrders
1438
1440
  * @description cancel all open orders in a market
1439
- * @see https://developers.bydfi.com/en/swap/trade#complete-order-cancellation
1441
+ * @see https://developers.bydfi.com/en/futures/trade#complete-order-cancellation
1440
1442
  * @param {string} symbol unified market symbol of the market to cancel orders in
1441
1443
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1442
1444
  * @param {string} [params.wallet] The unique code of a sub-wallet. W001 is the default wallet and the main wallet code of the contract
@@ -1454,7 +1456,7 @@ class bydfi extends bydfi$1["default"] {
1454
1456
  'symbol': market['id'],
1455
1457
  'wallet': wallet,
1456
1458
  };
1457
- const response = await this.privatePostV1SwapTradeCancelAllOrder(this.extend(request, params));
1459
+ const response = await this.privatePostV1FapiTradeCancelAllOrder(this.extend(request, params));
1458
1460
  //
1459
1461
  // {
1460
1462
  // "code": 200,
@@ -1494,8 +1496,8 @@ class bydfi extends bydfi$1["default"] {
1494
1496
  * @method
1495
1497
  * @name bydfi#fetchOpenOrders
1496
1498
  * @description fetch all unfilled currently open orders
1497
- * @see https://developers.bydfi.com/en/swap/trade#pending-order-query
1498
- * @see https://developers.bydfi.com/en/swap/trade#planned-order-query
1499
+ * @see https://developers.bydfi.com/en/futures/trade#pending-order-query
1500
+ * @see https://developers.bydfi.com/en/futures/trade#planned-order-query
1499
1501
  * @param {string} symbol unified market symbol of the market orders were made in
1500
1502
  * @param {int} [since] the earliest time in ms to fetch orders for
1501
1503
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1552,10 +1554,10 @@ class bydfi extends bydfi$1["default"] {
1552
1554
  // "success": true
1553
1555
  // }
1554
1556
  //
1555
- response = await this.privateGetV1SwapTradeOpenOrder(this.extend(request, params));
1557
+ response = await this.privateGetV1FapiTradeOpenOrder(this.extend(request, params));
1556
1558
  }
1557
1559
  else {
1558
- response = await this.privateGetV1SwapTradePlanOrder(this.extend(request, params));
1560
+ response = await this.privateGetV1FapiTradePlanOrder(this.extend(request, params));
1559
1561
  }
1560
1562
  const data = this.safeList(response, 'data', []);
1561
1563
  return this.parseOrders(data, market, since, limit);
@@ -1564,8 +1566,8 @@ class bydfi extends bydfi$1["default"] {
1564
1566
  * @method
1565
1567
  * @name bydfi#fetchOpenOrder
1566
1568
  * @description fetch an open order by the id
1567
- * @see https://developers.bydfi.com/en/swap/trade#pending-order-query
1568
- * @see https://developers.bydfi.com/en/swap/trade#planned-order-query
1569
+ * @see https://developers.bydfi.com/en/futures/trade#pending-order-query
1570
+ * @see https://developers.bydfi.com/en/futures/trade#planned-order-query
1569
1571
  * @param {string} id order id (mandatory if params.clientOrderId is not provided)
1570
1572
  * @param {string} symbol unified market symbol
1571
1573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1597,10 +1599,10 @@ class bydfi extends bydfi$1["default"] {
1597
1599
  let trigger = false;
1598
1600
  [trigger, params] = this.handleOptionAndParams(params, 'fetchOpenOrder', 'trigger', trigger);
1599
1601
  if (!trigger) {
1600
- response = await this.privateGetV1SwapTradeOpenOrder(this.extend(request, params));
1602
+ response = await this.privateGetV1FapiTradeOpenOrder(this.extend(request, params));
1601
1603
  }
1602
1604
  else {
1603
- response = await this.privateGetV1SwapTradePlanOrder(this.extend(request, params));
1605
+ response = await this.privateGetV1FapiTradePlanOrder(this.extend(request, params));
1604
1606
  }
1605
1607
  const data = this.safeList(response, 'data', []);
1606
1608
  const order = this.safeDict(data, 0, {});
@@ -1610,7 +1612,7 @@ class bydfi extends bydfi$1["default"] {
1610
1612
  * @method
1611
1613
  * @name bydfi#fetchCanceledAndClosedOrders
1612
1614
  * @description fetches information on multiple canceled and closed orders made by the user
1613
- * @see https://developers.bydfi.com/en/swap/trade#historical-orders-query
1615
+ * @see https://developers.bydfi.com/en/futures/trade#historical-orders-query
1614
1616
  * @param {string} symbol unified market symbol of the closed orders
1615
1617
  * @param {int} [since] timestamp in ms of the earliest order
1616
1618
  * @param {int} [limit] the max number of closed orders to return
@@ -1645,7 +1647,7 @@ class bydfi extends bydfi$1["default"] {
1645
1647
  if (limit !== undefined) {
1646
1648
  request['limit'] = limit;
1647
1649
  }
1648
- const response = await this.privateGetV1SwapTradeHistoryOrder(this.extend(request, params));
1650
+ const response = await this.privateGetV1FapiTradeHistoryOrder(this.extend(request, params));
1649
1651
  //
1650
1652
  // {
1651
1653
  // "code": 200,
@@ -1879,7 +1881,7 @@ class bydfi extends bydfi$1["default"] {
1879
1881
  * @method
1880
1882
  * @name bydfi#setLeverage
1881
1883
  * @description set the level of leverage for a market
1882
- * @see https://developers.bydfi.com/en/swap/trade#set-leverage-for-single-trading-pair
1884
+ * @see https://developers.bydfi.com/en/futures/trade#set-leverage-for-single-trading-pair
1883
1885
  * @param {float} leverage the rate of leverage
1884
1886
  * @param {string} symbol unified market symbol
1885
1887
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1899,7 +1901,7 @@ class bydfi extends bydfi$1["default"] {
1899
1901
  'leverage': leverage,
1900
1902
  'wallet': wallet,
1901
1903
  };
1902
- const response = await this.privatePostV1SwapTradeLeverage(this.extend(request, params));
1904
+ const response = await this.privatePostV1FapiTradeLeverage(this.extend(request, params));
1903
1905
  const data = this.safeDict(response, 'data', {});
1904
1906
  return data;
1905
1907
  }
@@ -1907,7 +1909,7 @@ class bydfi extends bydfi$1["default"] {
1907
1909
  * @method
1908
1910
  * @name bydfi#fetchLeverage
1909
1911
  * @description fetch the set leverage for a market
1910
- * @see https://developers.bydfi.com/en/swap/trade#get-leverage-for-single-trading-pair
1912
+ * @see https://developers.bydfi.com/en/futures/trade#get-leverage-for-single-trading-pair
1911
1913
  * @param {string} symbol unified market symbol
1912
1914
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1913
1915
  * @param {string} [params.wallet] The unique code of a sub-wallet. W001 is the default wallet and the main wallet code of the contract
@@ -1925,7 +1927,7 @@ class bydfi extends bydfi$1["default"] {
1925
1927
  'symbol': market['id'],
1926
1928
  'wallet': wallet,
1927
1929
  };
1928
- const response = await this.privateGetV1SwapTradeLeverage(this.extend(request, params));
1930
+ const response = await this.privateGetV1FapiTradeLeverage(this.extend(request, params));
1929
1931
  //
1930
1932
  // {
1931
1933
  // "code": 200,
@@ -1955,7 +1957,7 @@ class bydfi extends bydfi$1["default"] {
1955
1957
  * @method
1956
1958
  * @name bydfi#fetchPositions
1957
1959
  * @description fetch all open positions
1958
- * @see https://developers.bydfi.com/en/swap/trade#positions-query
1960
+ * @see https://developers.bydfi.com/en/futures/trade#positions-query
1959
1961
  * @param {string[]} [symbols] list of unified market symbols
1960
1962
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1961
1963
  * @param {string} [params.contractType] FUTURE or DELIVERY, default is FUTURE
@@ -1969,7 +1971,7 @@ class bydfi extends bydfi$1["default"] {
1969
1971
  const request = {
1970
1972
  'contractType': contractType,
1971
1973
  };
1972
- const response = await this.privateGetV1SwapTradePositions(this.extend(request, params));
1974
+ const response = await this.privateGetV1FapiTradePositions(this.extend(request, params));
1973
1975
  //
1974
1976
  // {
1975
1977
  // "code": 200,
@@ -1999,7 +2001,7 @@ class bydfi extends bydfi$1["default"] {
1999
2001
  * @method
2000
2002
  * @name bydfi#fetchPositionsForSymbol
2001
2003
  * @description fetch open positions for a single market
2002
- * @see https://developers.bydfi.com/en/swap/trade#positions-query
2004
+ * @see https://developers.bydfi.com/en/futures/trade#positions-query
2003
2005
  * @description fetch all open positions for specific symbol
2004
2006
  * @param {string} symbol unified market symbol
2005
2007
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2015,7 +2017,7 @@ class bydfi extends bydfi$1["default"] {
2015
2017
  'contractType': contractType,
2016
2018
  'symbol': market['id'],
2017
2019
  };
2018
- const response = await this.privateGetV1SwapTradePositions(this.extend(request, params));
2020
+ const response = await this.privateGetV1FapiTradePositions(this.extend(request, params));
2019
2021
  const data = this.safeList(response, 'data', []);
2020
2022
  return this.parsePositions(data, [market['symbol']]);
2021
2023
  }
@@ -2135,7 +2137,7 @@ class bydfi extends bydfi$1["default"] {
2135
2137
  * @method
2136
2138
  * @name bydfi#fetchPositionHistory
2137
2139
  * @description fetches historical positions
2138
- * @see https://developers.bydfi.com/en/swap/trade#query-historical-position-profit-and-loss-records
2140
+ * @see https://developers.bydfi.com/en/futures/trade#query-historical-position-profit-and-loss-records
2139
2141
  * @param {string} symbol a unified market symbol
2140
2142
  * @param {int} [since] timestamp in ms of the earliest position to fetch , params["until"] - since <= 7 days
2141
2143
  * @param {int} [limit] the maximum amount of records to fetch (default 500, max 500)
@@ -2158,7 +2160,7 @@ class bydfi extends bydfi$1["default"] {
2158
2160
  if (limit !== undefined) {
2159
2161
  request['limit'] = limit;
2160
2162
  }
2161
- const response = await this.privateGetV1SwapTradePositionHistory(this.extend(request, params));
2163
+ const response = await this.privateGetV1FapiTradePositionHistory(this.extend(request, params));
2162
2164
  //
2163
2165
  //
2164
2166
  const data = this.safeList(response, 'data', []);
@@ -2169,7 +2171,7 @@ class bydfi extends bydfi$1["default"] {
2169
2171
  * @method
2170
2172
  * @name bydfi#fetchPositionsHistory
2171
2173
  * @description fetches historical positions
2172
- * @see https://developers.bydfi.com/en/swap/trade#query-historical-position-profit-and-loss-records
2174
+ * @see https://developers.bydfi.com/en/futures/trade#query-historical-position-profit-and-loss-records
2173
2175
  * @param {string[]} symbols a list of unified market symbols
2174
2176
  * @param {int} [since] timestamp in ms of the earliest position to fetch , params["until"] - since <= 7 days
2175
2177
  * @param {int} [limit] the maximum amount of records to fetch (default 500, max 500)
@@ -2190,7 +2192,7 @@ class bydfi extends bydfi$1["default"] {
2190
2192
  if (limit !== undefined) {
2191
2193
  request['limit'] = limit;
2192
2194
  }
2193
- const response = await this.privateGetV1SwapTradePositionHistory(this.extend(request, params));
2195
+ const response = await this.privateGetV1FapiTradePositionHistory(this.extend(request, params));
2194
2196
  //
2195
2197
  // {
2196
2198
  // "code": 200,
@@ -2241,7 +2243,7 @@ class bydfi extends bydfi$1["default"] {
2241
2243
  * @method
2242
2244
  * @name bydfi#fetchMarginMode
2243
2245
  * @description fetches the margin mode of a trading pair
2244
- * @see https://developers.bydfi.com/en/swap/user#margin-mode-query
2246
+ * @see https://developers.bydfi.com/en/futures/user#margin-mode-query
2245
2247
  * @param {string} symbol unified symbol of the market to fetch the margin mode for
2246
2248
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2247
2249
  * @param {string} [params.contractType] FUTURE or DELIVERY, default is FUTURE
@@ -2260,7 +2262,7 @@ class bydfi extends bydfi$1["default"] {
2260
2262
  'symbol': market['id'],
2261
2263
  'wallet': wallet,
2262
2264
  };
2263
- const response = await this.privateGetV1SwapUserDataAssetsMargin(this.extend(request, params));
2265
+ const response = await this.privateGetV1FapiUserDataAssetsMargin(this.extend(request, params));
2264
2266
  //
2265
2267
  // {
2266
2268
  // "code": 200,
@@ -2288,7 +2290,7 @@ class bydfi extends bydfi$1["default"] {
2288
2290
  * @method
2289
2291
  * @name bydfi#setMarginMode
2290
2292
  * @description set margin mode to 'cross' or 'isolated'
2291
- * @see https://developers.bydfi.com/en/swap/user#change-margin-type-cross-margin
2293
+ * @see https://developers.bydfi.com/en/futures/user#change-margin-type-cross-margin
2292
2294
  * @param {string} marginMode 'cross' or 'isolated'
2293
2295
  * @param {string} symbol unified market symbol
2294
2296
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2316,13 +2318,13 @@ class bydfi extends bydfi$1["default"] {
2316
2318
  'marginType': marginMode.toUpperCase(),
2317
2319
  'wallet': wallet,
2318
2320
  };
2319
- return await this.privatePostV1SwapUserDataMarginType(this.extend(request, params));
2321
+ return await this.privatePostV1FapiUserDataMarginType(this.extend(request, params));
2320
2322
  }
2321
2323
  /**
2322
2324
  * @method
2323
2325
  * @name bydfi#setPositionMode
2324
2326
  * @description set hedged to true or false for a market, hedged for bydfi is set identically for all markets with same settle currency
2325
- * @see https://developers.bydfi.com/en/swap/user#change-position-mode-dual
2327
+ * @see https://developers.bydfi.com/en/futures/user#change-position-mode-dual
2326
2328
  * @param {bool} hedged set to true to use dualSidePosition
2327
2329
  * @param {string} [symbol] not used by bydfi setPositionMode ()
2328
2330
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2356,13 +2358,13 @@ class bydfi extends bydfi$1["default"] {
2356
2358
  // "success": true
2357
2359
  // }
2358
2360
  //
2359
- return await this.privatePostV1SwapUserDataPositionSideDual(this.extend(request, params));
2361
+ return await this.privatePostV1FapiUserDataPositionSideDual(this.extend(request, params));
2360
2362
  }
2361
2363
  /**
2362
2364
  * @method
2363
2365
  * @name bydfi#fetchPositionMode
2364
2366
  * @description fetchs the position mode, hedged or one way, hedged for bydfi is set identically for all markets with same settle currency
2365
- * @see https://developers.bydfi.com/en/swap/user#get-position-mode
2367
+ * @see https://developers.bydfi.com/en/futures/user#get-position-mode
2366
2368
  * @param {string} [symbol] unified symbol of the market to fetch the order book for
2367
2369
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2368
2370
  * @param {string} [params.contractType] FUTURE or DELIVERY, default is FUTURE
@@ -2389,7 +2391,7 @@ class bydfi extends bydfi$1["default"] {
2389
2391
  'settleCoin': settleCoin,
2390
2392
  'wallet': wallet,
2391
2393
  };
2392
- const response = await this.privateGetV1SwapUserDataPositionSideDual(this.extend(request, params));
2394
+ const response = await this.privateGetV1FapiUserDataPositionSideDual(this.extend(request, params));
2393
2395
  //
2394
2396
  // {
2395
2397
  // "code": 200,
@@ -2419,22 +2421,24 @@ class bydfi extends bydfi$1["default"] {
2419
2421
  * @name bydfi#fetchBalance
2420
2422
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2421
2423
  * @see https://developers.bydfi.com/en/account#asset-inquiry
2422
- * @see https://developers.bydfi.com/en/swap/user#asset-query
2424
+ * @see https://developers.bydfi.com/en/futures/user#asset-query
2423
2425
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2424
- * @param {string} [params.accountType] the type of account to fetch the balance for, either 'spot' or 'swap' or 'funding' (default is 'spot')
2426
+ * @param {string} [params.account] the type of account to fetch the balance for, either 'SPOT' or 'UMFUTURE' or 'CMFUTURE' or 'COPY' or 'GRID' or 'FUNDING' (default is 'SPOT')
2425
2427
  * @param {string} [params.wallet] *swap only* The unique code of a sub-wallet. W001 is the default wallet and the main wallet code of the contract
2426
2428
  * @param {string} [params.asset] currency id for the balance to fetch
2427
2429
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
2428
2430
  */
2429
2431
  async fetchBalance(params = {}) {
2430
2432
  await this.loadMarkets();
2431
- let accountType = 'spot';
2432
- [accountType, params] = this.handleOptionAndParams2(params, 'fetchBalance', 'accountType', 'type', accountType);
2433
+ let type = undefined;
2434
+ [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
2435
+ let wallet = undefined;
2436
+ [wallet, params] = this.handleOptionAndParams(params, 'fetchBalance', 'wallet');
2433
2437
  const request = {};
2434
2438
  let response = undefined;
2435
- if (accountType !== 'swap') {
2439
+ if (wallet === undefined) {
2436
2440
  const options = this.safeDict(this.options, 'accountsByType', {});
2437
- const parsedAccountType = this.safeString(options, accountType, accountType);
2441
+ const parsedAccountType = this.safeStringUpper(options, type, type);
2438
2442
  request['walletType'] = parsedAccountType;
2439
2443
  //
2440
2444
  // {
@@ -2455,8 +2459,6 @@ class bydfi extends bydfi$1["default"] {
2455
2459
  response = await this.privateGetV1AccountAssets(this.extend(request, params));
2456
2460
  }
2457
2461
  else {
2458
- let wallet = 'W001';
2459
- [wallet, params] = this.handleOptionAndParams(params, 'fetchBalance', 'wallet', wallet);
2460
2462
  request['wallet'] = wallet;
2461
2463
  //
2462
2464
  // {
@@ -2486,7 +2488,7 @@ class bydfi extends bydfi$1["default"] {
2486
2488
  // ],
2487
2489
  // "success": true
2488
2490
  // }
2489
- response = await this.privateGetV1SwapAccountBalance(this.extend(request, params));
2491
+ response = await this.privateGetV1FapiAccountBalance(this.extend(request, params));
2490
2492
  }
2491
2493
  const data = this.safeList(response, 'data', []);
2492
2494
  return this.parseBalance(data);