ccxt 4.1.44 → 4.1.45

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 (206) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +542 -581
  3. package/dist/ccxt.browser.min.js +9 -9
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +1 -3
  6. package/dist/cjs/src/ascendex.js +1 -3
  7. package/dist/cjs/src/bigone.js +2 -6
  8. package/dist/cjs/src/binance.js +16 -12
  9. package/dist/cjs/src/bit2c.js +2 -4
  10. package/dist/cjs/src/bitbns.js +5 -15
  11. package/dist/cjs/src/bitfinex.js +1 -3
  12. package/dist/cjs/src/bitfinex2.js +1 -3
  13. package/dist/cjs/src/bitflyer.js +4 -12
  14. package/dist/cjs/src/bitforex.js +4 -8
  15. package/dist/cjs/src/bithumb.js +4 -10
  16. package/dist/cjs/src/bitmart.js +64 -59
  17. package/dist/cjs/src/bitmex.js +2 -6
  18. package/dist/cjs/src/bitopro.js +6 -16
  19. package/dist/cjs/src/bitrue.js +6 -14
  20. package/dist/cjs/src/bitvavo.js +3 -9
  21. package/dist/cjs/src/btctradeua.js +2 -4
  22. package/dist/cjs/src/bybit.js +4 -0
  23. package/dist/cjs/src/cex.js +2 -4
  24. package/dist/cjs/src/coinbasepro.js +2 -2
  25. package/dist/cjs/src/coinex.js +7 -24
  26. package/dist/cjs/src/coinfalcon.js +1 -3
  27. package/dist/cjs/src/coinmate.js +2 -4
  28. package/dist/cjs/src/coinone.js +2 -6
  29. package/dist/cjs/src/coinsph.js +5 -13
  30. package/dist/cjs/src/currencycom.js +2 -6
  31. package/dist/cjs/src/gate.js +2 -6
  32. package/dist/cjs/src/gemini.js +1 -3
  33. package/dist/cjs/src/hitbtc.js +290 -100
  34. package/dist/cjs/src/hollaex.js +1 -3
  35. package/dist/cjs/src/huobi.js +3 -12
  36. package/dist/cjs/src/huobijp.js +1 -3
  37. package/dist/cjs/src/indodax.js +4 -10
  38. package/dist/cjs/src/kucoinfutures.js +2 -7
  39. package/dist/cjs/src/kuna.js +1 -0
  40. package/dist/cjs/src/luno.js +1 -3
  41. package/dist/cjs/src/mercado.js +7 -17
  42. package/dist/cjs/src/mexc.js +5 -15
  43. package/dist/cjs/src/oceanex.js +2 -4
  44. package/dist/cjs/src/okx.js +14 -19
  45. package/dist/cjs/src/phemex.js +12 -33
  46. package/dist/cjs/src/poloniexfutures.js +2 -6
  47. package/dist/cjs/src/pro/bitmart.js +2 -4
  48. package/dist/cjs/src/pro/bitrue.js +0 -4
  49. package/dist/cjs/src/pro/bitstamp.js +2 -4
  50. package/dist/cjs/src/pro/bitvavo.js +3 -7
  51. package/dist/cjs/src/pro/cex.js +2 -6
  52. package/dist/cjs/src/pro/whitebit.js +3 -7
  53. package/dist/cjs/src/probit.js +2 -6
  54. package/dist/cjs/src/tokocrypto.js +3 -7
  55. package/dist/cjs/src/wavesexchange.js +2 -4
  56. package/dist/cjs/src/wazirx.js +4 -10
  57. package/dist/cjs/src/whitebit.js +3 -7
  58. package/dist/cjs/src/woo.js +0 -3
  59. package/dist/cjs/src/yobit.js +3 -7
  60. package/js/ccxt.d.ts +1 -1
  61. package/js/ccxt.js +1 -1
  62. package/js/src/abstract/bequant.d.ts +37 -7
  63. package/js/src/abstract/binance.d.ts +1 -0
  64. package/js/src/abstract/binancecoinm.d.ts +1 -0
  65. package/js/src/abstract/binanceus.d.ts +1 -0
  66. package/js/src/abstract/binanceusdm.d.ts +1 -0
  67. package/js/src/abstract/bitcoincom.d.ts +37 -7
  68. package/js/src/abstract/bybit.d.ts +3 -0
  69. package/js/src/abstract/fmfwio.d.ts +37 -7
  70. package/js/src/abstract/hitbtc.d.ts +37 -7
  71. package/js/src/abstract/hitbtc3.d.ts +37 -7
  72. package/js/src/abstract/okex.d.ts +6 -1
  73. package/js/src/abstract/okex5.d.ts +6 -1
  74. package/js/src/abstract/okx.d.ts +6 -1
  75. package/js/src/ace.d.ts +2 -2
  76. package/js/src/ace.js +2 -4
  77. package/js/src/alpaca.d.ts +2 -2
  78. package/js/src/ascendex.d.ts +2 -2
  79. package/js/src/ascendex.js +1 -3
  80. package/js/src/bigone.d.ts +2 -2
  81. package/js/src/bigone.js +3 -7
  82. package/js/src/binance.d.ts +2 -2
  83. package/js/src/binance.js +16 -12
  84. package/js/src/bingx.d.ts +2 -2
  85. package/js/src/bit2c.d.ts +2 -2
  86. package/js/src/bit2c.js +3 -5
  87. package/js/src/bitbank.d.ts +2 -2
  88. package/js/src/bitbns.d.ts +2 -2
  89. package/js/src/bitbns.js +5 -15
  90. package/js/src/bitfinex.d.ts +2 -2
  91. package/js/src/bitfinex.js +1 -3
  92. package/js/src/bitfinex2.js +1 -3
  93. package/js/src/bitflyer.d.ts +2 -2
  94. package/js/src/bitflyer.js +4 -12
  95. package/js/src/bitforex.d.ts +2 -2
  96. package/js/src/bitforex.js +5 -9
  97. package/js/src/bitget.d.ts +2 -2
  98. package/js/src/bithumb.d.ts +2 -2
  99. package/js/src/bithumb.js +4 -10
  100. package/js/src/bitmart.d.ts +2 -2
  101. package/js/src/bitmart.js +64 -59
  102. package/js/src/bitmex.js +2 -6
  103. package/js/src/bitopro.d.ts +2 -2
  104. package/js/src/bitopro.js +6 -16
  105. package/js/src/bitpanda.d.ts +2 -2
  106. package/js/src/bitrue.d.ts +2 -2
  107. package/js/src/bitrue.js +6 -14
  108. package/js/src/bitso.d.ts +2 -2
  109. package/js/src/bitstamp.d.ts +2 -2
  110. package/js/src/bitstamp1.d.ts +2 -2
  111. package/js/src/bittrex.d.ts +2 -2
  112. package/js/src/bitvavo.d.ts +2 -2
  113. package/js/src/bitvavo.js +3 -9
  114. package/js/src/bl3p.d.ts +2 -2
  115. package/js/src/blockchaincom.d.ts +4 -4
  116. package/js/src/btcalpha.d.ts +2 -2
  117. package/js/src/btcbox.d.ts +2 -2
  118. package/js/src/btcmarkets.d.ts +2 -2
  119. package/js/src/btctradeua.d.ts +2 -2
  120. package/js/src/btctradeua.js +3 -5
  121. package/js/src/btcturk.d.ts +2 -2
  122. package/js/src/bybit.d.ts +2 -2
  123. package/js/src/bybit.js +4 -0
  124. package/js/src/cex.d.ts +2 -2
  125. package/js/src/cex.js +2 -4
  126. package/js/src/coinbase.d.ts +2 -2
  127. package/js/src/coinbasepro.d.ts +2 -2
  128. package/js/src/coinbasepro.js +2 -2
  129. package/js/src/coincheck.d.ts +2 -2
  130. package/js/src/coinex.js +7 -24
  131. package/js/src/coinfalcon.d.ts +2 -2
  132. package/js/src/coinfalcon.js +2 -4
  133. package/js/src/coinlist.d.ts +12 -12
  134. package/js/src/coinmate.d.ts +3 -3
  135. package/js/src/coinmate.js +3 -5
  136. package/js/src/coinone.d.ts +2 -2
  137. package/js/src/coinone.js +2 -6
  138. package/js/src/coinsph.d.ts +2 -2
  139. package/js/src/coinsph.js +5 -13
  140. package/js/src/coinspot.d.ts +2 -2
  141. package/js/src/cryptocom.d.ts +2 -2
  142. package/js/src/currencycom.d.ts +2 -2
  143. package/js/src/currencycom.js +2 -6
  144. package/js/src/delta.d.ts +2 -2
  145. package/js/src/deribit.d.ts +3 -3
  146. package/js/src/digifinex.d.ts +2 -2
  147. package/js/src/gate.d.ts +2 -2
  148. package/js/src/gate.js +2 -6
  149. package/js/src/gemini.d.ts +3 -3
  150. package/js/src/gemini.js +1 -3
  151. package/js/src/hitbtc.d.ts +3 -0
  152. package/js/src/hitbtc.js +291 -101
  153. package/js/src/hollaex.js +1 -3
  154. package/js/src/huobi.d.ts +2 -2
  155. package/js/src/huobi.js +3 -12
  156. package/js/src/huobijp.d.ts +2 -2
  157. package/js/src/huobijp.js +2 -4
  158. package/js/src/independentreserve.d.ts +2 -2
  159. package/js/src/indodax.d.ts +2 -2
  160. package/js/src/indodax.js +4 -10
  161. package/js/src/kraken.d.ts +2 -2
  162. package/js/src/krakenfutures.d.ts +2 -2
  163. package/js/src/kucoin.d.ts +2 -2
  164. package/js/src/kucoinfutures.d.ts +2 -2
  165. package/js/src/kucoinfutures.js +2 -7
  166. package/js/src/kuna.d.ts +3 -3
  167. package/js/src/kuna.js +1 -0
  168. package/js/src/latoken.d.ts +2 -2
  169. package/js/src/lbank2.d.ts +2 -2
  170. package/js/src/luno.d.ts +2 -2
  171. package/js/src/luno.js +1 -3
  172. package/js/src/lykke.d.ts +2 -2
  173. package/js/src/mercado.d.ts +2 -2
  174. package/js/src/mercado.js +7 -17
  175. package/js/src/mexc.js +5 -15
  176. package/js/src/novadax.d.ts +2 -2
  177. package/js/src/oceanex.d.ts +4 -4
  178. package/js/src/oceanex.js +2 -4
  179. package/js/src/okcoin.d.ts +2 -2
  180. package/js/src/okx.d.ts +2 -2
  181. package/js/src/okx.js +14 -19
  182. package/js/src/paymium.d.ts +2 -2
  183. package/js/src/phemex.js +12 -33
  184. package/js/src/poloniexfutures.d.ts +2 -2
  185. package/js/src/poloniexfutures.js +2 -6
  186. package/js/src/pro/bitmart.js +2 -4
  187. package/js/src/pro/bitrue.js +0 -4
  188. package/js/src/pro/bitstamp.js +3 -5
  189. package/js/src/pro/bitvavo.js +4 -8
  190. package/js/src/pro/cex.js +3 -7
  191. package/js/src/pro/whitebit.js +4 -8
  192. package/js/src/probit.d.ts +2 -2
  193. package/js/src/probit.js +3 -7
  194. package/js/src/timex.d.ts +2 -2
  195. package/js/src/tokocrypto.d.ts +2 -2
  196. package/js/src/tokocrypto.js +4 -8
  197. package/js/src/wavesexchange.js +3 -5
  198. package/js/src/wazirx.d.ts +2 -2
  199. package/js/src/wazirx.js +5 -11
  200. package/js/src/whitebit.d.ts +2 -2
  201. package/js/src/whitebit.js +3 -7
  202. package/js/src/woo.d.ts +2 -2
  203. package/js/src/woo.js +1 -4
  204. package/js/src/yobit.js +3 -7
  205. package/js/src/zaif.d.ts +2 -2
  206. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -181,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
