ccxt 4.5.39 → 4.5.41

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 (138) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +18 -18
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/lighter.js +11 -0
  5. package/dist/cjs/src/ascendex.js +73 -1
  6. package/dist/cjs/src/base/Exchange.js +211 -22
  7. package/dist/cjs/src/base/functions/generic.js +1 -0
  8. package/dist/cjs/src/base/functions/io.js +160 -0
  9. package/dist/cjs/src/base/functions.js +6 -0
  10. package/dist/cjs/src/base/ws/Client.js +1 -0
  11. package/dist/cjs/src/base/ws/WsClient.js +1 -0
  12. package/dist/cjs/src/binance.js +143 -0
  13. package/dist/cjs/src/bingx.js +150 -123
  14. package/dist/cjs/src/bitmart.js +20 -6
  15. package/dist/cjs/src/bitmex.js +436 -0
  16. package/dist/cjs/src/blofin.js +86 -1
  17. package/dist/cjs/src/bybit.js +135 -0
  18. package/dist/cjs/src/coinspot.js +7 -2
  19. package/dist/cjs/src/delta.js +367 -0
  20. package/dist/cjs/src/gate.js +11 -4
  21. package/dist/cjs/src/gemini.js +76 -1
  22. package/dist/cjs/src/htx.js +266 -3
  23. package/dist/cjs/src/hyperliquid.js +20 -7
  24. package/dist/cjs/src/independentreserve.js +7 -7
  25. package/dist/cjs/src/kraken.js +1 -1
  26. package/dist/cjs/src/krakenfutures.js +96 -5
  27. package/dist/cjs/src/kucoin.js +3 -3
  28. package/dist/cjs/src/kucoinfutures.js +121 -0
  29. package/dist/cjs/src/lighter.js +2931 -0
  30. package/dist/cjs/src/mexc.js +9 -2
  31. package/dist/cjs/src/phemex.js +359 -0
  32. package/dist/cjs/src/poloniex.js +5 -0
  33. package/dist/cjs/src/pro/binance.js +2 -2
  34. package/dist/cjs/src/pro/bingx.js +248 -35
  35. package/dist/cjs/src/pro/bitget.js +49 -90
  36. package/dist/cjs/src/pro/bitmart.js +68 -0
  37. package/dist/cjs/src/pro/blofin.js +52 -1
  38. package/dist/cjs/src/pro/coinbaseinternational.js +5 -2
  39. package/dist/cjs/src/pro/defx.js +1 -1
  40. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  41. package/dist/cjs/src/pro/lighter.js +787 -0
  42. package/dist/cjs/src/pro/mexc.js +73 -1
  43. package/dist/cjs/src/pro/okx.js +7 -4
  44. package/dist/cjs/src/pro/paradex.js +138 -1
  45. package/dist/cjs/src/pro/woo.js +43 -0
  46. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
  47. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
  48. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
  49. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  50. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  51. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  52. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  53. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  54. package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
  55. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
  56. package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
  57. package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
  58. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
  59. package/dist/cjs/src/whitebit.js +118 -16
  60. package/dist/cjs/src/woo.js +103 -3
  61. package/js/ccxt.d.ts +9 -3
  62. package/js/ccxt.js +6 -2
  63. package/js/src/abstract/gemini.d.ts +27 -0
  64. package/js/src/abstract/lighter.d.ts +53 -0
  65. package/js/src/abstract/lighter.js +5 -0
  66. package/js/src/ascendex.d.ts +12 -1
  67. package/js/src/ascendex.js +73 -1
  68. package/js/src/base/Exchange.d.ts +29 -14
  69. package/js/src/base/Exchange.js +216 -23
  70. package/js/src/base/functions/generic.js +1 -0
  71. package/js/src/base/functions/io.d.ts +32 -0
  72. package/js/src/base/functions/io.js +131 -0
  73. package/js/src/base/functions.d.ts +1 -0
  74. package/js/src/base/functions.js +1 -0
  75. package/js/src/base/types.d.ts +9 -0
  76. package/js/src/binance.d.ts +27 -1
  77. package/js/src/binance.js +143 -0
  78. package/js/src/bingx.d.ts +113 -108
  79. package/js/src/bingx.js +150 -123
  80. package/js/src/bitmart.js +20 -6
  81. package/js/src/bitmex.d.ts +50 -1
  82. package/js/src/bitmex.js +436 -0
  83. package/js/src/blofin.d.ts +12 -1
  84. package/js/src/blofin.js +86 -1
  85. package/js/src/bybit.d.ts +12 -1
  86. package/js/src/bybit.js +135 -0
  87. package/js/src/coinspot.js +7 -2
  88. package/js/src/delta.d.ts +12 -1
  89. package/js/src/delta.js +367 -0
  90. package/js/src/gate.d.ts +1 -0
  91. package/js/src/gate.js +11 -4
  92. package/js/src/gemini.d.ts +11 -0
  93. package/js/src/gemini.js +76 -1
  94. package/js/src/htx.d.ts +15 -1
  95. package/js/src/htx.js +266 -3
  96. package/js/src/hyperliquid.js +20 -7
  97. package/js/src/independentreserve.js +7 -7
  98. package/js/src/kraken.js +1 -1
  99. package/js/src/krakenfutures.d.ts +1 -1
  100. package/js/src/krakenfutures.js +96 -5
  101. package/js/src/kucoin.d.ts +3 -3
  102. package/js/src/kucoin.js +3 -3
  103. package/js/src/kucoinfutures.d.ts +12 -1
  104. package/js/src/kucoinfutures.js +121 -0
  105. package/js/src/lighter.d.ts +424 -0
  106. package/js/src/lighter.js +2924 -0
  107. package/js/src/mexc.js +9 -2
  108. package/js/src/phemex.d.ts +16 -1
  109. package/js/src/phemex.js +359 -0
  110. package/js/src/poloniex.js +5 -0
  111. package/js/src/pro/binance.js +2 -2
  112. package/js/src/pro/bingx.d.ts +50 -34
  113. package/js/src/pro/bingx.js +249 -36
  114. package/js/src/pro/bitget.d.ts +6 -6
  115. package/js/src/pro/bitget.js +49 -90
  116. package/js/src/pro/bitmart.d.ts +22 -1
  117. package/js/src/pro/bitmart.js +69 -1
  118. package/js/src/pro/blofin.d.ts +12 -1
  119. package/js/src/pro/blofin.js +52 -1
  120. package/js/src/pro/coinbaseinternational.d.ts +2 -2
  121. package/js/src/pro/coinbaseinternational.js +6 -3
  122. package/js/src/pro/defx.js +1 -1
  123. package/js/src/pro/kucoinfutures.js +1 -1
  124. package/js/src/pro/lighter.d.ts +161 -0
  125. package/js/src/pro/lighter.js +780 -0
  126. package/js/src/pro/mexc.d.ts +22 -1
  127. package/js/src/pro/mexc.js +73 -1
  128. package/js/src/pro/okx.d.ts +4 -4
  129. package/js/src/pro/okx.js +7 -4
  130. package/js/src/pro/paradex.d.ts +23 -1
  131. package/js/src/pro/paradex.js +138 -1
  132. package/js/src/pro/woo.d.ts +12 -1
  133. package/js/src/pro/woo.js +43 -0
  134. package/js/src/whitebit.d.ts +2 -1
  135. package/js/src/whitebit.js +118 -16
  136. package/js/src/woo.d.ts +12 -1
  137. package/js/src/woo.js +103 -3
  138. package/package.json +1 -1
