ccxt 4.1.63 → 4.1.65

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 (293) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +2769 -2653
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +13 -13
  6. package/dist/cjs/src/alpaca.js +10 -10
  7. package/dist/cjs/src/ascendex.js +33 -33
  8. package/dist/cjs/src/base/Exchange.js +6 -6
  9. package/dist/cjs/src/bigone.js +23 -23
  10. package/dist/cjs/src/binance.js +68 -68
  11. package/dist/cjs/src/binanceus.js +33 -3
  12. package/dist/cjs/src/bingx.js +33 -33
  13. package/dist/cjs/src/bit2c.js +11 -11
  14. package/dist/cjs/src/bitbank.js +14 -14
  15. package/dist/cjs/src/bitbns.js +15 -15
  16. package/dist/cjs/src/bitfinex.js +24 -24
  17. package/dist/cjs/src/bitfinex2.js +30 -30
  18. package/dist/cjs/src/bitflyer.js +17 -17
  19. package/dist/cjs/src/bitforex.js +12 -12
  20. package/dist/cjs/src/bitget.js +50 -50
  21. package/dist/cjs/src/bithumb.js +13 -13
  22. package/dist/cjs/src/bitmart.js +74 -59
  23. package/dist/cjs/src/bitmex.js +29 -28
  24. package/dist/cjs/src/bitopro.js +23 -23
  25. package/dist/cjs/src/bitpanda.js +25 -25
  26. package/dist/cjs/src/bitrue.js +26 -26
  27. package/dist/cjs/src/bitso.js +22 -22
  28. package/dist/cjs/src/bitstamp.js +24 -24
  29. package/dist/cjs/src/bittrex.js +31 -31
  30. package/dist/cjs/src/bitvavo.js +23 -23
  31. package/dist/cjs/src/bl3p.js +7 -7
  32. package/dist/cjs/src/blockchaincom.js +23 -23
  33. package/dist/cjs/src/btcalpha.js +17 -17
  34. package/dist/cjs/src/btcbox.js +9 -9
  35. package/dist/cjs/src/btcmarkets.js +19 -19
  36. package/dist/cjs/src/btcturk.js +13 -13
  37. package/dist/cjs/src/bybit.js +71 -67
  38. package/dist/cjs/src/cex.js +17 -17
  39. package/dist/cjs/src/coinbase.js +28 -28
  40. package/dist/cjs/src/coinbasepro.js +27 -27
  41. package/dist/cjs/src/coincheck.js +11 -11
  42. package/dist/cjs/src/coinex.js +42 -42
  43. package/dist/cjs/src/coinlist.js +29 -29
  44. package/dist/cjs/src/coinmate.js +14 -14
  45. package/dist/cjs/src/coinone.js +13 -13
  46. package/dist/cjs/src/coinsph.js +25 -25
  47. package/dist/cjs/src/coinspot.js +9 -9
  48. package/dist/cjs/src/cryptocom.js +33 -32
  49. package/dist/cjs/src/currencycom.js +24 -24
  50. package/dist/cjs/src/delta.js +29 -29
  51. package/dist/cjs/src/deribit.js +35 -35
  52. package/dist/cjs/src/digifinex.js +43 -43
  53. package/dist/cjs/src/exmo.js +30 -30
  54. package/dist/cjs/src/gate.js +39 -39
  55. package/dist/cjs/src/gemini.js +18 -18
  56. package/dist/cjs/src/hitbtc.js +40 -40
  57. package/dist/cjs/src/hollaex.js +26 -26
  58. package/dist/cjs/src/htx.js +48 -48
  59. package/dist/cjs/src/huobijp.js +24 -24
  60. package/dist/cjs/src/idex.js +23 -23
  61. package/dist/cjs/src/independentreserve.js +12 -12
  62. package/dist/cjs/src/indodax.js +16 -16
  63. package/dist/cjs/src/kraken.js +48 -30
  64. package/dist/cjs/src/krakenfutures.js +16 -16
  65. package/dist/cjs/src/kucoin.js +39 -39
  66. package/dist/cjs/src/kucoinfutures.js +24 -24
  67. package/dist/cjs/src/kuna.js +25 -25
  68. package/dist/cjs/src/latoken.js +20 -20
  69. package/dist/cjs/src/lbank.js +24 -24
  70. package/dist/cjs/src/luno.js +27 -28
  71. package/dist/cjs/src/lykke.js +18 -18
  72. package/dist/cjs/src/mercado.js +13 -13
  73. package/dist/cjs/src/mexc.js +47 -45
  74. package/dist/cjs/src/ndax.js +23 -23
  75. package/dist/cjs/src/novadax.js +23 -23
  76. package/dist/cjs/src/oceanex.js +19 -19
  77. package/dist/cjs/src/okcoin.js +25 -25
  78. package/dist/cjs/src/okx.js +53 -53
  79. package/dist/cjs/src/p2b.js +14 -14
  80. package/dist/cjs/src/paymium.js +10 -10
  81. package/dist/cjs/src/phemex.js +162 -123
  82. package/dist/cjs/src/poloniex.js +27 -27
  83. package/dist/cjs/src/poloniexfutures.js +21 -21
  84. package/dist/cjs/src/pro/alpaca.js +6 -6
  85. package/dist/cjs/src/pro/ascendex.js +5 -5
  86. package/dist/cjs/src/pro/binance.js +21 -21
  87. package/dist/cjs/src/pro/bingx.js +6 -6
  88. package/dist/cjs/src/pro/bitfinex.js +4 -4
  89. package/dist/cjs/src/pro/bitfinex2.js +7 -7
  90. package/dist/cjs/src/pro/bitget.js +12 -12
  91. package/dist/cjs/src/pro/bitmart.js +5 -5
  92. package/dist/cjs/src/pro/bitmex.js +8 -8
  93. package/dist/cjs/src/pro/bitopro.js +4 -4
  94. package/dist/cjs/src/pro/bitpanda.js +7 -7
  95. package/dist/cjs/src/pro/bitrue.js +2 -2
  96. package/dist/cjs/src/pro/bitstamp.js +3 -3
  97. package/dist/cjs/src/pro/bittrex.js +7 -7
  98. package/dist/cjs/src/pro/bitvavo.js +6 -6
  99. package/dist/cjs/src/pro/blockchaincom.js +6 -6
  100. package/dist/cjs/src/pro/bybit.js +12 -12
  101. package/dist/cjs/src/pro/cex.js +9 -9
  102. package/dist/cjs/src/pro/coinbase.js +6 -6
  103. package/dist/cjs/src/pro/coinbasepro.js +10 -10
  104. package/dist/cjs/src/pro/coinex.js +7 -7
  105. package/dist/cjs/src/pro/cryptocom.js +13 -13
  106. package/dist/cjs/src/pro/currencycom.js +5 -5
  107. package/dist/cjs/src/pro/deribit.js +7 -7
  108. package/dist/cjs/src/pro/exmo.js +5 -5
  109. package/dist/cjs/src/pro/gate.js +10 -10
  110. package/dist/cjs/src/pro/gemini.js +4 -4
  111. package/dist/cjs/src/pro/hitbtc.js +11 -11
  112. package/dist/cjs/src/pro/hollaex.js +5 -5
  113. package/dist/cjs/src/pro/htx.js +8 -8
  114. package/dist/cjs/src/pro/huobijp.js +4 -4
  115. package/dist/cjs/src/pro/idex.js +5 -5
  116. package/dist/cjs/src/pro/independentreserve.js +2 -2
  117. package/dist/cjs/src/pro/kraken.js +11 -11
  118. package/dist/cjs/src/pro/krakenfutures.js +12 -9
  119. package/dist/cjs/src/pro/kucoin.js +10 -10
  120. package/dist/cjs/src/pro/kucoinfutures.js +8 -8
  121. package/dist/cjs/src/pro/luno.js +4 -4
  122. package/dist/cjs/src/pro/mexc.js +7 -7
  123. package/dist/cjs/src/pro/ndax.js +4 -4
  124. package/dist/cjs/src/pro/okcoin.js +6 -6
  125. package/dist/cjs/src/pro/okx.js +16 -16
  126. package/dist/cjs/src/pro/phemex.js +7 -7
  127. package/dist/cjs/src/pro/poloniex.js +7 -7
  128. package/dist/cjs/src/pro/poloniexfutures.js +5 -5
  129. package/dist/cjs/src/pro/probit.js +6 -6
  130. package/dist/cjs/src/pro/upbit.js +3 -3
  131. package/dist/cjs/src/pro/wazirx.js +7 -7
  132. package/dist/cjs/src/pro/whitebit.js +7 -7
  133. package/dist/cjs/src/pro/woo.js +1 -1
  134. package/dist/cjs/src/probit.js +24 -24
  135. package/dist/cjs/src/tidex.js +15 -15
  136. package/dist/cjs/src/timex.js +19 -19
  137. package/dist/cjs/src/tokocrypto.js +22 -24
  138. package/dist/cjs/src/upbit.js +22 -22
  139. package/dist/cjs/src/wavesexchange.js +19 -19
  140. package/dist/cjs/src/wazirx.js +22 -16
  141. package/dist/cjs/src/whitebit.js +29 -29
  142. package/dist/cjs/src/woo.js +26 -26
  143. package/dist/cjs/src/yobit.js +17 -17
  144. package/dist/cjs/src/zaif.js +10 -10
  145. package/dist/cjs/src/zonda.js +16 -16
  146. package/doc/manual.rst +1 -1
  147. package/doc/readme.rst +1 -1
  148. package/js/ccxt.d.ts +1 -1
  149. package/js/ccxt.js +1 -1
  150. package/js/src/abstract/mexc.d.ts +2 -0
  151. package/js/src/ace.js +13 -13
  152. package/js/src/alpaca.js +10 -10
  153. package/js/src/ascendex.js +33 -33
  154. package/js/src/base/Exchange.js +6 -6
  155. package/js/src/bigone.js +23 -23
  156. package/js/src/binance.js +68 -68
  157. package/js/src/binanceus.js +33 -3
  158. package/js/src/bingx.js +33 -33
  159. package/js/src/bit2c.js +11 -11
  160. package/js/src/bitbank.js +14 -14
  161. package/js/src/bitbns.js +15 -15
  162. package/js/src/bitfinex.js +24 -24
  163. package/js/src/bitfinex2.js +30 -30
  164. package/js/src/bitflyer.js +17 -17
  165. package/js/src/bitforex.js +12 -12
  166. package/js/src/bitget.js +50 -50
  167. package/js/src/bithumb.js +13 -13
  168. package/js/src/bitmart.js +74 -59
  169. package/js/src/bitmex.js +29 -28
  170. package/js/src/bitopro.js +23 -23
  171. package/js/src/bitpanda.js +25 -25
  172. package/js/src/bitrue.js +26 -26
  173. package/js/src/bitso.js +22 -22
  174. package/js/src/bitstamp.js +24 -24
  175. package/js/src/bittrex.js +31 -31
  176. package/js/src/bitvavo.js +23 -23
  177. package/js/src/bl3p.js +7 -7
  178. package/js/src/blockchaincom.js +23 -23
  179. package/js/src/btcalpha.js +17 -17
  180. package/js/src/btcbox.js +9 -9
  181. package/js/src/btcmarkets.js +19 -19
  182. package/js/src/btcturk.js +13 -13
  183. package/js/src/bybit.js +71 -67
  184. package/js/src/cex.js +17 -17
  185. package/js/src/coinbase.js +28 -28
  186. package/js/src/coinbasepro.js +27 -27
  187. package/js/src/coincheck.js +11 -11
  188. package/js/src/coinex.js +42 -42
  189. package/js/src/coinlist.js +29 -29
  190. package/js/src/coinmate.js +14 -14
  191. package/js/src/coinone.js +13 -13
  192. package/js/src/coinsph.js +25 -25
  193. package/js/src/coinspot.js +9 -9
  194. package/js/src/cryptocom.js +33 -32
  195. package/js/src/currencycom.js +24 -24
  196. package/js/src/delta.js +29 -29
  197. package/js/src/deribit.js +35 -35
  198. package/js/src/digifinex.js +43 -43
  199. package/js/src/exmo.js +30 -30
  200. package/js/src/gate.js +39 -39
  201. package/js/src/gemini.js +18 -18
  202. package/js/src/hitbtc.js +40 -40
  203. package/js/src/hollaex.js +26 -26
  204. package/js/src/htx.js +48 -48
  205. package/js/src/huobijp.js +24 -24
  206. package/js/src/idex.js +23 -23
  207. package/js/src/independentreserve.js +12 -12
  208. package/js/src/indodax.js +16 -16
  209. package/js/src/kraken.js +48 -30
  210. package/js/src/krakenfutures.js +16 -16
  211. package/js/src/kucoin.js +39 -39
  212. package/js/src/kucoinfutures.js +24 -24
  213. package/js/src/kuna.js +25 -25
  214. package/js/src/latoken.js +20 -20
  215. package/js/src/lbank.js +24 -24
  216. package/js/src/luno.js +27 -28
  217. package/js/src/lykke.js +18 -18
  218. package/js/src/mercado.js +13 -13
  219. package/js/src/mexc.js +47 -45
  220. package/js/src/ndax.js +23 -23
  221. package/js/src/novadax.js +23 -23
  222. package/js/src/oceanex.js +19 -19
  223. package/js/src/okcoin.js +25 -25
  224. package/js/src/okx.js +53 -53
  225. package/js/src/p2b.js +14 -14
  226. package/js/src/paymium.js +10 -10
  227. package/js/src/phemex.js +162 -123
  228. package/js/src/poloniex.js +27 -27
  229. package/js/src/poloniexfutures.js +21 -21
  230. package/js/src/pro/alpaca.js +6 -6
  231. package/js/src/pro/ascendex.js +5 -5
  232. package/js/src/pro/binance.js +21 -21
  233. package/js/src/pro/bingx.js +6 -6
  234. package/js/src/pro/bitfinex.js +4 -4
  235. package/js/src/pro/bitfinex2.js +7 -7
  236. package/js/src/pro/bitget.js +12 -12
  237. package/js/src/pro/bitmart.js +5 -5
  238. package/js/src/pro/bitmex.js +8 -8
  239. package/js/src/pro/bitopro.js +4 -4
  240. package/js/src/pro/bitpanda.js +7 -7
  241. package/js/src/pro/bitrue.js +2 -2
  242. package/js/src/pro/bitstamp.js +3 -3
  243. package/js/src/pro/bittrex.js +7 -7
  244. package/js/src/pro/bitvavo.js +6 -6
  245. package/js/src/pro/blockchaincom.js +6 -6
  246. package/js/src/pro/bybit.js +12 -12
  247. package/js/src/pro/cex.js +9 -9
  248. package/js/src/pro/coinbase.js +6 -6
  249. package/js/src/pro/coinbasepro.js +10 -10
  250. package/js/src/pro/coinex.js +7 -7
  251. package/js/src/pro/cryptocom.js +13 -13
  252. package/js/src/pro/currencycom.js +5 -5
  253. package/js/src/pro/deribit.js +7 -7
  254. package/js/src/pro/exmo.js +5 -5
  255. package/js/src/pro/gate.js +10 -10
  256. package/js/src/pro/gemini.js +4 -4
  257. package/js/src/pro/hitbtc.js +11 -11
  258. package/js/src/pro/hollaex.js +5 -5
  259. package/js/src/pro/htx.js +8 -8
  260. package/js/src/pro/huobijp.js +4 -4
  261. package/js/src/pro/idex.js +5 -5
  262. package/js/src/pro/independentreserve.js +2 -2
  263. package/js/src/pro/kraken.js +11 -11
  264. package/js/src/pro/krakenfutures.js +12 -9
  265. package/js/src/pro/kucoin.js +10 -10
  266. package/js/src/pro/kucoinfutures.js +8 -8
  267. package/js/src/pro/luno.js +4 -4
  268. package/js/src/pro/mexc.js +7 -7
  269. package/js/src/pro/ndax.js +4 -4
  270. package/js/src/pro/okcoin.js +6 -6
  271. package/js/src/pro/okx.js +16 -16
  272. package/js/src/pro/phemex.js +7 -7
  273. package/js/src/pro/poloniex.js +7 -7
  274. package/js/src/pro/poloniexfutures.js +5 -5
  275. package/js/src/pro/probit.js +6 -6
  276. package/js/src/pro/upbit.js +3 -3
  277. package/js/src/pro/wazirx.js +7 -7
  278. package/js/src/pro/whitebit.js +7 -7
  279. package/js/src/pro/woo.js +1 -1
  280. package/js/src/probit.js +24 -24
  281. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  282. package/js/src/tidex.js +15 -15
  283. package/js/src/timex.js +19 -19
  284. package/js/src/tokocrypto.js +22 -24
  285. package/js/src/upbit.js +22 -22
  286. package/js/src/wavesexchange.js +19 -19
  287. package/js/src/wazirx.js +22 -16
  288. package/js/src/whitebit.js +29 -29
  289. package/js/src/woo.js +26 -26
  290. package/js/src/yobit.js +17 -17
  291. package/js/src/zaif.js +10 -10
  292. package/js/src/zonda.js +16 -16
  293. package/package.json +1 -1
