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
@@ -140,7 +140,17 @@ class bingx extends bingx$1["default"] {
140
140
  'api': 'https://open-api.{hostname}/openApi',
141
141
  },
142
142
  'test': {
143
- '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
143
+ 'fund': 'https://open-api-vst.{hostname}/openApi',
144
+ 'spot': 'https://open-api-vst.{hostname}/openApi',
145
+ 'swap': 'https://open-api-vst.{hostname}/openApi',
146
+ 'contract': 'https://open-api-vst.{hostname}/openApi',
147
+ 'wallets': 'https://open-api-vst.{hostname}/openApi',
148
+ 'user': 'https://open-api-vst.{hostname}/openApi',
149
+ 'subAccount': 'https://open-api-vst.{hostname}/openApi',
150
+ 'account': 'https://open-api-vst.{hostname}/openApi',
151
+ 'copyTrading': 'https://open-api-vst.{hostname}/openApi',
152
+ 'cswap': 'https://open-api-vst.{hostname}/openApi',
153
+ 'api': 'https://open-api-vst.{hostname}/openApi',
144
154
  },
145
155
  'www': 'https://bingx.com/',
146
156
  'doc': 'https://bingx-api.github.io/docs/',
@@ -797,7 +807,7 @@ class bingx extends bingx$1["default"] {
797
807
  * @method
798
808
  * @name bingx#fetchCurrencies
799
809
  * @description fetches all available currencies on an exchange
800
- * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins
810
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Query%20currency%20deposit%20and%20withdrawal%20data
801
811
  * @param {object} [params] extra parameters specific to the exchange API endpoint
802
812
  * @returns {object} an associative dictionary of currencies
803
813
  */
@@ -1122,9 +1132,9 @@ class bingx extends bingx$1["default"] {
1122
1132
  * @method
1123
1133
  * @name bingx#fetchMarkets
1124
1134
  * @description retrieves data on all markets for bingx
1125
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
1126
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
1127
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information
1135
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Spot%20trading%20symbols
1136
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/USDT-M%20Perp%20Futures%20symbols
1137
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Contract%20Information
1128
1138
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1129
1139
  * @returns {object[]} an array of objects representing market data
1130
1140
  */
@@ -1146,11 +1156,10 @@ class bingx extends bingx$1["default"] {
1146
1156
  * @method
1147
1157
  * @name bingx#fetchOHLCV
1148
1158
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1149
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
1150
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
1151
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
1152
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data
1153
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
1159
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Kline%2FCandlestick%20Data
1160
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Kline%2FCandlestick%20Data
1161
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20Kline%2FCandlestick%20Data
1162
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Get%20K-line%20Data
1154
1163
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1155
1164
  * @param {string} timeframe the length of time each candle represents
1156
1165
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1300,8 +1309,8 @@ class bingx extends bingx$1["default"] {
1300
1309
  * @method
1301
1310
  * @name bingx#fetchTrades
1302
1311
  * @description get the list of most recent trades for a particular symbol
1303
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20transaction%20records
1304
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#The%20latest%20Trade%20of%20a%20Trading%20Pair
1312
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Recent%20Trades%20List
1313
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Recent%20Trades%20List
1305
1314
  * @param {string} symbol unified symbol of the market to fetch trades for
1306
1315
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1307
1316
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1534,9 +1543,9 @@ class bingx extends bingx$1["default"] {
1534
1543
  * @method
1535
1544
  * @name bingx#fetchOrderBook
1536
1545
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1537
- * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
1538
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
1539
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
1546
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/Order%20Book
1547
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Order%20Book
1548
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%20Depth%20Data
1540
1549
  * @param {string} symbol unified symbol of the market to fetch the order book for
1541
1550
  * @param {int} [limit] the maximum amount of order book entries to return
1542
1551
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1650,8 +1659,8 @@ class bingx extends bingx$1["default"] {
1650
1659
  * @method
1651
1660
  * @name bingx#fetchFundingRate
1652
1661
  * @description fetch the current funding rate
1653
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
1654
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
1662
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
1663
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
1655
1664
  * @param {string} symbol unified market symbol
1656
1665
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1657
1666
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/?id=funding-rate-structure}
@@ -1692,15 +1701,26 @@ class bingx extends bingx$1["default"] {
1692
1701
  * @method
1693
1702
  * @name bingx#fetchFundingRates
1694
1703
  * @description fetch the current funding rate for multiple symbols
1695
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
1704
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
1705
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
1696
1706
  * @param {string[]} [symbols] list of unified market symbols
1697
1707
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1708
+ * @param {string} [params.subType] "linear" or "inverse" (default is linear)
1698
1709
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-structure}
1699
1710
  */
1700
1711
  async fetchFundingRates(symbols = undefined, params = {}) {
1701
1712
  await this.loadMarkets();
1702
- symbols = this.marketSymbols(symbols, 'swap', true);
1703
- const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1713
+ symbols = this.marketSymbols(symbols, 'swap', true, true, true);
1714
+ const firstMarket = this.getMarketFromSymbols(symbols);
1715
+ let subType = 'linear';
1716
+ [subType, params] = this.handleSubTypeAndParams('fetchFundingRates', firstMarket, params, subType);
1717
+ let response = undefined;
1718
+ if (subType === 'inverse') {
1719
+ response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(params));
1720
+ }
1721
+ else {
1722
+ response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1723
+ }
1704
1724
  const data = this.safeList(response, 'data', []);
1705
1725
  return this.parseFundingRates(data, symbols);
1706
1726
  }
@@ -1741,7 +1761,7 @@ class bingx extends bingx$1["default"] {
1741
1761
  * @method
1742
1762
  * @name bingx#fetchFundingRateHistory
1743
1763
  * @description fetches historical funding rate prices
1744
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Funding%20Rate%20History
1764
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Get%20Funding%20Rate%20History
1745
1765
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1746
1766
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1747
1767
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure} to fetch
@@ -1897,8 +1917,8 @@ class bingx extends bingx$1["default"] {
1897
1917
  * @method
1898
1918
  * @name bingx#fetchOpenInterest
1899
1919
  * @description retrieves the open interest of a trading pair
1900
- * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
1901
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
1920
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Open%20Interest%20Statistics
1921
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Get%20Swap%20Open%20Positions
1902
1922
  * @param {string} symbol unified CCXT market symbol
1903
1923
  * @param {object} [params] exchange specific parameters
1904
1924
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
@@ -1991,9 +2011,9 @@ class bingx extends bingx$1["default"] {
1991
2011
  * @method
1992
2012
  * @name bingx#fetchTicker
1993
2013
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1994
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker
1995
- * @see https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes
1996
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change
2014
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2015
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2016
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%2024-Hour%20Price%20Change
1997
2017
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1998
2018
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1999
2019
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2056,9 +2076,9 @@ class bingx extends bingx$1["default"] {
2056
2076
  * @method
2057
2077
  * @name bingx#fetchTickers
2058
2078
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
2059
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker
2060
- * @see https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes
2061
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change
2079
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2080
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/24hr%20Ticker%20Price%20Change%20Statistics
2081
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Query%2024-Hour%20Price%20Change
2062
2082
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2063
2083
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2064
2084
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2125,7 +2145,8 @@ class bingx extends bingx$1["default"] {
2125
2145
  * @method
2126
2146
  * @name bingx#fetchMarkPrice
2127
2147
  * @description fetches mark prices for the market
2128
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
2148
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
2149
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
2129
2150
  * @param {string} symbol unified symbol of the market to fetch the ticker for
2130
2151
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2131
2152
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2183,7 +2204,8 @@ class bingx extends bingx$1["default"] {
2183
2204
  * @method
2184
2205
  * @name bingx#fetchMarkPrices
2185
2206
  * @description fetches mark prices for multiple markets
2186
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
2207
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Market%20Data/Mark%20Price%20and%20Funding%20Rate
2208
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Market%20Data/Price%20%26%20Current%20Funding%20Rate
2187
2209
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2188
2210
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2189
2211
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
@@ -2345,10 +2367,10 @@ class bingx extends bingx$1["default"] {
2345
2367
  * @method
2346
2368
  * @name bingx#fetchBalance
2347
2369
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2348
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
2349
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20account%20data
2350
- * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance
2351
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Account%20Assets
2370
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Account%20Endpoints/Query%20Assets
2371
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20account%20data
2372
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Account%20Assets
2373
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Query%20Assets
2352
2374
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2353
2375
  * @param {boolean} [params.standard] whether to fetch standard contract balances
2354
2376
  * @param {string} [params.type] the type of balance to fetch (spot, swap, funding) default is `spot`
@@ -2583,7 +2605,7 @@ class bingx extends bingx$1["default"] {
2583
2605
  * @method
2584
2606
  * @name bingx#fetchPositionHistory
2585
2607
  * @description fetches historical positions
2586
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History
2608
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Position%20History
2587
2609
  * @param {string} symbol unified contract symbol
2588
2610
  * @param {int} [since] the earliest time in ms to fetch positions for
2589
2611
  * @param {int} [limit] the maximum amount of records to fetch
@@ -2648,9 +2670,9 @@ class bingx extends bingx$1["default"] {
2648
2670
  * @method
2649
2671
  * @name bingx#fetchPositions
2650
2672
  * @description fetch all open positions
2651
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data
2673
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20position%20data
2652
2674
  * @see https://bingx-api.github.io/docs/#/en-us/standard/contract-interface.html#position
2653
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse
2675
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20warehouse
2654
2676
  * @param {string[]|undefined} symbols list of unified market symbols
2655
2677
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2656
2678
  * @param {boolean} [params.standard] whether to fetch standard contract positions
@@ -2747,8 +2769,8 @@ class bingx extends bingx$1["default"] {
2747
2769
  * @method
2748
2770
  * @name bingx#fetchPosition
2749
2771
  * @description fetch data on a single open contract trade position
2750
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data
2751
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse
2772
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20position%20data
2773
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20warehouse
2752
2774
  * @param {string} symbol unified market symbol of the market the position is held in
2753
2775
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2754
2776
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
@@ -3231,10 +3253,10 @@ class bingx extends bingx$1["default"] {
3231
3253
  * @method
3232
3254
  * @name bingx#createOrder
3233
3255
  * @description create a trade order
3234
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
3235
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
3236
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order
3237
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Place%20TWAP%20Order
3256
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Place%20order
3257
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20order
3258
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20TWAP%20Order
3259
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Trade%20order
3238
3260
  * @param {string} symbol unified symbol of the market to create an order in
3239
3261
  * @param {string} type 'market' or 'limit'
3240
3262
  * @param {string} side 'buy' or 'sell'
@@ -3374,8 +3396,8 @@ class bingx extends bingx$1["default"] {
3374
3396
  * @method
3375
3397
  * @name bingx#createOrders
3376
3398
  * @description create a list of trade orders
3377
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders
3378
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order
3399
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Place%20multiple%20orders
3400
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20multiple%20orders
3379
3401
  * @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
3380
3402
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3381
3403
  * @param {boolean} [params.sync] *spot only* if true, multiple orders are ordered serially and all orders do not require the same symbol/side/type
@@ -3893,10 +3915,10 @@ class bingx extends bingx$1["default"] {
3893
3915
  * @method
3894
3916
  * @name bingx#cancelOrder
3895
3917
  * @description cancels an open order
3896
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20Order
3897
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20Order
3898
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20an%20Order
3899
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20TWAP%20Order
3918
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20Order
3919
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20Order
3920
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20TWAP%20Order
3921
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Cancel%20an%20Order
3900
3922
  * @param {string} id order id
3901
3923
  * @param {string} symbol unified symbol of the market the order was made in
3902
3924
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4077,24 +4099,29 @@ class bingx extends bingx$1["default"] {
4077
4099
  * @method
4078
4100
  * @name bingx#cancelAllOrders
4079
4101
  * @description cancel all open orders
4080
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20orders%20by%20symbol
4081
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
4082
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20all%20orders
4102
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20all%20Open%20Orders%20on%20a%20Symbol
4103
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20All%20Open%20Orders
4104
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Cancel%20all%20orders
4083
4105
  * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
4084
4106
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4107
+ * @param {string} [params.type] 'spot' or 'swap' (default is 'spot' if symbol is not provided)
4108
+ * @param {string} [params.subType] 'linear' or 'inverse' for swap markets (default is 'linear' if symbol is not provided)
4085
4109
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
4086
4110
  */
4087
4111
  async cancelAllOrders(symbol = undefined, params = {}) {
4088
- if (symbol === undefined) {
4089
- throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
4090
- }
4091
4112
  await this.loadMarkets();
4092
- const market = this.market(symbol);
4093
- const request = {
4094
- 'symbol': market['id'],
4095
- };
4113
+ let market = undefined;
4114
+ const request = {};
4115
+ if (symbol !== undefined) {
4116
+ market = this.market(symbol);
4117
+ request['symbol'] = market['id'];
4118
+ }
4119
+ let marketType = 'spot';
4120
+ let subType = undefined;
4121
+ [marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
4122
+ [subType, params] = this.handleSubTypeAndParams('cancelAllOrders', market, params);
4096
4123
  let response = undefined;
4097
- if (market['spot']) {
4124
+ if (marketType === 'spot') {
4098
4125
  response = await this.spotV1PrivatePostTradeCancelOpenOrders(this.extend(request, params));
4099
4126
  //
4100
4127
  // {
@@ -4119,8 +4146,8 @@ class bingx extends bingx$1["default"] {
4119
4146
  // }
4120
4147
  //
4121
4148
  }
4122
- else if (market['swap']) {
4123
- if (market['inverse']) {
4149
+ else if (marketType === 'swap') {
4150
+ if (subType === 'inverse') {
4124
4151
  response = await this.cswapV1PrivateDeleteTradeAllOpenOrders(this.extend(request, params));
4125
4152
  //
4126
4153
  // {
@@ -4222,8 +4249,8 @@ class bingx extends bingx$1["default"] {
4222
4249
  * @method
4223
4250
  * @name bingx#cancelOrders
4224
4251
  * @description cancel multiple orders
4225
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders
4226
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders
4252
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20multiple%20orders
4253
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20multiple%20orders
4227
4254
  * @param {string[]} ids order ids
4228
4255
  * @param {string} symbol unified market symbol, default is undefined
4229
4256
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4330,8 +4357,8 @@ class bingx extends bingx$1["default"] {
4330
4357
  * @method
4331
4358
  * @name bingx#cancelAllOrdersAfter
4332
4359
  * @description dead man's switch, cancel all orders after the given timeout
4333
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
4334
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
4360
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20All%20After
4361
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20All%20After
4335
4362
  * @param {number} timeout time in milliseconds, 0 represents cancel the timer
4336
4363
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4337
4364
  * @param {string} [params.type] spot or swap market
@@ -4373,10 +4400,10 @@ class bingx extends bingx$1["default"] {
4373
4400
  * @method
4374
4401
  * @name bingx#fetchOrder
4375
4402
  * @description fetches information on an order made by the user
4376
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
4377
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
4378
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
4379
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#TWAP%20Order%20Details
4403
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20details
4404
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20details
4405
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/TWAP%20Order%20Details
4406
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Order
4380
4407
  * @param {string} id the order id
4381
4408
  * @param {string} symbol unified symbol of the market the order was made in
4382
4409
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4552,8 +4579,8 @@ class bingx extends bingx$1["default"] {
4552
4579
  * @method
4553
4580
  * @name bingx#fetchOrders
4554
4581
  * @description fetches information on multiple orders made by the user
4555
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#All%20Orders
4556
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history (returns less fields than above)
4582
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/All%20Orders
4583
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history (returns less fields than above)
4557
4584
  * @param {string} symbol unified market symbol of the market orders were made in
4558
4585
  * @param {int} [since] the earliest time in ms to fetch orders for
4559
4586
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4643,10 +4670,10 @@ class bingx extends bingx$1["default"] {
4643
4670
  * @method
4644
4671
  * @name bingx#fetchOpenOrders
4645
4672
  * @description fetch all unfilled currently open orders
4646
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current%20Open%20Orders
4647
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Current%20All%20Open%20Orders
4648
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20all%20current%20pending%20orders
4649
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Entrusted%20Order
4673
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Current%20Open%20Orders
4674
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Current%20All%20Open%20Orders
4675
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20all%20current%20pending%20orders
4676
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20TWAP%20Entrusted%20Order
4650
4677
  * @param {string} symbol unified market symbol
4651
4678
  * @param {int} [since] the earliest time in ms to fetch open orders for
4652
4679
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -4830,9 +4857,9 @@ class bingx extends bingx$1["default"] {
4830
4857
  * @method
4831
4858
  * @name bingx#fetchClosedOrders
4832
4859
  * @description fetches information on multiple closed orders made by the user
4833
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4834
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4835
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4860
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4861
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4862
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4836
4863
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4837
4864
  * @param {string} symbol unified market symbol of the closed orders
4838
4865
  * @param {int} [since] timestamp in ms of the earliest order
@@ -4851,9 +4878,9 @@ class bingx extends bingx$1["default"] {
4851
4878
  * @method
4852
4879
  * @name bingx#fetchCanceledOrders
4853
4880
  * @description fetches information on multiple canceled orders made by the user
4854
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4855
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4856
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4881
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4882
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4883
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4857
4884
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4858
4885
  * @param {string} symbol unified market symbol of the canceled orders
4859
4886
  * @param {int} [since] timestamp in ms of the earliest order
@@ -4872,11 +4899,11 @@ class bingx extends bingx$1["default"] {
4872
4899
  * @method
4873
4900
  * @name bingx#fetchCanceledAndClosedOrders
4874
4901
  * @description fetches information on multiple closed orders made by the user
4875
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4876
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4877
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4902
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Order%20history
4903
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Order%20history
4904
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/User's%20History%20Orders
4878
4905
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4879
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Historical%20Orders
4906
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20TWAP%20Historical%20Orders
4880
4907
  * @param {string} [symbol] unified market symbol of the market orders were made in
4881
4908
  * @param {int} [since] the earliest time in ms to fetch orders for
4882
4909
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -5071,7 +5098,7 @@ class bingx extends bingx$1["default"] {
5071
5098
  * @method
5072
5099
  * @name bingx#transfer
5073
5100
  * @description transfer currency internally between wallets on the same account
5074
- * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer%20New
5101
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Asset%20Transfer%20New
5075
5102
  * @param {string} code unified currency code
5076
5103
  * @param {float} amount amount to transfer
5077
5104
  * @param {string} fromAccount account to transfer from (spot, swap, futures, or funding)
@@ -5132,7 +5159,7 @@ class bingx extends bingx$1["default"] {
5132
5159
  * @method
5133
5160
  * @name bingx#fetchTransfers
5134
5161
  * @description fetch a history of internal transfers made on an account
5135
- * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20transfer%20records%20new
5162
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Fund%20Account/Asset%20transfer%20records%20new
5136
5163
  * @param {string} [code] unified currency code of the currency transferred
5137
5164
  * @param {int} [since] the earliest time in ms to fetch transfers for
5138
5165
  * @param {int} [limit] the maximum number of transfers structures to retrieve (default 10, max 100)
@@ -5230,7 +5257,7 @@ class bingx extends bingx$1["default"] {
5230
5257
  * @method
5231
5258
  * @name bingx#fetchDepositAddressesByNetwork
5232
5259
  * @description fetch the deposit addresses for a currency associated with this account
5233
- * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
5260
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Main%20Account%20Deposit%20Address
5234
5261
  * @param {string} code unified currency code
5235
5262
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5236
5263
  * @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/?id=address-structure}, indexed by the network
@@ -5273,7 +5300,7 @@ class bingx extends bingx$1["default"] {
5273
5300
  * @method
5274
5301
  * @name bingx#fetchDepositAddress
5275
5302
  * @description fetch the deposit address for a currency associated with this account
5276
- * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
5303
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Main%20Account%20Deposit%20Address
5277
5304
  * @param {string} code unified currency code
5278
5305
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5279
5306
  * @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency
@@ -5329,7 +5356,7 @@ class bingx extends bingx$1["default"] {
5329
5356
  * @method
5330
5357
  * @name bingx#fetchDeposits
5331
5358
  * @description fetch all deposits made to an account
5332
- * @see https://bingx-api.github.io/docs/#/spot/account-api.html#Deposit%20History(supporting%20network)
5359
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Wallet%20deposits%20and%20withdrawals/Deposit%20records
5333
5360
  * @param {string} [code] unified currency code
5334
5361
  * @param {int} [since] the earliest time in ms to fetch deposits for
5335
5362
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -5374,7 +5401,7 @@ class bingx extends bingx$1["default"] {
5374
5401
  * @method
5375
5402
  * @name bingx#fetchWithdrawals
5376
5403
  * @description fetch all withdrawals made from an account
5377
- * @see https://bingx-api.github.io/docs/#/spot/account-api.html#Withdraw%20History%20(supporting%20network)
5404
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Wallet%20deposits%20and%20withdrawals/Withdraw%20records
5378
5405
  * @param {string} [code] unified currency code
5379
5406
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
5380
5407
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -5536,8 +5563,8 @@ class bingx extends bingx$1["default"] {
5536
5563
  * @method
5537
5564
  * @name bingx#setMarginMode
5538
5565
  * @description set margin mode to 'cross' or 'isolated'
5539
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
5540
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
5566
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Change%20Margin%20Type
5567
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Set%20Margin%20Type
5541
5568
  * @param {string} marginMode 'cross' or 'isolated'
5542
5569
  * @param {string} symbol unified market symbol
5543
5570
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -5588,7 +5615,7 @@ class bingx extends bingx$1["default"] {
5588
5615
  * @method
5589
5616
  * @name bingx#setMargin
5590
5617
  * @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
5591
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Adjust%20isolated%20margin
5618
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Modify%20Isolated%20Position%20Margin
5592
5619
  * @param {string} symbol unified market symbol of the market to set margin in
5593
5620
  * @param {float} amount the amount to set the margin to
5594
5621
  * @param {object} [params] parameters specific to the bingx api endpoint
@@ -5647,8 +5674,8 @@ class bingx extends bingx$1["default"] {
5647
5674
  * @method
5648
5675
  * @name bingx#fetchLeverage
5649
5676
  * @description fetch the set leverage for a market
5650
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Leverage
5651
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Leverage
5677
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Leverage%20and%20Available%20Positions
5678
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Leverage
5652
5679
  * @param {string} symbol unified market symbol
5653
5680
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5654
5681
  * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/?id=leverage-structure}
@@ -5745,8 +5772,8 @@ class bingx extends bingx$1["default"] {
5745
5772
  * @method
5746
5773
  * @name bingx#setLeverage
5747
5774
  * @description set the level of leverage for a market
5748
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Switch%20Leverage
5749
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Modify%20Leverage
5775
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Set%20Leverage
5776
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Modify%20Leverage
5750
5777
  * @param {float} leverage the rate of leverage
5751
5778
  * @param {string} symbol unified market symbol
5752
5779
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -5809,10 +5836,9 @@ class bingx extends bingx$1["default"] {
5809
5836
  * @method
5810
5837
  * @name bingx#fetchMyTrades
5811
5838
  * @description fetch all trades made by the user
5812
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20transaction%20details
5813
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20orders
5814
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20details
5815
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order%20Trade%20Detail
5839
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20transaction%20details
5840
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20historical%20transaction%20orders
5841
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Order%20Trade%20Detail
5816
5842
  * @param {string} [symbol] unified market symbol
5817
5843
  * @param {int} [since] the earliest time in ms to fetch trades for
5818
5844
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -5988,7 +6014,7 @@ class bingx extends bingx$1["default"] {
5988
6014
  * @method
5989
6015
  * @name bingx#fetchDepositWithdrawFees
5990
6016
  * @description fetch deposit and withdraw fees
5991
- * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins'%20Information
6017
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Query%20currency%20deposit%20and%20withdrawal%20data
5992
6018
  * @param {string[]|undefined} codes list of unified currency codes
5993
6019
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5994
6020
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}
@@ -6011,7 +6037,7 @@ class bingx extends bingx$1["default"] {
6011
6037
  * @method
6012
6038
  * @name bingx#withdraw
6013
6039
  * @description make a withdrawal
6014
- * @see https://bingx-api.github.io/docs/#/en-us/spot/wallet-api.html#Withdraw
6040
+ * @see https://bingx-api.github.io/docs-v3/#/en/Account%20and%20Wallet/Wallet%20Deposits%20and%20Withdrawals/Withdraw
6015
6041
  * @param {string} code unified currency code
6016
6042
  * @param {float} amount the amount to withdraw
6017
6043
  * @param {string} address the address to withdraw to
@@ -6087,8 +6113,8 @@ class bingx extends bingx$1["default"] {
6087
6113
  * @method
6088
6114
  * @name bingx#fetchMyLiquidations
6089
6115
  * @description retrieves the users liquidated positions
6090
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#User's%20Force%20Orders
6091
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20force%20orders
6116
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/User's%20Force%20Orders
6117
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20force%20orders
6092
6118
  * @param {string} [symbol] unified CCXT market symbol
6093
6119
  * @param {int} [since] the earliest time in ms to fetch liquidations for
6094
6120
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
@@ -6229,8 +6255,9 @@ class bingx extends bingx$1["default"] {
6229
6255
  * @method
6230
6256
  * @name bingx#closePosition
6231
6257
  * @description closes open positions for a market
6232
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
6233
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Close%20all%20positions%20in%20bulk
6258
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20All%20Positions
6259
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20position%20by%20position%20ID
6260
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Close%20all%20positions%20in%20bulk
6234
6261
  * @param {string} symbol Unified CCXT market symbol
6235
6262
  * @param {string} [side] not used by bingx
6236
6263
  * @param {object} [params] extra parameters specific to the bingx api endpoint
@@ -6301,8 +6328,8 @@ class bingx extends bingx$1["default"] {
6301
6328
  * @method
6302
6329
  * @name bitget#closePositions
6303
6330
  * @description closes open positions for a market
6304
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
6305
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Close%20all%20positions%20in%20bulk
6331
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Close%20All%20Positions
6332
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Close%20all%20positions%20in%20bulk
6306
6333
  * @param {object} [params] extra parameters specific to the bingx api endpoint
6307
6334
  * @param {string} [params.recvWindow] request valid time window value
6308
6335
  * @returns {object[]} [a list of position structures]{@link https://docs.ccxt.com/?id=position-structure}
@@ -6365,7 +6392,7 @@ class bingx extends bingx$1["default"] {
6365
6392
  * @method
6366
6393
  * @name bingx#fetchPositionMode
6367
6394
  * @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
6368
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
6395
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20position%20mode
6369
6396
  * @param {string} symbol unified symbol of the market to fetch the order book for
6370
6397
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6371
6398
  * @returns {object} an object detailing whether the market is in hedged or one-way mode
@@ -6393,7 +6420,7 @@ class bingx extends bingx$1["default"] {
6393
6420
  * @method
6394
6421
  * @name bingx#setPositionMode
6395
6422
  * @description set hedged to true or false for a market
6396
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode
6423
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Set%20Position%20Mode
6397
6424
  * @param {bool} hedged set to true to use dualSidePosition
6398
6425
  * @param {string} symbol not used by bingx setPositionMode ()
6399
6426
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -6424,8 +6451,8 @@ class bingx extends bingx$1["default"] {
6424
6451
  * @method
6425
6452
  * @name bingx#editOrder
6426
6453
  * @description cancels an order and places a new order
6427
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20order%20and%20place%20a%20new%20order // spot
6428
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20an%20order%20and%20then%20Place%20a%20new%20order // swap
6454
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Order // spot
6455
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Cancel%20an%20Existing%20Order%20and%20Send%20a%20New%20Orde // swap
6429
6456
  * @param {string} id order id
6430
6457
  * @param {string} symbol unified symbol of the market to create an order in
6431
6458
  * @param {string} type 'market' or 'limit'
@@ -6562,8 +6589,8 @@ class bingx extends bingx$1["default"] {
6562
6589
  * @method
6563
6590
  * @name bingx#fetchMarginMode
6564
6591
  * @description fetches the margin mode of the trading pair
6565
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
6566
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
6592
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Query%20Margin%20Type
6593
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Margin%20Type
6567
6594
  * @param {string} symbol unified symbol of the market to fetch the margin mode for
6568
6595
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6569
6596
  * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/?id=margin-mode-structure}
@@ -6620,9 +6647,9 @@ class bingx extends bingx$1["default"] {
6620
6647
  * @method
6621
6648
  * @name bingx#fetchTradingFee
6622
6649
  * @description fetch the trading fees for a market
6623
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Trading%20Commission%20Rate
6624
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20Trading%20Commission%20Rate
6625
- * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Trade%20Commission%20Rate
6650
+ * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Query%20Trading%20Commission%20Rate
6651
+ * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Account%20Endpoints/Query%20Trading%20Commission%20Rate
6652
+ * @see https://bingx-api.github.io/docs-v3/#/en/Coin-M%20Futures/Trades%20Endpoints/Query%20Trade%20Commission%20Rate
6626
6653
  * @param {string} symbol unified market symbol
6627
6654
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6628
6655
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure}
@@ -6823,10 +6850,10 @@ class bingx extends bingx$1["default"] {
6823
6850
  let version = section[1];
6824
6851
  let access = section[2];
6825
6852
  const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
6826
- if (isSandbox && (type !== 'swap')) {
6853
+ let url = this.implodeHostname(this.urls['api'][type]);
6854
+ if (isSandbox && url === undefined) {
6827
6855
  throw new errors.NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
6828
6856
  }
6829
- let url = this.implodeHostname(this.urls['api'][type]);
6830
6857
  path = this.implodeParams(path, params);
6831
6858
  const versionIsTransfer = (version === 'transfer');
6832
6859
  const versionIsAsset = (version === 'asset');