package/js/src/bingx.js CHANGED
@@ -135,7 +135,17 @@ export default class bingx extends Exchange {
135
135
  'api': 'https://open-api.{hostname}/openApi',
136
136
  },
137
137
  'test': {
138
- 'swap': 'https://open-api-vst.{hostname}/openApi', // only swap is really "test" but since the API keys are the same, we want to keep all the functionalities when the user enables the sandboxmode
138
+ 'fund': 'https://open-api-vst.{hostname}/openApi',
139
+ 'spot': 'https://open-api-vst.{hostname}/openApi',
140
+ 'swap': 'https://open-api-vst.{hostname}/openApi',
141
+ 'contract': 'https://open-api-vst.{hostname}/openApi',
142
+ 'wallets': 'https://open-api-vst.{hostname}/openApi',
143
+ 'user': 'https://open-api-vst.{hostname}/openApi',
144
+ 'subAccount': 'https://open-api-vst.{hostname}/openApi',
145
+ 'account': 'https://open-api-vst.{hostname}/openApi',
146
+ 'copyTrading': 'https://open-api-vst.{hostname}/openApi',
147
+ 'cswap': 'https://open-api-vst.{hostname}/openApi',
148
+ 'api': 'https://open-api-vst.{hostname}/openApi',
139
149
  },
140
150
  'www': 'https://bingx.com/',
141
151
  'doc': 'https://bingx-api.github.io/docs/',