181
181
 
182
182
  //-----------------------------------------------------------------------------
183
183
  // this is updated by vss.js when building
184
- const version = '4.1.44';
184
+ const version = '4.1.45';
185
185
  Exchange["default"].ccxtVersion = version;
186
186
  const exchanges = {
187
187
  'ace': ace,
@@ -700,9 +700,7 @@ class ace extends ace$1 {
700
700
  * @param {object} [params] extra parameters specific to the ace api endpoint
701
701
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
702
702
  */
703
- if (symbol === undefined) {
704
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires the symbol argument');
705
- }
703
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
706
704
  await this.loadMarkets();
707
705
  const market = this.market(symbol);
708
706
  const request = {
@@ -2153,9 +2153,7 @@ class ascendex extends ascendex$1 {
2153
2153
  * @param {object} [params] extra parameters specific to the ascendex api endpoint
2154
2154
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2155
2155
  */
2156
- if (symbol === undefined) {
2157
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
2158
- }
2156
+ this.checkRequiredSymbol('cancelOrder', symbol);
2159
2157
  await this.loadMarkets();
2160
2158
  await this.loadAccounts();
2161
2159
  const market = this.market(symbol);
@@ -1356,9 +1356,7 @@ class bigone extends bigone$1 {
1356
1356
  * @param {object} [params] extra parameters specific to the bigone api endpoint
1357
1357
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1358
1358
  */
1359
- if (symbol === undefined) {
1360
- throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
1361
- }
1359
+ this.checkRequiredSymbol('fetchOrders', symbol);
1362
1360
  await this.loadMarkets();
1363
1361
  const market = this.market(symbol);
1364
1362
  const request = {
@@ -1406,10 +1404,8 @@ class bigone extends bigone$1 {
1406
1404
  * @param {object} [params] extra parameters specific to the bigone api endpoint
1407
1405
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1408
1406
  */
1407
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
1409
1408
  await this.loadMarkets();
1410
- if (symbol === undefined) {
1411
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1412
- }
1413
1409
  const market = this.market(symbol);
1414
1410
  const request = {
1415
1411
  'asset_pair_name': market['id'],
@@ -859,6 +859,7 @@ class binance extends binance$1 {
859
859
  'klines': 0.4,
860
860
  'uiKlines': 0.4,
861
861
  'ticker/24hr': { 'cost': 0.4, 'noSymbol': 16 },
862
+ 'ticker': { 'cost': 0.4, 'noSymbol': 16 },
862
863
  'ticker/price': { 'cost': 0.4, 'noSymbol': 0.8 },
863
864
  'ticker/bookTicker': { 'cost': 0.4, 'noSymbol': 0.8 },
864
865
  'exchangeInfo': 4,
@@ -3026,11 +3027,13 @@ class binance extends binance$1 {
3026
3027
  * @name binance#fetchTicker
3027
3028
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
3028
3029
  * @see https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics // spot
3030
+ * @see https://binance-docs.github.io/apidocs/spot/en/#rolling-window-price-change-statistics // spot
3029
3031
  * @see https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics // swap
3030
3032
  * @see https://binance-docs.github.io/apidocs/delivery/en/#24hr-ticker-price-change-statistics // future
3031
3033
  * @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
3032
3034
  * @param {string} symbol unified symbol of the market to fetch the ticker for
3033
3035
  * @param {object} [params] extra parameters specific to the binance api endpoint
3036
+ * @param {boolean} [params.rolling] (spot only) default false, if true, uses the rolling 24 hour ticker endpoint /api/v3/ticker
3034
3037
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
3035
3038
  */
3036
3039
  await this.loadMarkets();
@@ -3049,7 +3052,14 @@ class binance extends binance$1 {
3049
3052
  response = await this.dapiPublicGetTicker24hr(this.extend(request, params));
3050
3053
  }
3051
3054
  else {
3052
- response = await this.publicGetTicker24hr(this.extend(request, params));
3055
+ const rolling = this.safeValue(params, 'rolling', false);
3056
+ params = this.omit(params, 'rolling');
3057
+ if (rolling) {
3058
+ response = await this.publicGetTicker(this.extend(request, params));
3059
+ }
3060
+ else {
3061
+ response = await this.publicGetTicker24hr(this.extend(request, params));
3062
+ }
3053
3063
  }
3054
3064
  if (Array.isArray(response)) {
3055
3065
  const firstTicker = this.safeValue(response, 0, {});
@@ -5231,9 +5241,7 @@ class binance extends binance$1 {
5231
5241
  * @param {object} [params] extra parameters specific to the binance api endpoint
5232
5242
  * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
5233
5243
  */
5234
- if (symbol === undefined) {
5235
- throw new errors.ArgumentsRequired(this.id + ' fetchOrderTrades() requires a symbol argument');
5236
- }
5244
+ this.checkRequiredSymbol('fetchOrderTrades', symbol);
5237
5245
  await this.loadMarkets();
5238
5246
  const market = this.market(symbol);
5239
5247
  const type = this.safeString(params, 'type', market['type']);
@@ -7994,9 +8002,7 @@ class binance extends binance$1 {
7994
8002
  * @param {object} [params] extra parameters specific to the binance api endpoint
7995
8003
  * @returns {object} response from the exchange
7996
8004
  */
7997
- if (symbol === undefined) {
7998
- throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
7999
- }
8005
+ this.checkRequiredSymbol('setLeverage', symbol);
8000
8006
  // WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
8001
8007
  // AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
8002
8008
  if ((leverage < 1) || (leverage > 125)) {
@@ -8032,9 +8038,7 @@ class binance extends binance$1 {
8032
8038
  * @param {object} [params] extra parameters specific to the binance api endpoint
8033
8039
  * @returns {object} response from the exchange
8034
8040
  */
8035
- if (symbol === undefined) {
8036
- throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
8037
- }
8041
+ this.checkRequiredSymbol('setMarginMode', symbol);
8038
8042
  //
8039
8043
  // { "code": -4048 , "msg": "Margin type cannot be changed if there exists position." }
8040
8044
  //
@@ -8557,10 +8561,10 @@ class binance extends binance$1 {
8557
8561
  const orderidlistLength = orderidlist.length;
8558
8562
  const origclientorderidlistLength = orderidlist.length;
8559
8563
  if (orderidlistLength > 0) {
8560
- query = query + '&orderidlist=[' + orderidlist.join(',') + ']';
8564
+ query = query + '&' + 'orderidlist=[' + orderidlist.join(',') + ']';
8561
8565
  }
8562
8566
  if (origclientorderidlistLength > 0) {
8563
- query = query + '&origclientorderidlist=[' + origclientorderidlist.join(',') + ']';
8567
+ query = query + '&' + 'origclientorderidlist=[' + origclientorderidlist.join(',') + ']';
8564
8568
  }
8565
8569
  }
8566
8570
  else {
@@ -456,13 +456,11 @@ class bit2c extends bit2c$1 {
456
456
  * @description fetch all unfilled currently open orders
457
457
  * @param {string} symbol unified market symbol
458
458
  * @param {int} [since] the earliest time in ms to fetch open orders for
459
- * @param {int} [limit] the maximum number of open orders structures to retrieve
459
+ * @param {int} [limit] the maximum number of open order structures to retrieve
460
460
  * @param {object} [params] extra parameters specific to the bit2c api endpoint
461
461
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
462
462
  */
463
- if (symbol === undefined) {
464
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
465
- }
463
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
466
464
  await this.loadMarkets();
467
465
  const market = this.market(symbol);
468
466
  const request = {
@@ -651,9 +651,7 @@ class bitbns extends bitbns$1 {
651
651
  * @param {boolean} [params.trigger] true if cancelling a trigger order
652
652
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
653
653
  */
654
- if (symbol === undefined) {
655
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
656
- }
654
+ this.checkRequiredSymbol('cancelOrder', symbol);
657
655
  await this.loadMarkets();
658
656
  const market = this.market(symbol);
659
657
  const isTrigger = this.safeValue2(params, 'trigger', 'stop');
@@ -681,9 +679,7 @@ class bitbns extends bitbns$1 {
681
679
  * @param {object} [params] extra parameters specific to the bitbns api endpoint
682
680
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
683
681
  */
684
- if (symbol === undefined) {
685
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
686
- }
682
+ this.checkRequiredSymbol('fetchOrder', symbol);
687
683
  await this.loadMarkets();
688
684
  const market = this.market(symbol);
689
685
  const request = {
@@ -738,9 +734,7 @@ class bitbns extends bitbns$1 {
738
734
  * @param {boolean} [params.trigger] true if fetching trigger orders
739
735
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
740
736
  */
741
- if (symbol === undefined) {
742
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
743
- }
737
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
744
738
  await this.loadMarkets();
745
739
  const market = this.market(symbol);
746
740
  const isTrigger = this.safeValue2(params, 'trigger', 'stop');
@@ -868,9 +862,7 @@ class bitbns extends bitbns$1 {
868
862
  * @param {object} [params] extra parameters specific to the bitbns api endpoint
869
863
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
870
864
  */
871
- if (symbol === undefined) {
872
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
873
- }
865
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
874
866
  await this.loadMarkets();
875
867
  const market = this.market(symbol);
876
868
  const request = {
@@ -936,9 +928,7 @@ class bitbns extends bitbns$1 {
936
928
  * @param {object} [params] extra parameters specific to the bitbns api endpoint
937
929
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
938
930
  */
939
- if (symbol === undefined) {
940
- throw new errors.ArgumentsRequired(this.id + ' fetchTrades() requires a symbol argument');
941
- }
931
+ this.checkRequiredSymbol('fetchTrades', symbol);
942
932
  await this.loadMarkets();
943
933
  const market = this.market(symbol);
944
934
  const request = {
@@ -1023,9 +1023,7 @@ class bitfinex extends bitfinex$1 {
1023
1023
  * @param {object} [params] extra parameters specific to the bitfinex api endpoint
1024
1024
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1025
1025
  */
1026
- if (symbol === undefined) {
1027
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a `symbol` argument');
1028
- }
1026
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
1029
1027
  await this.loadMarkets();
1030
1028
  const market = this.market(symbol);
1031
1029
  const request = {
@@ -1898,9 +1898,7 @@ class bitfinex2 extends bitfinex2$1 {
1898
1898
  * @param {object} [params] extra parameters specific to the bitfinex2 api endpoint
1899
1899
  * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1900
1900
  */
1901
- if (symbol === undefined) {
1902
- throw new errors.ArgumentsRequired(this.id + ' fetchOrderTrades() requires a symbol argument');
1903
- }
1901
+ this.checkRequiredSymbol('fetchOrderTrades', symbol);
1904
1902
  await this.loadMarkets();
1905
1903
  const market = this.market(symbol);
1906
1904
  const orderId = parseInt(id);
@@ -577,9 +577,7 @@ class bitflyer extends bitflyer$1 {
577
577
  * @param {object} [params] extra parameters specific to the bitflyer api endpoint
578
578
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
579
579
  */
580
- if (symbol === undefined) {
581
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a `symbol` argument');
582
- }
580
+ this.checkRequiredSymbol('cancelOrder', symbol);
583
581
  await this.loadMarkets();
584
582
  const request = {
585
583
  'product_code': this.marketId(symbol),
@@ -655,9 +653,7 @@ class bitflyer extends bitflyer$1 {
655
653
  * @param {object} [params] extra parameters specific to the bitflyer api endpoint
656
654
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
657
655
  */
658
- if (symbol === undefined) {
659
- throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a `symbol` argument');
660
- }
656
+ this.checkRequiredSymbol('fetchOrders', symbol);
661
657
  await this.loadMarkets();
662
658
  const market = this.market(symbol);
663
659
  const request = {
@@ -715,9 +711,7 @@ class bitflyer extends bitflyer$1 {
715
711
  * @param {object} [params] extra parameters specific to the bitflyer api endpoint
716
712
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
717
713
  */
718
- if (symbol === undefined) {
719
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a `symbol` argument');
720
- }
714
+ this.checkRequiredSymbol('fetchOrder', symbol);
721
715
  const orders = await this.fetchOrders(symbol);
722
716
  const ordersById = this.indexBy(orders, 'id');
723
717
  if (id in ordersById) {
@@ -737,9 +731,7 @@ class bitflyer extends bitflyer$1 {
737
731
  * @param {object} [params] extra parameters specific to the bitflyer api endpoint
738
732
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
739
733
  */
740
- if (symbol === undefined) {
741
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a `symbol` argument');
742
- }
734
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
743
735
  await this.loadMarkets();
744
736
  const market = this.market(symbol);
745
737
  const request = {
@@ -704,13 +704,11 @@ class bitforex extends bitforex$1 {
704
704
  * @description fetch all unfilled currently open orders
705
705
  * @param {string} symbol unified market symbol
706
706
  * @param {int} [since] the earliest time in ms to fetch open orders for
707
- * @param {int} [limit] the maximum number of open orders structures to retrieve
707
+ * @param {int} [limit] the maximum number of open order structures to retrieve
708
708
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
709
709
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
710
710
  */
711
- if (symbol === undefined) {
712
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
713
- }
711
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
714
712
  await this.loadMarkets();
715
713
  const market = this.market(symbol);
716
714
  const request = {
@@ -727,13 +725,11 @@ class bitforex extends bitforex$1 {
727
725
  * @description fetches information on multiple closed orders made by the user
728
726
  * @param {string} symbol unified market symbol of the market orders were made in
729
727
  * @param {int} [since] the earliest time in ms to fetch orders for
730
- * @param {int} [limit] the maximum number of orde structures to retrieve
728
+ * @param {int} [limit] the maximum number of order structures to retrieve
731
729
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
732
730
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
733
731
  */
734
- if (symbol === undefined) {
735
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
736
- }
732
+ this.checkRequiredSymbol('fetchClosedOrders', symbol);
737
733
  await this.loadMarkets();
738
734
  const market = this.market(symbol);
739
735
  const request = {
@@ -716,9 +716,7 @@ class bithumb extends bithumb$1 {
716
716
  * @param {object} [params] extra parameters specific to the bithumb api endpoint
717
717
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
718
718
  */
719
- if (symbol === undefined) {
720
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
721
- }
719
+ this.checkRequiredSymbol('fetchOrder', symbol);
722
720
  await this.loadMarkets();
723
721
  const market = this.market(symbol);
724
722
  const request = {
@@ -872,13 +870,11 @@ class bithumb extends bithumb$1 {
872
870
  * @description fetch all unfilled currently open orders
873
871
  * @param {string} symbol unified market symbol
874
872
  * @param {int} [since] the earliest time in ms to fetch open orders for
875
- * @param {int} [limit] the maximum number of open orders structures to retrieve
873
+ * @param {int} [limit] the maximum number of open order structures to retrieve
876
874
  * @param {object} [params] extra parameters specific to the bithumb api endpoint
877
875
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
878
876
  */
879
- if (symbol === undefined) {
880
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
881
- }
877
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
882
878
  await this.loadMarkets();
883
879
  const market = this.market(symbol);
884
880
  if (limit === undefined) {
@@ -923,13 +919,11 @@ class bithumb extends bithumb$1 {
923
919
  * @param {object} [params] extra parameters specific to the bithumb api endpoint
924
920
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
925
921
  */
922
+ this.checkRequiredSymbol('cancelOrder', symbol);
926
923
  const side_in_params = ('side' in params);
927
924
  if (!side_in_params) {
928
925
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a `side` parameter (sell or buy)');
929
926
  }
930
- if (symbol === undefined) {
931
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a `symbol` argument');
932
- }
933
927
  const market = this.market(symbol);
934
928
  const side = (params['side'] === 'buy') ? 'bid' : 'ask';
935
929
  params = this.omit(params, ['side', 'currency']);
@@ -1451,15 +1451,15 @@ class bitmart extends bitmart$1 {
1451
1451
  //
1452
1452
  // spot
1453
1453
  //
1454
- // {
1455
- // "last_price":"0.034987",
1456
- // "timestamp":1598787420,
1457
- // "volume":"1.0198",
1458
- // "open":"0.035007",
1459
- // "close":"0.034987",
1460
- // "high":"0.035007",
1461
- // "low":"0.034986"
1462
- // }
1454
+ // [
1455
+ // "1699512060", // timestamp
1456
+ // "36746.49", // open
1457
+ // "36758.71", // high
1458
+ // "36736.13", // low
1459
+ // "36755.99", // close
1460
+ // "2.83965", // base volume
1461
+ // "104353.57" // quote volume
1462
+ // ]
1463
1463
  //
1464
1464
  // swap
1465
1465
  //
@@ -1476,7 +1476,7 @@ class bitmart extends bitmart$1 {
1476
1476
  //
1477
1477
  // [
1478
1478
  // 1631056350, // timestamp
1479
- // "46532.83", // oopen
1479
+ // "46532.83", // open
1480
1480
  // "46555.71", // high
1481
1481
  // "46511.41", // low
1482
1482
  // "46555.71", // close
@@ -1496,10 +1496,10 @@ class bitmart extends bitmart$1 {
1496
1496
  else {
1497
1497
  return [
1498
1498
  this.safeTimestamp(ohlcv, 'timestamp'),
1499
- this.safeNumber2(ohlcv, 'open', 'open_price'),
1500
- this.safeNumber2(ohlcv, 'high', 'high_price'),
1501
- this.safeNumber2(ohlcv, 'low', 'low_price'),
1502
- this.safeNumber2(ohlcv, 'close', 'close_price'),
1499
+ this.safeNumber(ohlcv, 'open_price'),
1500
+ this.safeNumber(ohlcv, 'high_price'),
1501
+ this.safeNumber(ohlcv, 'low_price'),
1502
+ this.safeNumber(ohlcv, 'close_price'),
1503
1503
  this.safeNumber(ohlcv, 'volume'),
1504
1504
  ];
1505
1505
  }
@@ -1509,21 +1509,27 @@ class bitmart extends bitmart$1 {
1509
1509
  * @method
1510
1510
  * @name bitmart#fetchOHLCV
1511
1511
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1512
- * @see https://developer-pro.bitmart.com/en/spot/#get-k-line
1512
+ * @see https://developer-pro.bitmart.com/en/spot/#get-latest-k-line-v3
1513
1513
  * @see https://developer-pro.bitmart.com/en/futures/#get-k-line
1514
1514
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1515
1515
  * @param {string} timeframe the length of time each candle represents
1516
1516
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1517
1517
  * @param {int} [limit] the maximum amount of candles to fetch
1518
1518
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
1519
+ * @param {int} [params.until] timestamp of the latest candle in ms
1520
+ * @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)
1519
1521
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1520
1522
  */
1521
1523
  await this.loadMarkets();
1524
+ let paginate = false;
1525
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
1526
+ if (paginate) {
1527
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
1528
+ }
1522
1529
  const market = this.market(symbol);
1523
- const type = market['type'];
1524
1530
  const duration = this.parseTimeframe(timeframe);
1525
1531
  const parsedTimeframe = this.safeInteger(this.timeframes, timeframe);
1526
- const request = {
1532
+ let request = {
1527
1533
  'symbol': market['id'],
1528
1534
  };
1529
1535
  if (parsedTimeframe !== undefined) {
@@ -1532,46 +1538,54 @@ class bitmart extends bitmart$1 {
1532
1538
  else {
1533
1539
  request['step'] = timeframe;
1534
1540
  }
1535
- const maxLimit = 500;
1536
- if (limit === undefined) {
1537
- limit = maxLimit;
1538
- }
1539
- limit = Math.min(maxLimit, limit);
1540
- const now = this.parseToInt(this.milliseconds() / 1000);
1541
- const fromRequest = (type === 'spot') ? 'from' : 'start_time';
1542
- const toRequest = (type === 'spot') ? 'to' : 'end_time';
1543
- if (since === undefined) {
1544
- const start = now - limit * duration;
1545
- request[fromRequest] = start;
1546
- request[toRequest] = now;
1541
+ if (market['spot']) {
1542
+ [request, params] = this.handleUntilOption('before', request, params, 0.001);
1543
+ if (limit !== undefined) {
1544
+ request['limit'] = limit;
1545
+ }
1546
+ if (since !== undefined) {
1547
+ request['after'] = this.parseToInt((since / 1000)) - 1;
1548
+ }
1547
1549
  }
1548
1550
  else {
1549
- const start = this.parseToInt((since / 1000)) - 1;
1550
- const end = this.sum(start, limit * duration);
1551
- request[fromRequest] = start;
1552
- request[toRequest] = Math.min(end, now);
1551
+ const maxLimit = 1200;
1552
+ if (limit === undefined) {
1553
+ limit = maxLimit;
1554
+ }
1555
+ limit = Math.min(maxLimit, limit);
1556
+ const now = this.parseToInt(this.milliseconds() / 1000);
1557
+ if (since === undefined) {
1558
+ const start = now - limit * duration;
1559
+ request['start_time'] = start;
1560
+ request['end_time'] = now;
1561
+ }
1562
+ else {
1563
+ const start = this.parseToInt((since / 1000)) - 1;
1564
+ const end = this.sum(start, limit * duration);
1565
+ request['start_time'] = start;
1566
+ request['end_time'] = Math.min(end, now);
1567
+ }
1568
+ [request, params] = this.handleUntilOption('end_time', request, params, 0.001);
1553
1569
  }
1554
1570
  let response = undefined;
1555
- if (type === 'swap') {
1571
+ if (market['swap']) {
1556
1572
  response = await this.publicGetContractPublicKline(this.extend(request, params));
1557
1573
  }
1558
1574
  else {
1559
- response = await this.publicGetSpotQuotationV3Klines(this.extend(request, params));
1575
+ response = await this.publicGetSpotQuotationV3LiteKlines(this.extend(request, params));
1560
1576
  }
1561
1577
  //
1562
1578
  // spot
1563
1579
  //
1564
1580
  // {
1565
- // "message":"OK",
1566
- // "code":1000,
1567
- // "trace":"80d86378-ab4e-4c70-819e-b42146cf87ad",
1568
- // "data":{
1569
- // "klines":[
1570
- // {"last_price":"0.034987","timestamp":1598787420,"volume":"1.0198","open":"0.035007","close":"0.034987","high":"0.035007","low":"0.034986"},
1571
- // {"last_price":"0.034986","timestamp":1598787480,"volume":"0.3959","open":"0.034982","close":"0.034986","high":"0.034986","low":"0.034980"},
1572
- // {"last_price":"0.034978","timestamp":1598787540,"volume":"0.3259","open":"0.034987","close":"0.034978","high":"0.034987","low":"0.034977"},
1573
- // ]
1574
- // }
1581
+ // "code": 1000,
1582
+ // "message": "success",
1583
+ // "data": [
1584
+ // ["1699512060","36746.49","36758.71","36736.13","36755.99","2.83965","104353.57"],
1585
+ // ["1699512120","36756.00","36758.70","36737.14","36737.63","1.96070","72047.10"],
1586
+ // ["1699512180","36737.63","36740.45","36737.62","36740.44","0.63194","23217.62"]
1587
+ // ],
1588
+ // "trace": "6591fc7b508845359d5fa442e3b3a4fb.72.16995122398750695"
1575
1589
  // }
1576
1590
  //
1577
1591
  // swap
@@ -1593,8 +1607,7 @@ class bitmart extends bitmart$1 {
1593
1607
  // "trace": "96c989db-e0f5-46f5-bba6-60cfcbde699b"
1594
1608
  // }
1595
1609
  //
1596
- const data = this.safeValue(response, 'data', {});
1597
- const ohlcv = this.safeValue(data, 'klines', data);
1610
+ const ohlcv = this.safeValue(response, 'data', []);
1598
1611
  return this.parseOHLCVs(ohlcv, market, timeframe, since, limit);
1599
1612
  }
1600
1613
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2353,9 +2366,7 @@ class bitmart extends bitmart$1 {
2353
2366
  return response;
2354
2367
  }
2355
2368
  async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2356
- if (symbol === undefined) {
2357
- throw new errors.ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol argument');
2358
- }
2369
+ this.checkRequiredSymbol('fetchOrdersByStatus', symbol);
2359
2370
  await this.loadMarkets();
2360
2371
  const market = this.market(symbol);
2361
2372
  if (!market['spot']) {
@@ -3043,10 +3054,8 @@ class bitmart extends bitmart$1 {
3043
3054
  * @param {string} [params.marginMode] 'isolated' is the default and 'cross' is unavailable
3044
3055
  * @returns {object} a [margin loan structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-loan-structure}
3045
3056
  */
3057
+ this.checkRequiredSymbol('repayMargin', symbol);
3046
3058
  await this.loadMarkets();
3047
- if (symbol === undefined) {
3048
- throw new errors.ArgumentsRequired(this.id + ' repayMargin() requires a symbol argument');
3049
- }
3050
3059
  const market = this.market(symbol);
3051
3060
  const currency = this.currency(code);
3052
3061
  const request = {
@@ -3086,10 +3095,8 @@ class bitmart extends bitmart$1 {
3086
3095
  * @param {string} [params.marginMode] 'isolated' is the default and 'cross' is unavailable
3087
3096
  * @returns {object} a [margin loan structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-loan-structure}
3088
3097
  */
3098
+ this.checkRequiredSymbol('borrowMargin', symbol);
3089
3099
  await this.loadMarkets();
3090
- if (symbol === undefined) {
3091
- throw new errors.ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
3092
- }
3093
3100
  const market = this.market(symbol);
3094
3101
  const currency = this.currency(code);
3095
3102
  const request = {
@@ -3545,9 +3552,7 @@ class bitmart extends bitmart$1 {
3545
3552
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
3546
3553
  * @returns {object[]} a list of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure}
3547
3554
  */
3548
- if (symbol === undefined) {
3549
- throw new errors.ArgumentsRequired(this.id + ' fetchBorrowInterest() requires a symbol argument');
3550
- }
3555
+ this.checkRequiredSymbol('fetchBorrowInterest', symbol);
3551
3556
  await this.loadMarkets();
3552
3557
  const market = this.market(symbol);
3553
3558
  const request = {
@@ -2444,9 +2444,7 @@ class bitmex extends bitmex$1 {
2444
2444
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
2445
2445
  * @returns {object} response from the exchange
2446
2446
  */
2447
- if (symbol === undefined) {
2448
- throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
2449
- }
2447
+ this.checkRequiredSymbol('setLeverage', symbol);
2450
2448
  if ((leverage < 0.01) || (leverage > 100)) {
2451
2449
  throw new errors.BadRequest(this.id + ' leverage should be between 0.01 and 100');
2452
2450
  }
@@ -2471,9 +2469,7 @@ class bitmex extends bitmex$1 {
2471
2469
  * @param {object} [params] extra parameters specific to the bitmex api endpoint
2472
2470
  * @returns {object} response from the exchange
2473
2471
  */
2474
- if (symbol === undefined) {
2475
- throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
2476
- }
2472
+ this.checkRequiredSymbol('setMarginMode', symbol);
2477
2473
  marginMode = marginMode.toLowerCase();
2478
2474
  if (marginMode !== 'isolated' && marginMode !== 'cross') {
2479
2475
  throw new errors.BadRequest(this.id + ' setMarginMode() marginMode argument should be isolated or cross');