package/js/src/bitmart.js CHANGED
@@ -598,7 +598,7 @@ export default class bitmart extends Exchange {
598
598
  * @method
599
599
  * @name bitmart#fetchTime
600
600
  * @description fetches the current integer timestamp in milliseconds from the exchange server
601
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
601
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
602
602
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
603
603
  */
604
604
  const response = await this.publicGetSystemTime(params);
@@ -620,7 +620,7 @@ export default class bitmart extends Exchange {
620
620
  * @method
621
621
  * @name bitmart#fetchStatus
622
622
  * @description the latest known information on the availability of the exchange API
623
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
623
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
624
624
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
625
625
  */
626
626
  const options = this.safeValue(this.options, 'fetchStatus', {});
@@ -890,7 +890,7 @@ export default class bitmart extends Exchange {
890
890
  * @method
891
891
  * @name bitmart#fetchMarkets
892
892
  * @description retrieves data on all markets for bitmart
893
- * @param {object} [params] extra parameters specific to the exchange api endpoint
893
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
894
894
  * @returns {object[]} an array of objects representing market data
895
895
  */
896
896
  const spot = await this.fetchSpotMarkets(params);
@@ -902,7 +902,7 @@ export default class bitmart extends Exchange {
902
902
  * @method
903
903
  * @name bitmart#fetchCurrencies
904
904
  * @description fetches all available currencies on an exchange
905
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
905
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
906
906
  * @returns {object} an associative dictionary of currencies
907
907
  */
908
908
  const response = await this.publicGetSpotV1Currencies(params);
@@ -956,7 +956,7 @@ export default class bitmart extends Exchange {
956
956
  * @deprecated
957
957
  * @description please use fetchDepositWithdrawFee instead
958
958
  * @param {string} code unified currency code
959
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
959
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
960
960
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
961
961
  */
962
962
  await this.loadMarkets();
@@ -1015,7 +1015,7 @@ export default class bitmart extends Exchange {
1015
1015
  * @name bitmart#fetchDepositWithdrawFee
1016
1016
  * @description fetch the fee for deposits and withdrawals
1017
1017
  * @param {string} code unified currency code
1018
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1018
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1019
1019
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
1020
1020
  */
1021
1021
  await this.loadMarkets();
@@ -1128,22 +1128,24 @@ export default class bitmart extends Exchange {
1128
1128
  * @name bitmart#fetchTicker
1129
1129
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1130
1130
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1131
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1131
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1132
1132
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1133
1133
  */
1134
1134
  await this.loadMarkets();
1135
1135
  const market = this.market(symbol);
1136
1136
  const request = {};
1137
- let method = undefined;
1137
+ let response = undefined;
1138
1138
  if (market['swap']) {
1139
- method = 'publicGetContractV1Tickers';
1140
1139
  request['contract_symbol'] = market['id'];
1140
+ response = await this.publicGetContractV1Tickers(this.extend(request, params));
1141
1141
  }
1142
1142
  else if (market['spot']) {
1143
- method = 'publicGetSpotV1Ticker';
1144
1143
  request['symbol'] = market['id'];
1144
+ response = await this.publicGetSpotV1Ticker(this.extend(request, params));
1145
+ }
1146
+ else {
1147
+ throw new NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
1145
1148
  }
1146
- const response = await this[method](this.extend(request, params));
1147
1149
  //
1148
1150
  // spot
1149
1151
  //
@@ -1214,10 +1216,10 @@ export default class bitmart extends Exchange {
1214
1216
  /**
1215
1217
  * @method
1216
1218
  * @name bitmart#fetchTickers
1217
- * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
1219
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1218
1220
  * @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v2
1219
1221
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1220
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1222
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1221
1223
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1222
1224
  */
1223
1225
  await this.loadMarkets();
@@ -1229,11 +1231,16 @@ export default class bitmart extends Exchange {
1229
1231
  market = this.market(symbol);
1230
1232
  }
1231
1233
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1232
- const method = this.getSupportedMapping(type, {
1233
- 'spot': 'publicGetSpotV2Ticker',
1234
- 'swap': 'publicGetContractV1Tickers',
1235
- });
1236
- const response = await this[method](params);
1234
+ let response = undefined;
1235
+ if (type === 'spot') {
1236
+ response = await this.publicGetSpotV2Ticker(params);
1237
+ }
1238
+ else if (type === 'swap') {
1239
+ response = await this.publicGetContractV1Tickers(params);
1240
+ }
1241
+ else {
1242
+ throw new NotSupported(this.id + ' fetchTickers() does not support ' + type + ' markets, only spot and swap markets are accepted');
1243
+ }
1237
1244
  const data = this.safeValue(response, 'data', {});
1238
1245
  const tickers = this.safeValue(data, 'tickers', []);
1239
1246
  const result = {};
@@ -1253,7 +1260,7 @@ export default class bitmart extends Exchange {
1253
1260
  * @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
1254
1261
  * @param {string} symbol unified symbol of the market to fetch the order book for
1255
1262
  * @param {int} [limit] the maximum amount of order book entries to return
1256
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1263
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1257
1264
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1258
1265
  */
1259
1266
  await this.loadMarkets();
@@ -1426,7 +1433,7 @@ export default class bitmart extends Exchange {
1426
1433
  * @param {string} symbol unified symbol of the market to fetch trades for
1427
1434
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1428
1435
  * @param {int} [limit] the maximum amount of trades to fetch
1429
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1436
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1430
1437
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1431
1438
  */
1432
1439
  await this.loadMarkets();
@@ -1530,7 +1537,7 @@ export default class bitmart extends Exchange {
1530
1537
  * @param {string} timeframe the length of time each candle represents
1531
1538
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1532
1539
  * @param {int} [limit] the maximum amount of candles to fetch
1533
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1540
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1534
1541
  * @param {int} [params.until] timestamp of the latest candle in ms
1535
1542
  * @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1536
1543
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
@@ -1635,7 +1642,7 @@ export default class bitmart extends Exchange {
1635
1642
  * @param {string} symbol unified market symbol
1636
1643
  * @param {int} [since] the earliest time in ms to fetch trades for
1637
1644
  * @param {int} [limit] the maximum number of trades structures to retrieve
1638
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1645
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1639
1646
  * @param {int} [params.until] the latest time in ms to fetch trades for
1640
1647
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
1641
1648
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
@@ -1751,7 +1758,7 @@ export default class bitmart extends Exchange {
1751
1758
  * @param {string} symbol unified market symbol
1752
1759
  * @param {int} [since] the earliest time in ms to fetch trades for
1753
1760
  * @param {int} [limit] the maximum number of trades to retrieve
1754
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1761
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1755
1762
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1756
1763
  */
1757
1764
  await this.loadMarkets();
@@ -1824,26 +1831,34 @@ export default class bitmart extends Exchange {
1824
1831
  * @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
1825
1832
  * @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
1826
1833
  * @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
1827
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1834
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1828
1835
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1829
1836
  */
1830
1837
  await this.loadMarkets();
1831
1838
  let marketType = undefined;
1832
1839
  [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1833
- let method = this.getSupportedMapping(marketType, {
1834
- 'spot': 'privateGetSpotV1Wallet',
1835
- 'swap': 'privateGetContractPrivateAssetsDetail',
1836
- 'account': 'privateGetAccountV1Wallet',
1837
- 'margin': 'privateGetSpotV1MarginIsolatedAccount',
1838
- });
1839
1840
  const marginMode = this.safeString(params, 'marginMode');
1840
1841
  const isMargin = this.safeValue(params, 'margin', false);
1841
1842
  params = this.omit(params, ['margin', 'marginMode']);
1842
1843
  if (marginMode !== undefined || isMargin) {
1843
- method = 'privateGetSpotV1MarginIsolatedAccount';
1844
1844
  marketType = 'margin';
1845
1845
  }
1846
- const response = await this[method](params);
1846
+ let response = undefined;
1847
+ if (marketType === 'spot') {
1848
+ response = await this.privateGetSpotV1Wallet(params);
1849
+ }
1850
+ else if (marketType === 'swap') {
1851
+ response = await this.privateGetContractPrivateAssetsDetail(params);
1852
+ }
1853
+ else if (marketType === 'account') {
1854
+ response = await this.privateGetAccountV1Wallet(params);
1855
+ }
1856
+ else if (marketType === 'margin') {
1857
+ response = await this.privateGetSpotV1MarginIsolatedAccount(params);
1858
+ }
1859
+ else {
1860
+ throw new NotSupported(this.id + ' fetchBalance() does not support ' + marketType + ' markets, only spot, swap and account and margin markets are accepted');
1861
+ }
1847
1862
  //
1848
1863
  // spot
1849
1864
  //
@@ -1963,7 +1978,7 @@ export default class bitmart extends Exchange {
1963
1978
  * @name bitmart#fetchTradingFee
1964
1979
  * @description fetch the trading fees for a market
1965
1980
  * @param {string} symbol unified market symbol
1966
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
1981
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1967
1982
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
1968
1983
  */
1969
1984
  await this.loadMarkets();
@@ -2162,7 +2177,7 @@ export default class bitmart extends Exchange {
2162
2177
  * @param {string} side 'buy' or 'sell'
2163
2178
  * @param {float} amount how much of currency you want to trade in units of base currency
2164
2179
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2165
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2180
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2166
2181
  * @param {string} [params.marginMode] 'cross' or 'isolated'
2167
2182
  * @param {string} [params.leverage] *swap only* leverage level
2168
2183
  * @param {string} [params.clientOrderId] client order id of the order
@@ -2222,7 +2237,7 @@ export default class bitmart extends Exchange {
2222
2237
  * @param {string} side 'buy' or 'sell'
2223
2238
  * @param {float} amount how much of currency you want to trade in units of base currency
2224
2239
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2225
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2240
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2226
2241
  * @param {int} [params.leverage] leverage level
2227
2242
  * @param {boolean} [params.reduceOnly] *swap only* reduce only
2228
2243
  * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
@@ -2301,7 +2316,7 @@ export default class bitmart extends Exchange {
2301
2316
  * @param {string} side 'buy' or 'sell'
2302
2317
  * @param {float} amount how much of currency you want to trade in units of base currency
2303
2318
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2304
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2319
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2305
2320
  * @param {string} [params.marginMode] 'cross' or 'isolated'
2306
2321
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2307
2322
  */
@@ -2372,7 +2387,7 @@ export default class bitmart extends Exchange {
2372
2387
  * @description cancels an open order
2373
2388
  * @param {string} id order id
2374
2389
  * @param {string} symbol unified symbol of the market the order was made in
2375
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2390
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2376
2391
  * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
2377
2392
  * @param {boolean} [params.stop] *swap only* whether the order is a stop order
2378
2393
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2461,7 +2476,7 @@ export default class bitmart extends Exchange {
2461
2476
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
2462
2477
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
2463
2478
  * @param {string} symbol unified market symbol of the market to cancel orders in
2464
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2479
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2465
2480
  * @param {string} [params.side] *spot only* 'buy' or 'sell'
2466
2481
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2467
2482
  */
@@ -2573,7 +2588,7 @@ export default class bitmart extends Exchange {
2573
2588
  * @param {string} symbol unified market symbol
2574
2589
  * @param {int} [since] the earliest time in ms to fetch open orders for
2575
2590
  * @param {int} [limit] the maximum number of open order structures to retrieve
2576
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2591
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2577
2592
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
2578
2593
  * @param {int} [params.until] *spot* the latest time in ms to fetch orders for
2579
2594
  * @param {string} [params.type] *swap* order type, 'limit' or 'market'
@@ -2682,7 +2697,7 @@ export default class bitmart extends Exchange {
2682
2697
  * @param {string} symbol unified market symbol of the market orders were made in
2683
2698
  * @param {int} [since] the earliest time in ms to fetch orders for
2684
2699
  * @param {int} [limit] the maximum number of orde structures to retrieve
2685
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2700
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2686
2701
  * @param {int} [params.until] timestamp in ms of the latest entry
2687
2702
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
2688
2703
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2734,7 +2749,7 @@ export default class bitmart extends Exchange {
2734
2749
  * @param {string} symbol unified market symbol of the market orders were made in
2735
2750
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
2736
2751
  * @param {int} [limit] max number of orders to return, default is undefined
2737
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2752
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2738
2753
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2739
2754
  */
2740
2755
  return await this.fetchOrdersByStatus('canceled', symbol, since, limit, params);
@@ -2749,7 +2764,7 @@ export default class bitmart extends Exchange {
2749
2764
  * @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
2750
2765
  * @param {string} id the id of the order
2751
2766
  * @param {string} symbol unified symbol of the market the order was made in
2752
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2767
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2753
2768
  * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
2754
2769
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2755
2770
  */
@@ -2841,7 +2856,7 @@ export default class bitmart extends Exchange {
2841
2856
  * @name bitmart#fetchDepositAddress
2842
2857
  * @description fetch the deposit address for a currency associated with this account
2843
2858
  * @param {string} code unified currency code
2844
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2859
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2845
2860
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
2846
2861
  */
2847
2862
  await this.loadMarkets();
@@ -2906,7 +2921,7 @@ export default class bitmart extends Exchange {
2906
2921
  * @param {float} amount the amount to withdraw
2907
2922
  * @param {string} address the address to withdraw to
2908
2923
  * @param {string} tag
2909
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
2924
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2910
2925
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2911
2926
  */
2912
2927
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
@@ -3015,7 +3030,7 @@ export default class bitmart extends Exchange {
3015
3030
  * @description fetch information on a deposit
3016
3031
  * @param {string} id deposit id
3017
3032
  * @param {string} code not used by bitmart fetchDeposit ()
3018
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3033
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3019
3034
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3020
3035
  */
3021
3036
  await this.loadMarkets();
@@ -3057,7 +3072,7 @@ export default class bitmart extends Exchange {
3057
3072
  * @param {string} code unified currency code
3058
3073
  * @param {int} [since] the earliest time in ms to fetch deposits for
3059
3074
  * @param {int} [limit] the maximum number of deposits structures to retrieve
3060
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3075
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3061
3076
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3062
3077
  */
3063
3078
  return await this.fetchTransactionsByType('deposit', code, since, limit, params);
@@ -3069,7 +3084,7 @@ export default class bitmart extends Exchange {
3069
3084
  * @description fetch data on a currency withdrawal via the withdrawal id
3070
3085
  * @param {string} id withdrawal id
3071
3086
  * @param {string} code not used by bitmart.fetchWithdrawal
3072
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3087
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3073
3088
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3074
3089
  */
3075
3090
  await this.loadMarkets();
@@ -3111,7 +3126,7 @@ export default class bitmart extends Exchange {
3111
3126
  * @param {string} code unified currency code
3112
3127
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
3113
3128
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3114
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3129
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3115
3130
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3116
3131
  */
3117
3132
  return await this.fetchTransactionsByType('withdraw', code, since, limit, params);
@@ -3211,7 +3226,7 @@ export default class bitmart extends Exchange {
3211
3226
  * @param {string} symbol unified market symbol
3212
3227
  * @param {string} code unified currency code of the currency to repay
3213
3228
  * @param {string} amount the amount to repay
3214
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3229
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3215
3230
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
3216
3231
  */
3217
3232
  await this.loadMarkets();
@@ -3249,7 +3264,7 @@ export default class bitmart extends Exchange {
3249
3264
  * @param {string} symbol unified market symbol
3250
3265
  * @param {string} code unified currency code of the currency to borrow
3251
3266
  * @param {string} amount the amount to borrow
3252
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3267
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3253
3268
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
3254
3269
  */
3255
3270
  await this.loadMarkets();
@@ -3310,7 +3325,7 @@ export default class bitmart extends Exchange {
3310
3325
  // @description fetch the rate of interest to borrow a currency for margin trading
3311
3326
  // @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3312
3327
  // @param {string} symbol unified symbol of the market to fetch the borrow rate for
3313
- // @param {object} [params] extra parameters specific to the bitmart api endpoint
3328
+ // @param {object} [params] extra parameters specific to the exchange API endpoint
3314
3329
  // <<<<<<< HEAD
3315
3330
  // @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
3316
3331
  // =======
@@ -3408,7 +3423,7 @@ export default class bitmart extends Exchange {
3408
3423
  * @name bitmart#fetchIsolatedBorrowRates
3409
3424
  * @description fetch the borrow interest rates of all currencies, currently only works for isolated margin
3410
3425
  * @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3411
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3426
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3412
3427
  * @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
3413
3428
  */
3414
3429
  await this.loadMarkets();
@@ -3465,7 +3480,7 @@ export default class bitmart extends Exchange {
3465
3480
  * @param {float} amount amount to transfer
3466
3481
  * @param {string} fromAccount account to transfer from
3467
3482
  * @param {string} toAccount account to transfer to
3468
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3483
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3469
3484
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
3470
3485
  */
3471
3486
  await this.loadMarkets();
@@ -3604,7 +3619,7 @@ export default class bitmart extends Exchange {
3604
3619
  * @param {string} code unified currency code of the currency transferred
3605
3620
  * @param {int} [since] the earliest time in ms to fetch transfers for
3606
3621
  * @param {int} [limit] the maximum number of transfer structures to retrieve
3607
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3622
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3608
3623
  * @param {int} [params.page] the required number of pages, default is 1, max is 1000
3609
3624
  * @param {int} [params.until] the latest time in ms to fetch transfers for
3610
3625
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
@@ -3668,7 +3683,7 @@ export default class bitmart extends Exchange {
3668
3683
  * @param {string} symbol unified market symbol when fetch interest in isolated markets
3669
3684
  * @param {int} [since] the earliest time in ms to fetch borrrow interest for
3670
3685
  * @param {int} [limit] the maximum number of structures to retrieve
3671
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3686
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3672
3687
  * @returns {object[]} a list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
3673
3688
  */
3674
3689
  if (symbol === undefined) {
@@ -3803,7 +3818,7 @@ export default class bitmart extends Exchange {
3803
3818
  * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
3804
3819
  * @param {float} leverage the rate of leverage
3805
3820
  * @param {string} symbol unified market symbol
3806
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3821
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3807
3822
  * @param {string} [params.marginMode] 'isolated' or 'cross'
3808
3823
  * @returns {object} response from the exchange
3809
3824
  */
@@ -3832,7 +3847,7 @@ export default class bitmart extends Exchange {
3832
3847
  * @description fetch the current funding rate
3833
3848
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
3834
3849
  * @param {string} symbol unified market symbol
3835
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3850
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3836
3851
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
3837
3852
  */
3838
3853
  await this.loadMarkets();
@@ -3898,7 +3913,7 @@ export default class bitmart extends Exchange {
3898
3913
  * @description fetch data on a single open contract trade position
3899
3914
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
3900
3915
  * @param {string} symbol unified market symbol of the market the position is held in
3901
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3916
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3902
3917
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3903
3918
  */
3904
3919
  await this.loadMarkets();
@@ -3947,7 +3962,7 @@ export default class bitmart extends Exchange {
3947
3962
  * @description fetch all open contract positions
3948
3963
  * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
3949
3964
  * @param {string[]|undefined} symbols list of unified market symbols
3950
- * @param {object} [params] extra parameters specific to the bitmart api endpoint
3965
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3951
3966
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
3952
3967
  */
3953
3968
  await this.loadMarkets();