@@ -792,7 +802,7 @@ export default class bingx extends Exchange {
792
802
  * @method
793
803
  * @name bingx#fetchCurrencies
794
804
  * @description fetches all available currencies on an exchange
795
- * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins
805
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Query%20currency%20deposit%20and%20withdrawal%20data
796
806
  * @param {object} [params] extra parameters specific to the exchange API endpoint
797
807
  * @returns {object} an associative dictionary of currencies
798
808
  */
@@ -1117,9 +1127,9 @@ export default class bingx extends Exchange {
1117
1127
  * @method
1118
1128
  * @name bingx#fetchMarkets
1119
1129
  * @description retrieves data on all markets for bingx
1120
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
1121
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
1122
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information
1130
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Spot%20trading%20symbols
1131
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/USDT-M%20Perp%20Futures%20symbols
1132
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Contract%20Information
1123
1133
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1124
1134
  * @returns {object[]} an array of objects representing market data
1125
1135
  */
@@ -1141,11 +1151,10 @@ export default class bingx extends Exchange {
1141
1151
  * @method
1142
1152
  * @name bingx#fetchOHLCV
1143
1153
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1144
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
1145
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
1146
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
1147
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
1148
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
1154
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Kline%2FCandlestick%20Data
1155
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Kline%2FCandlestick%20Data
1156
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20Kline%2FCandlestick%20Data
1157
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Get%20K-line%20Data
1149
1158
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1150
1159
  * @param {string} timeframe the length of time each candle represents
1151
1160
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1295,8 +1304,8 @@ export default class bingx extends Exchange {
1295
1304
  * @method
1296
1305
  * @name bingx#fetchTrades
1297
1306
  * @description get the list of most recent trades for a particular symbol
1298
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20transaction%20records
1299
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#The%20latest%20Trade%20of%20a%20Trading%20Pair
1307
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Recent%20Trades%20List
1308
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Recent%20Trades%20List
1300
1309
  * @param {string} symbol unified symbol of the market to fetch trades for
1301
1310
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1302
1311
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1529,9 +1538,9 @@ export default class bingx extends Exchange {
1529
1538
  * @method
1530
1539
  * @name bingx#fetchOrderBook
1531
1540
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1532
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
1533
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
1534
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
1541
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Order%20Book
1542
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Order%20Book
1543
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%20Depth%20Data
1535
1544
  * @param {string} symbol unified symbol of the market to fetch the order book for
1536
1545
  * @param {int} [limit] the maximum amount of order book entries to return
1537
1546
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1645,8 +1654,8 @@ export default class bingx extends Exchange {
1645
1654
  * @method
1646
1655
  * @name bingx#fetchFundingRate
1647
1656
  * @description fetch the current funding rate
1648
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
1649
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
1657
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
1658
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
1650
1659
  * @param {string} symbol unified market symbol
1651
1660
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1652
1661
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/?id=funding-rate-structure}
@@ -1687,15 +1696,26 @@ export default class bingx extends Exchange {
1687
1696
  * @method
1688
1697
  * @name bingx#fetchFundingRates
1689
1698
  * @description fetch the current funding rate for multiple symbols
1690
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
1699
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
1700
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
1691
1701
  * @param {string[]} [symbols] list of unified market symbols
1692
1702
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1703
+ * @param {string} [params.subType] "linear" or "inverse" (default is linear)
1693
1704
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-structure}
1694
1705
  */
1695
1706
  async fetchFundingRates(symbols = undefined, params = {}) {
1696
1707
  await this.loadMarkets();
1697
- symbols = this.marketSymbols(symbols, 'swap', true);
1698
- const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1708
+ symbols = this.marketSymbols(symbols, 'swap', true, true, true);
1709
+ const firstMarket = this.getMarketFromSymbols(symbols);
1710
+ let subType = 'linear';
1711
+ [subType, params] = this.handleSubTypeAndParams('fetchFundingRates', firstMarket, params, subType);
1712
+ let response = undefined;
1713
+ if (subType === 'inverse') {
1714
+ response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(params));
1715
+ }
1716
+ else {
1717
+ response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1718
+ }
1699
1719
  const data = this.safeList(response, 'data', []);
1700
1720
  return this.parseFundingRates(data, symbols);
1701
1721
  }
@@ -1736,7 +1756,7 @@ export default class bingx extends Exchange {
1736
1756
  * @method
1737
1757
  * @name bingx#fetchFundingRateHistory
1738
1758
  * @description fetches historical funding rate prices
1739
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Funding%20Rate%20History
1759
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Get%20Funding%20Rate%20History
1740
1760
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1741
1761
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1742
1762
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure} to fetch
@@ -1892,8 +1912,8 @@ export default class bingx extends Exchange {
1892
1912
  * @method
1893
1913
  * @name bingx#fetchOpenInterest
1894
1914
  * @description retrieves the open interest of a trading pair
1895
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
1896
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
1915
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Open%20Interest%20Statistics
1916
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Get%20Swap%20Open%20Positions
1897
1917
  * @param {string} symbol unified CCXT market symbol
1898
1918
  * @param {object} [params] exchange specific parameters
1899
1919
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
@@ -1986,9 +2006,9 @@ export default class bingx extends Exchange {
1986
2006
  * @method
1987
2007
  * @name bingx#fetchTicker
1988
2008
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1989
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker
1990
- * @see https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes
1991
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change
2009
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2010
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2011
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%2024-Hour%20Price%20Change
1992
2012
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1993
2013
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1994
2014
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2051,9 +2071,9 @@ export default class bingx extends Exchange {
2051
2071
  * @method
2052
2072
  * @name bingx#fetchTickers
2053
2073
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
2054
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker
2055
- * @see https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes
2056
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change
2074
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2075
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2076
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%2024-Hour%20Price%20Change
2057
2077
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2058
2078
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2059
2079
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2120,7 +2140,8 @@ export default class bingx extends Exchange {
2120
2140
  * @method
2121
2141
  * @name bingx#fetchMarkPrice
2122
2142
  * @description fetches mark prices for the market
2123
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
2143
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
2144
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
2124
2145
  * @param {string} symbol unified symbol of the market to fetch the ticker for
2125
2146
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2126
2147
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2178,7 +2199,8 @@ export default class bingx extends Exchange {
2178
2199
  * @method
2179
2200
  * @name bingx#fetchMarkPrices
2180
2201
  * @description fetches mark prices for multiple markets
2181
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
2202
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
2203
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
2182
2204
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2183
2205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2184
2206
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2340,10 +2362,10 @@ export default class bingx extends Exchange {
2340
2362
  * @method
2341
2363
  * @name bingx#fetchBalance
2342
2364
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2343
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
2344
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20account%20data
2345
- * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance
2346
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Account%20Assets
2365
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Account%20Endpoints/Query%20Assets
2366
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20account%20data
2367
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Account%20Assets
2368
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Query%20Assets
2347
2369
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2348
2370
  * @param {boolean} [params.standard] whether to fetch standard contract balances
2349
2371
  * @param {string} [params.type] the type of balance to fetch (spot, swap, funding) default is `spot`
@@ -2578,7 +2600,7 @@ export default class bingx extends Exchange {
2578
2600
  * @method
2579
2601
  * @name bingx#fetchPositionHistory
2580
2602
  * @description fetches historical positions
2581
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
2603
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Position%20History
2582
2604
  * @param {string} symbol unified contract symbol
2583
2605
  * @param {int} [since] the earliest time in ms to fetch positions for
2584
2606
  * @param {int} [limit] the maximum amount of records to fetch
@@ -2643,9 +2665,9 @@ export default class bingx extends Exchange {
2643
2665
  * @method
2644
2666
  * @name bingx#fetchPositions
2645
2667
  * @description fetch all open positions
2646
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data
2668
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20position%20data
2647
2669
  * @see https://bingx-api.github.io/docs/#/en-us/standard/contract-interface.html#position
2648
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse
2670
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20warehouse
2649
2671
  * @param {string[]|undefined} symbols list of unified market symbols
2650
2672
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2651
2673
  * @param {boolean} [params.standard] whether to fetch standard contract positions
@@ -2742,8 +2764,8 @@ export default class bingx extends Exchange {
2742
2764
  * @method
2743
2765
  * @name bingx#fetchPosition
2744
2766
  * @description fetch data on a single open contract trade position
2745
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data
2746
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse
2767
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20position%20data
2768
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20warehouse
2747
2769
  * @param {string} symbol unified market symbol of the market the position is held in
2748
2770
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2749
2771
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
@@ -3226,10 +3248,10 @@ export default class bingx extends Exchange {
3226
3248
  * @method
3227
3249
  * @name bingx#createOrder
3228
3250
  * @description create a trade order
3229
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
3230
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
3231
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order
3232
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Place%20TWAP%20Order
3251
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Place%20order
3252
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20order
3253
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20TWAP%20Order
3254
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Trade%20order
3233
3255
  * @param {string} symbol unified symbol of the market to create an order in
3234
3256
  * @param {string} type 'market' or 'limit'
3235
3257
  * @param {string} side 'buy' or 'sell'
@@ -3369,8 +3391,8 @@ export default class bingx extends Exchange {
3369
3391
  * @method
3370
3392
  * @name bingx#createOrders
3371
3393
  * @description create a list of trade orders
3372
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders
3373
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order
3394
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Place%20multiple%20orders
3395
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20multiple%20orders
3374
3396
  * @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
3375
3397
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3376
3398
  * @param {boolean} [params.sync] *spot only* if true, multiple orders are ordered serially and all orders do not require the same symbol/side/type
@@ -3888,10 +3910,10 @@ export default class bingx extends Exchange {
3888
3910
  * @method
3889
3911
  * @name bingx#cancelOrder
3890
3912
  * @description cancels an open order
3891
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20Order
3892
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20Order
3893
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20an%20Order
3894
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20TWAP%20Order
3913
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20Order
3914
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20Order
3915
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20TWAP%20Order
3916
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Cancel%20an%20Order
3895
3917
  * @param {string} id order id
3896
3918
  * @param {string} symbol unified symbol of the market the order was made in
3897
3919
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4072,24 +4094,29 @@ export default class bingx extends Exchange {
4072
4094
  * @method
4073
4095
  * @name bingx#cancelAllOrders
4074
4096
  * @description cancel all open orders
4075
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20orders%20by%20symbol
4076
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
4077
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20all%20orders
4097
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20all%20Open%20Orders%20on%20a%20Symbol
4098
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20All%20Open%20Orders
4099
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Cancel%20all%20orders
4078
4100
  * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
4079
4101
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4102
+ * @param {string} [params.type] 'spot' or 'swap' (default is 'spot' if symbol is not provided)
4103
+ * @param {string} [params.subType] 'linear' or 'inverse' for swap markets (default is 'linear' if symbol is not provided)
4080
4104
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
4081
4105
  */
4082
4106
  async cancelAllOrders(symbol = undefined, params = {}) {
4083
- if (symbol === undefined) {
4084
- throw new ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
4085
- }
4086
4107
  await this.loadMarkets();
4087
- const market = this.market(symbol);
4088
- const request = {
4089
- 'symbol': market['id'],
4090
- };
4108
+ let market = undefined;
4109
+ const request = {};
4110
+ if (symbol !== undefined) {
4111
+ market = this.market(symbol);
4112
+ request['symbol'] = market['id'];
4113
+ }
4114
+ let marketType = 'spot';
4115
+ let subType = undefined;
4116
+ [marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
4117
+ [subType, params] = this.handleSubTypeAndParams('cancelAllOrders', market, params);
4091
4118
  let response = undefined;
4092
- if (market['spot']) {
4119
+ if (marketType === 'spot') {
4093
4120
  response = await this.spotV1PrivatePostTradeCancelOpenOrders(this.extend(request, params));
4094
4121
  //
4095
4122
  // {
@@ -4114,8 +4141,8 @@ export default class bingx extends Exchange {
4114
4141
  // }
4115
4142
  //
4116
4143
  }
4117
- else if (market['swap']) {
4118
- if (market['inverse']) {
4144
+ else if (marketType === 'swap') {
4145
+ if (subType === 'inverse') {
4119
4146
  response = await this.cswapV1PrivateDeleteTradeAllOpenOrders(this.extend(request, params));
4120
4147
  //
4121
4148
  // {
@@ -4217,8 +4244,8 @@ export default class bingx extends Exchange {
4217
4244
  * @method
4218
4245
  * @name bingx#cancelOrders
4219
4246
  * @description cancel multiple orders
4220
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders
4221
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders
4247
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20multiple%20orders
4248
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20multiple%20orders
4222
4249
  * @param {string[]} ids order ids
4223
4250
  * @param {string} symbol unified market symbol, default is undefined
4224
4251
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4325,8 +4352,8 @@ export default class bingx extends Exchange {
4325
4352
  * @method
4326
4353
  * @name bingx#cancelAllOrdersAfter
4327
4354
  * @description dead man's switch, cancel all orders after the given timeout
4328
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
4329
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
4355
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20All%20After
4356
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20All%20After
4330
4357
  * @param {number} timeout time in milliseconds, 0 represents cancel the timer
4331
4358
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4332
4359
  * @param {string} [params.type] spot or swap market
@@ -4368,10 +4395,10 @@ export default class bingx extends Exchange {
4368
4395
  * @method
4369
4396
  * @name bingx#fetchOrder
4370
4397
  * @description fetches information on an order made by the user
4371
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
4372
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
4373
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
4374
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#TWAP%20Order%20Details
4398
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20details
4399
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20details
4400
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/TWAP%20Order%20Details
4401
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Order
4375
4402
  * @param {string} id the order id
4376
4403
  * @param {string} symbol unified symbol of the market the order was made in
4377
4404
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4547,8 +4574,8 @@ export default class bingx extends Exchange {
4547
4574
  * @method
4548
4575
  * @name bingx#fetchOrders
4549
4576
  * @description fetches information on multiple orders made by the user
4550
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#All%20Orders
4551
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history (returns less fields than above)
4577
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/All%20Orders
4578
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history (returns less fields than above)
4552
4579
  * @param {string} symbol unified market symbol of the market orders were made in
4553
4580
  * @param {int} [since] the earliest time in ms to fetch orders for
4554
4581
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4638,10 +4665,10 @@ export default class bingx extends Exchange {
4638
4665
  * @method
4639
4666
  * @name bingx#fetchOpenOrders
4640
4667
  * @description fetch all unfilled currently open orders
4641
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current%20Open%20Orders
4642
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Current%20All%20Open%20Orders
4643
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20all%20current%20pending%20orders
4644
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Entrusted%20Order
4668
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Current%20Open%20Orders
4669
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Current%20All%20Open%20Orders
4670
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20all%20current%20pending%20orders
4671
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20TWAP%20Entrusted%20Order
4645
4672
  * @param {string} symbol unified market symbol
4646
4673
  * @param {int} [since] the earliest time in ms to fetch open orders for
4647
4674
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -4825,9 +4852,9 @@ export default class bingx extends Exchange {
4825
4852
  * @method
4826
4853
  * @name bingx#fetchClosedOrders
4827
4854
  * @description fetches information on multiple closed orders made by the user
4828
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4829
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4830
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4855
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4856
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4857
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4831
4858
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4832
4859
  * @param {string} symbol unified market symbol of the closed orders
4833
4860
  * @param {int} [since] timestamp in ms of the earliest order
@@ -4846,9 +4873,9 @@ export default class bingx extends Exchange {
4846
4873
  * @method
4847
4874
  * @name bingx#fetchCanceledOrders
4848
4875
  * @description fetches information on multiple canceled orders made by the user
4849
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4850
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4851
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4876
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4877
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4878
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4852
4879
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4853
4880
  * @param {string} symbol unified market symbol of the canceled orders
4854
4881
  * @param {int} [since] timestamp in ms of the earliest order
@@ -4867,11 +4894,11 @@ export default class bingx extends Exchange {
4867
4894
  * @method
4868
4895
  * @name bingx#fetchCanceledAndClosedOrders
4869
4896
  * @description fetches information on multiple closed orders made by the user
4870
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4871
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4872
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4897
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4898
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4899
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4873
4900
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4874
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Historical%20Orders
4901
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20TWAP%20Historical%20Orders
4875
4902
  * @param {string} [symbol] unified market symbol of the market orders were made in
4876
4903
  * @param {int} [since] the earliest time in ms to fetch orders for
4877
4904
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -5066,7 +5093,7 @@ export default class bingx extends Exchange {
5066
5093
  * @method
5067
5094
  * @name bingx#transfer
5068
5095
  * @description transfer currency internally between wallets on the same account
5069
- * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer%20New
5096
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Asset%20Transfer%20New
5070
5097
  * @param {string} code unified currency code
5071
5098
  * @param {float} amount amount to transfer
5072
5099
  * @param {string} fromAccount account to transfer from (spot, swap, futures, or funding)
@@ -5127,7 +5154,7 @@ export default class bingx extends Exchange {
5127
5154
  * @method
5128
5155
  * @name bingx#fetchTransfers
5129
5156
  * @description fetch a history of internal transfers made on an account
5130
- * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20transfer%20records%20new
5157
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Asset%20transfer%20records%20new
5131
5158
  * @param {string} [code] unified currency code of the currency transferred
5132
5159
  * @param {int} [since] the earliest time in ms to fetch transfers for
5133
5160
  * @param {int} [limit] the maximum number of transfers structures to retrieve (default 10, max 100)
@@ -5225,7 +5252,7 @@ export default class bingx extends Exchange {
5225
5252
  * @method
5226
5253
  * @name bingx#fetchDepositAddressesByNetwork
5227
5254
  * @description fetch the deposit addresses for a currency associated with this account
5228
- * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
5255
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Main%20Account%20Deposit%20Address
5229
5256
  * @param {string} code unified currency code
5230
5257
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5231
5258
  * @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/?id=address-structure}, indexed by the network
@@ -5268,7 +5295,7 @@ export default class bingx extends Exchange {
5268
5295
  * @method
5269
5296
  * @name bingx#fetchDepositAddress
5270
5297
  * @description fetch the deposit address for a currency associated with this account
5271
- * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
5298
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Main%20Account%20Deposit%20Address
5272
5299
  * @param {string} code unified currency code
5273
5300
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5274
5301
  * @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency
@@ -5324,7 +5351,7 @@ export default class bingx extends Exchange {
5324
5351
  * @method
5325
5352
  * @name bingx#fetchDeposits
5326
5353
  * @description fetch all deposits made to an account
5327
- * @see https://bingx-api.github.io/docs/#/spot/account-api.html#Deposit%20History(supporting%20network)
5354
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Wallet%20deposits%20and%20withdrawals/Deposit%20records
5328
5355
  * @param {string} [code] unified currency code
5329
5356
  * @param {int} [since] the earliest time in ms to fetch deposits for
5330
5357
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -5369,7 +5396,7 @@ export default class bingx extends Exchange {
5369
5396
  * @method
5370
5397
  * @name bingx#fetchWithdrawals
5371
5398
  * @description fetch all withdrawals made from an account
5372
- * @see https://bingx-api.github.io/docs/#/spot/account-api.html#Withdraw%20History%20(supporting%20network)
5399
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Wallet%20deposits%20and%20withdrawals/Withdraw%20records
5373
5400
  * @param {string} [code] unified currency code
5374
5401
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
5375
5402
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -5531,8 +5558,8 @@ export default class bingx extends Exchange {
5531
5558
  * @method
5532
5559
  * @name bingx#setMarginMode
5533
5560
  * @description set margin mode to 'cross' or 'isolated'
5534
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
5535
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
5561
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Change%20Margin%20Type
5562
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Set%20Margin%20Type
5536
5563
  * @param {string} marginMode 'cross' or 'isolated'
5537
5564
  * @param {string} symbol unified market symbol
5538
5565
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -5583,7 +5610,7 @@ export default class bingx extends Exchange {
5583
5610
  * @method
5584
5611
  * @name bingx#setMargin
5585
5612
  * @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
5586
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Adjust%20isolated%20margin
5613
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Modify%20Isolated%20Position%20Margin
5587
5614
  * @param {string} symbol unified market symbol of the market to set margin in
5588
5615
  * @param {float} amount the amount to set the margin to
5589
5616
  * @param {object} [params] parameters specific to the bingx api endpoint
@@ -5642,8 +5669,8 @@ export default class bingx extends Exchange {
5642
5669
  * @method
5643
5670
  * @name bingx#fetchLeverage
5644
5671
  * @description fetch the set leverage for a market
5645
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Leverage
5646
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Leverage
5672
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Leverage%20and%20Available%20Positions
5673
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Leverage
5647
5674
  * @param {string} symbol unified market symbol
5648
5675
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5649
5676
  * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/?id=leverage-structure}
@@ -5740,8 +5767,8 @@ export default class bingx extends Exchange {
5740
5767
  * @method
5741
5768
  * @name bingx#setLeverage
5742
5769
  * @description set the level of leverage for a market
5743
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Switch%20Leverage
5744
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Modify%20Leverage
5770
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Set%20Leverage
5771
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Modify%20Leverage
5745
5772
  * @param {float} leverage the rate of leverage
5746
5773
  * @param {string} symbol unified market symbol
5747
5774
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -5804,10 +5831,9 @@ export default class bingx extends Exchange {
5804
5831
  * @method
5805
5832
  * @name bingx#fetchMyTrades
5806
5833
  * @description fetch all trades made by the user
5807
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20transaction%20details
5808
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20orders
5809
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20details
5810
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order%20Trade%20Detail
5834
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20transaction%20details
5835
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20historical%20transaction%20orders
5836
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Order%20Trade%20Detail
5811
5837
  * @param {string} [symbol] unified market symbol
5812
5838
  * @param {int} [since] the earliest time in ms to fetch trades for
5813
5839
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -5983,7 +6009,7 @@ export default class bingx extends Exchange {
5983
6009
  * @method
5984
6010
  * @name bingx#fetchDepositWithdrawFees
5985
6011
  * @description fetch deposit and withdraw fees
5986
- * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins'%20Information
6012
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Query%20currency%20deposit%20and%20withdrawal%20data
5987
6013
  * @param {string[]|undefined} codes list of unified currency codes
5988
6014
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5989
6015
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
@@ -6006,7 +6032,7 @@ export default class bingx extends Exchange {
6006
6032
  * @method
6007
6033
  * @name bingx#withdraw
6008
6034
  * @description make a withdrawal
6009
- * @see https://bingx-api.github.io/docs/#/en-us/spot/wallet-api.html#Withdraw
6035
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Withdraw
6010
6036
  * @param {string} code unified currency code
6011
6037
  * @param {float} amount the amount to withdraw
6012
6038
  * @param {string} address the address to withdraw to
@@ -6082,8 +6108,8 @@ export default class bingx extends Exchange {
6082
6108
  * @method
6083
6109
  * @name bingx#fetchMyLiquidations
6084
6110
  * @description retrieves the users liquidated positions
6085
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#User's%20Force%20Orders
6086
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20force%20orders
6111
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/User's%20Force%20Orders
6112
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20force%20orders
6087
6113
  * @param {string} [symbol] unified CCXT market symbol
6088
6114
  * @param {int} [since] the earliest time in ms to fetch liquidations for
6089
6115
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
@@ -6224,8 +6250,9 @@ export default class bingx extends Exchange {
6224
6250
  * @method
6225
6251
  * @name bingx#closePosition
6226
6252
  * @description closes open positions for a market
6227
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
6228
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Close%20all%20positions%20in%20bulk
6253
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20All%20Positions
6254
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20position%20by%20position%20ID
6255
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Close%20all%20positions%20in%20bulk
6229
6256
  * @param {string} symbol Unified CCXT market symbol
6230
6257
  * @param {string} [side] not used by bingx
6231
6258
  * @param {object} [params] extra parameters specific to the bingx api endpoint
@@ -6296,8 +6323,8 @@ export default class bingx extends Exchange {
6296
6323
  * @method
6297
6324
  * @name bitget#closePositions
6298
6325
  * @description closes open positions for a market
6299
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
6300
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Close%20all%20positions%20in%20bulk
6326
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20All%20Positions
6327
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Close%20all%20positions%20in%20bulk
6301
6328
  * @param {object} [params] extra parameters specific to the bingx api endpoint
6302
6329
  * @param {string} [params.recvWindow] request valid time window value
6303
6330
  * @returns {object[]} [a list of position structures]{@link https://docs.ccxt.com/?id=position-structure}
@@ -6360,7 +6387,7 @@ export default class bingx extends Exchange {
6360
6387
  * @method
6361
6388
  * @name bingx#fetchPositionMode
6362
6389
  * @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
6363
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
6390
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20position%20mode
6364
6391
  * @param {string} symbol unified symbol of the market to fetch the order book for
6365
6392
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6366
6393
  * @returns {object} an object detailing whether the market is in hedged or one-way mode
@@ -6388,7 +6415,7 @@ export default class bingx extends Exchange {
6388
6415
  * @method
6389
6416
  * @name bingx#setPositionMode
6390
6417
  * @description set hedged to true or false for a market
6391
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode
6418
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Set%20Position%20Mode
6392
6419
  * @param {bool} hedged set to true to use dualSidePosition
6393
6420
  * @param {string} symbol not used by bingx setPositionMode ()
6394
6421
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -6419,8 +6446,8 @@ export default class bingx extends Exchange {
6419
6446
  * @method
6420
6447
  * @name bingx#editOrder
6421
6448
  * @description cancels an order and places a new order
6422
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20order%20and%20place%20a%20new%20order // spot
6423
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20an%20order%20and%20then%20Place%20a%20new%20order // swap
6449
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Order // spot
6450
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Orde // swap
6424
6451
  * @param {string} id order id
6425
6452
  * @param {string} symbol unified symbol of the market to create an order in
6426
6453
  * @param {string} type 'market' or 'limit'
@@ -6557,8 +6584,8 @@ export default class bingx extends Exchange {
6557
6584
  * @method
6558
6585
  * @name bingx#fetchMarginMode
6559
6586
  * @description fetches the margin mode of the trading pair
6560
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
6561
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
6587
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Margin%20Type
6588
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Margin%20Type
6562
6589
  * @param {string} symbol unified symbol of the market to fetch the margin mode for
6563
6590
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6564
6591
  * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/?id=margin-mode-structure}
@@ -6615,9 +6642,9 @@ export default class bingx extends Exchange {
6615
6642
  * @method
6616
6643
  * @name bingx#fetchTradingFee
6617
6644
  * @description fetch the trading fees for a market
6618
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Trading%20Commission%20Rate
6619
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20Trading%20Commission%20Rate
6620
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Trade%20Commission%20Rate
6645
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Trading%20Commission%20Rate
6646
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20Trading%20Commission%20Rate
6647
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Trade%20Commission%20Rate
6621
6648
  * @param {string} symbol unified market symbol
6622
6649
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6623
6650
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure}
@@ -6818,10 +6845,10 @@ export default class bingx extends Exchange {
6818
6845
  let version = section[1];
6819
6846
  let access = section[2];
6820
6847
  const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
6821
- if (isSandbox && (type !== 'swap')) {
6848
+ let url = this.implodeHostname(this.urls['api'][type]);
6849
+ if (isSandbox && url === undefined) {
6822
6850
  throw new NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
6823
6851
  }
6824
- let url = this.implodeHostname(this.urls['api'][type]);
6825
6852
  path = this.implodeParams(path, params);
6826
6853
  const versionIsTransfer = (version === 'transfer');
6827
6854
  const versionIsAsset = (version === 'asset');