ccxt 4.1.44 → 4.1.46

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 (242) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +2132 -768
  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/base/Exchange.js +11 -3
  8. package/dist/cjs/src/base/ws/Cache.js +50 -0
  9. package/dist/cjs/src/bigone.js +2 -6
  10. package/dist/cjs/src/binance.js +16 -12
  11. package/dist/cjs/src/bit2c.js +2 -4
  12. package/dist/cjs/src/bitbns.js +5 -15
  13. package/dist/cjs/src/bitfinex.js +1 -3
  14. package/dist/cjs/src/bitfinex2.js +1 -3
  15. package/dist/cjs/src/bitflyer.js +4 -12
  16. package/dist/cjs/src/bitforex.js +4 -8
  17. package/dist/cjs/src/bithumb.js +4 -10
  18. package/dist/cjs/src/bitmart.js +64 -59
  19. package/dist/cjs/src/bitmex.js +2 -6
  20. package/dist/cjs/src/bitopro.js +6 -16
  21. package/dist/cjs/src/bitrue.js +6 -14
  22. package/dist/cjs/src/bitvavo.js +9 -14
  23. package/dist/cjs/src/btctradeua.js +2 -4
  24. package/dist/cjs/src/bybit.js +88 -132
  25. package/dist/cjs/src/cex.js +2 -4
  26. package/dist/cjs/src/coinbasepro.js +2 -2
  27. package/dist/cjs/src/coinex.js +7 -24
  28. package/dist/cjs/src/coinfalcon.js +1 -3
  29. package/dist/cjs/src/coinmate.js +2 -4
  30. package/dist/cjs/src/coinone.js +2 -6
  31. package/dist/cjs/src/coinsph.js +5 -13
  32. package/dist/cjs/src/cryptocom.js +1 -1
  33. package/dist/cjs/src/currencycom.js +2 -6
  34. package/dist/cjs/src/gate.js +5 -7
  35. package/dist/cjs/src/gemini.js +1 -3
  36. package/dist/cjs/src/hitbtc.js +290 -100
  37. package/dist/cjs/src/hollaex.js +1 -3
  38. package/dist/cjs/src/huobi.js +4 -14
  39. package/dist/cjs/src/huobijp.js +1 -3
  40. package/dist/cjs/src/indodax.js +4 -10
  41. package/dist/cjs/src/kucoinfutures.js +2 -7
  42. package/dist/cjs/src/kuna.js +1 -0
  43. package/dist/cjs/src/luno.js +1 -3
  44. package/dist/cjs/src/mercado.js +7 -17
  45. package/dist/cjs/src/mexc.js +5 -15
  46. package/dist/cjs/src/oceanex.js +2 -4
  47. package/dist/cjs/src/okx.js +33 -21
  48. package/dist/cjs/src/phemex.js +12 -33
  49. package/dist/cjs/src/poloniexfutures.js +2 -6
  50. package/dist/cjs/src/pro/binance.js +203 -1
  51. package/dist/cjs/src/pro/bitget.js +181 -0
  52. package/dist/cjs/src/pro/bitmart.js +2 -4
  53. package/dist/cjs/src/pro/bitrue.js +0 -4
  54. package/dist/cjs/src/pro/bitstamp.js +2 -4
  55. package/dist/cjs/src/pro/bitvavo.js +3 -7
  56. package/dist/cjs/src/pro/bybit.js +154 -10
  57. package/dist/cjs/src/pro/cex.js +2 -6
  58. package/dist/cjs/src/pro/cryptocom.js +131 -1
  59. package/dist/cjs/src/pro/gate.js +161 -0
  60. package/dist/cjs/src/pro/huobi.js +128 -4
  61. package/dist/cjs/src/pro/krakenfutures.js +129 -0
  62. package/dist/cjs/src/pro/kucoinfutures.js +182 -0
  63. package/dist/cjs/src/pro/okx.js +121 -0
  64. package/dist/cjs/src/pro/whitebit.js +3 -7
  65. package/dist/cjs/src/probit.js +2 -6
  66. package/dist/cjs/src/tokocrypto.js +3 -7
  67. package/dist/cjs/src/wavesexchange.js +2 -4
  68. package/dist/cjs/src/wazirx.js +4 -10
  69. package/dist/cjs/src/whitebit.js +3 -7
  70. package/dist/cjs/src/woo.js +0 -3
  71. package/dist/cjs/src/yobit.js +3 -7
  72. package/js/ccxt.d.ts +1 -1
  73. package/js/ccxt.js +1 -1
  74. package/js/src/abstract/bequant.d.ts +37 -7
  75. package/js/src/abstract/binance.d.ts +1 -0
  76. package/js/src/abstract/binancecoinm.d.ts +1 -0
  77. package/js/src/abstract/binanceus.d.ts +1 -0
  78. package/js/src/abstract/binanceusdm.d.ts +1 -0
  79. package/js/src/abstract/bitcoincom.d.ts +37 -7
  80. package/js/src/abstract/bybit.d.ts +3 -0
  81. package/js/src/abstract/fmfwio.d.ts +37 -7
  82. package/js/src/abstract/hitbtc.d.ts +37 -7
  83. package/js/src/abstract/hitbtc3.d.ts +37 -7
  84. package/js/src/abstract/okex.d.ts +6 -1
  85. package/js/src/abstract/okex5.d.ts +6 -1
  86. package/js/src/abstract/okx.d.ts +6 -1
  87. package/js/src/ace.d.ts +2 -2
  88. package/js/src/ace.js +2 -4
  89. package/js/src/alpaca.d.ts +2 -2
  90. package/js/src/ascendex.d.ts +2 -2
  91. package/js/src/ascendex.js +1 -3
  92. package/js/src/base/Exchange.d.ts +4 -1
  93. package/js/src/base/Exchange.js +11 -3
  94. package/js/src/base/ws/Cache.d.ts +5 -1
  95. package/js/src/base/ws/Cache.js +50 -1
  96. package/js/src/bigone.d.ts +2 -2
  97. package/js/src/bigone.js +3 -7
  98. package/js/src/binance.d.ts +2 -2
  99. package/js/src/binance.js +16 -12
  100. package/js/src/bingx.d.ts +2 -2
  101. package/js/src/bit2c.d.ts +2 -2
  102. package/js/src/bit2c.js +3 -5
  103. package/js/src/bitbank.d.ts +2 -2
  104. package/js/src/bitbns.d.ts +2 -2
  105. package/js/src/bitbns.js +5 -15
  106. package/js/src/bitfinex.d.ts +2 -2
  107. package/js/src/bitfinex.js +1 -3
  108. package/js/src/bitfinex2.js +1 -3
  109. package/js/src/bitflyer.d.ts +2 -2
  110. package/js/src/bitflyer.js +4 -12
  111. package/js/src/bitforex.d.ts +2 -2
  112. package/js/src/bitforex.js +5 -9
  113. package/js/src/bitget.d.ts +2 -2
  114. package/js/src/bithumb.d.ts +2 -2
  115. package/js/src/bithumb.js +4 -10
  116. package/js/src/bitmart.d.ts +2 -2
  117. package/js/src/bitmart.js +64 -59
  118. package/js/src/bitmex.js +2 -6
  119. package/js/src/bitopro.d.ts +2 -2
  120. package/js/src/bitopro.js +6 -16
  121. package/js/src/bitpanda.d.ts +2 -2
  122. package/js/src/bitrue.d.ts +2 -2
  123. package/js/src/bitrue.js +6 -14
  124. package/js/src/bitso.d.ts +2 -2
  125. package/js/src/bitstamp.d.ts +2 -2
  126. package/js/src/bitstamp1.d.ts +2 -2
  127. package/js/src/bittrex.d.ts +2 -2
  128. package/js/src/bitvavo.d.ts +2 -2
  129. package/js/src/bitvavo.js +9 -14
  130. package/js/src/bl3p.d.ts +2 -2
  131. package/js/src/blockchaincom.d.ts +4 -4
  132. package/js/src/btcalpha.d.ts +2 -2
  133. package/js/src/btcbox.d.ts +2 -2
  134. package/js/src/btcmarkets.d.ts +2 -2
  135. package/js/src/btctradeua.d.ts +2 -2
  136. package/js/src/btctradeua.js +3 -5
  137. package/js/src/btcturk.d.ts +2 -2
  138. package/js/src/bybit.d.ts +2 -4
  139. package/js/src/bybit.js +88 -132
  140. package/js/src/cex.d.ts +2 -2
  141. package/js/src/cex.js +2 -4
  142. package/js/src/coinbase.d.ts +2 -2
  143. package/js/src/coinbasepro.d.ts +2 -2
  144. package/js/src/coinbasepro.js +2 -2
  145. package/js/src/coincheck.d.ts +2 -2
  146. package/js/src/coinex.js +7 -24
  147. package/js/src/coinfalcon.d.ts +2 -2
  148. package/js/src/coinfalcon.js +2 -4
  149. package/js/src/coinlist.d.ts +12 -12
  150. package/js/src/coinmate.d.ts +3 -3
  151. package/js/src/coinmate.js +3 -5
  152. package/js/src/coinone.d.ts +2 -2
  153. package/js/src/coinone.js +2 -6
  154. package/js/src/coinsph.d.ts +2 -2
  155. package/js/src/coinsph.js +5 -13
  156. package/js/src/coinspot.d.ts +2 -2
  157. package/js/src/cryptocom.d.ts +2 -2
  158. package/js/src/cryptocom.js +1 -1
  159. package/js/src/currencycom.d.ts +2 -2
  160. package/js/src/currencycom.js +2 -6
  161. package/js/src/delta.d.ts +2 -2
  162. package/js/src/deribit.d.ts +3 -3
  163. package/js/src/digifinex.d.ts +2 -2
  164. package/js/src/gate.d.ts +2 -2
  165. package/js/src/gate.js +5 -7
  166. package/js/src/gemini.d.ts +3 -3
  167. package/js/src/gemini.js +1 -3
  168. package/js/src/hitbtc.d.ts +3 -0
  169. package/js/src/hitbtc.js +291 -101
  170. package/js/src/hollaex.js +1 -3
  171. package/js/src/huobi.d.ts +2 -2
  172. package/js/src/huobi.js +4 -14
  173. package/js/src/huobijp.d.ts +2 -2
  174. package/js/src/huobijp.js +2 -4
  175. package/js/src/independentreserve.d.ts +2 -2
  176. package/js/src/indodax.d.ts +2 -2
  177. package/js/src/indodax.js +4 -10
  178. package/js/src/kraken.d.ts +2 -2
  179. package/js/src/krakenfutures.d.ts +2 -2
  180. package/js/src/kucoin.d.ts +2 -2
  181. package/js/src/kucoinfutures.d.ts +2 -2
  182. package/js/src/kucoinfutures.js +2 -7
  183. package/js/src/kuna.d.ts +3 -3
  184. package/js/src/kuna.js +1 -0
  185. package/js/src/latoken.d.ts +2 -2
  186. package/js/src/lbank2.d.ts +2 -2
  187. package/js/src/luno.d.ts +2 -2
  188. package/js/src/luno.js +1 -3
  189. package/js/src/lykke.d.ts +2 -2
  190. package/js/src/mercado.d.ts +2 -2
  191. package/js/src/mercado.js +7 -17
  192. package/js/src/mexc.js +5 -15
  193. package/js/src/novadax.d.ts +2 -2
  194. package/js/src/oceanex.d.ts +4 -4
  195. package/js/src/oceanex.js +2 -4
  196. package/js/src/okcoin.d.ts +2 -2
  197. package/js/src/okx.d.ts +2 -2
  198. package/js/src/okx.js +33 -21
  199. package/js/src/paymium.d.ts +2 -2
  200. package/js/src/phemex.js +12 -33
  201. package/js/src/poloniexfutures.d.ts +2 -2
  202. package/js/src/poloniexfutures.js +2 -6
  203. package/js/src/pro/binance.d.ts +6 -0
  204. package/js/src/pro/binance.js +204 -2
  205. package/js/src/pro/bitget.d.ts +3 -0
  206. package/js/src/pro/bitget.js +182 -1
  207. package/js/src/pro/bitmart.js +2 -4
  208. package/js/src/pro/bitrue.js +0 -4
  209. package/js/src/pro/bitstamp.js +3 -5
  210. package/js/src/pro/bitvavo.js +4 -8
  211. package/js/src/pro/bybit.d.ts +5 -1
  212. package/js/src/pro/bybit.js +156 -12
  213. package/js/src/pro/cex.js +3 -7
  214. package/js/src/pro/cryptocom.d.ts +4 -0
  215. package/js/src/pro/cryptocom.js +132 -2
  216. package/js/src/pro/gate.d.ts +5 -0
  217. package/js/src/pro/gate.js +162 -1
  218. package/js/src/pro/huobi.d.ts +2 -0
  219. package/js/src/pro/huobi.js +129 -5
  220. package/js/src/pro/krakenfutures.d.ts +3 -0
  221. package/js/src/pro/krakenfutures.js +129 -0
  222. package/js/src/pro/kucoinfutures.d.ts +5 -0
  223. package/js/src/pro/kucoinfutures.js +182 -0
  224. package/js/src/pro/okx.d.ts +2 -0
  225. package/js/src/pro/okx.js +123 -2
  226. package/js/src/pro/whitebit.js +4 -8
  227. package/js/src/probit.d.ts +2 -2
  228. package/js/src/probit.js +3 -7
  229. package/js/src/timex.d.ts +2 -2
  230. package/js/src/tokocrypto.d.ts +2 -2
  231. package/js/src/tokocrypto.js +4 -8
  232. package/js/src/wavesexchange.js +3 -5
  233. package/js/src/wazirx.d.ts +2 -2
  234. package/js/src/wazirx.js +5 -11
  235. package/js/src/whitebit.d.ts +2 -2
  236. package/js/src/whitebit.js +3 -7
  237. package/js/src/woo.d.ts +2 -2
  238. package/js/src/woo.js +1 -4
  239. package/js/src/yobit.js +3 -7
  240. package/js/src/zaif.d.ts +2 -2
  241. package/package.json +1 -1
  242. package/skip-tests.json +3 -1
@@ -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');
@@ -1055,9 +1055,7 @@ class bitopro extends bitopro$1 {
1055
1055
  * @param {object} [params] extra parameters specific to the bitopro api endpoint
1056
1056
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1057
1057
  */
1058
- if (symbol === undefined) {
1059
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires the symbol argument');
1060
- }
1058
+ this.checkRequiredSymbol('cancelOrder', symbol);
1061
1059
  await this.loadMarkets();
1062
1060
  const market = this.market(symbol);
1063
1061
  const request = {
@@ -1087,9 +1085,7 @@ class bitopro extends bitopro$1 {
1087
1085
  * @param {object} [params] extra parameters specific to the bitopro api endpoint
1088
1086
  * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1089
1087
  */
1090
- if (symbol === undefined) {
1091
- throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
1092
- }
1088
+ this.checkRequiredSymbol('cancelOrders', symbol);
1093
1089
  await this.loadMarkets();
1094
1090
  const market = this.market(symbol);
1095
1091
  const id = market['uppercaseId'];
@@ -1154,9 +1150,7 @@ class bitopro extends bitopro$1 {
1154
1150
  * @param {object} [params] extra parameters specific to the bitopro api endpoint
1155
1151
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1156
1152
  */
1157
- if (symbol === undefined) {
1158
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires the symbol argument');
1159
- }
1153
+ this.checkRequiredSymbol('fetchOrder', symbol);
1160
1154
  await this.loadMarkets();
1161
1155
  const market = this.market(symbol);
1162
1156
  const request = {
@@ -1197,13 +1191,11 @@ class bitopro extends bitopro$1 {
1197
1191
  * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md
1198
1192
  * @param {string} symbol unified market symbol of the market orders were made in
1199
1193
  * @param {int} [since] the earliest time in ms to fetch orders for
1200
- * @param {int} [limit] the maximum number of orde structures to retrieve
1194
+ * @param {int} [limit] the maximum number of order structures to retrieve
1201
1195
  * @param {object} [params] extra parameters specific to the bitopro api endpoint
1202
1196
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1203
1197
  */
1204
- if (symbol === undefined) {
1205
- throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires the symbol argument');
1206
- }
1198
+ this.checkRequiredSymbol('fetchOrders', symbol);
1207
1199
  await this.loadMarkets();
1208
1200
  const market = this.market(symbol);
1209
1201
  const request = {
@@ -1287,9 +1279,7 @@ class bitopro extends bitopro$1 {
1287
1279
  * @param {object} [params] extra parameters specific to the bitopro api endpoint
1288
1280
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1289
1281
  */
1290
- if (symbol === undefined) {
1291
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires the symbol argument');
1292
- }
1282
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
1293
1283
  await this.loadMarkets();
1294
1284
  const market = this.market(symbol);
1295
1285
  const request = {
@@ -1369,9 +1369,7 @@ class bitrue extends bitrue$1 {
1369
1369
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
1370
1370
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1371
1371
  */
1372
- if (symbol === undefined) {
1373
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1374
- }
1372
+ this.checkRequiredSymbol('fetchOrder', symbol);
1375
1373
  await this.loadMarkets();
1376
1374
  const market = this.market(symbol);
1377
1375
  const request = {
@@ -1395,13 +1393,11 @@ class bitrue extends bitrue$1 {
1395
1393
  * @description fetches information on multiple closed orders made by the user
1396
1394
  * @param {string} symbol unified market symbol of the market orders were made in
1397
1395
  * @param {int} [since] the earliest time in ms to fetch orders for
1398
- * @param {int} [limit] the maximum number of orde structures to retrieve
1396
+ * @param {int} [limit] the maximum number of order structures to retrieve
1399
1397
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
1400
1398
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1401
1399
  */
1402
- if (symbol === undefined) {
1403
- throw new errors.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
1404
- }
1400
+ this.checkRequiredSymbol('fetchClosedOrders', symbol);
1405
1401
  await this.loadMarkets();
1406
1402
  const market = this.market(symbol);
1407
1403
  const request = {
@@ -1449,13 +1445,11 @@ class bitrue extends bitrue$1 {
1449
1445
  * @description fetch all unfilled currently open orders
1450
1446
  * @param {string} symbol unified market symbol
1451
1447
  * @param {int} [since] the earliest time in ms to fetch open orders for
1452
- * @param {int} [limit] the maximum number of open orders structures to retrieve
1448
+ * @param {int} [limit] the maximum number of open order structures to retrieve
1453
1449
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
1454
1450
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1455
1451
  */
1456
- if (symbol === undefined) {
1457
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
1458
- }
1452
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
1459
1453
  await this.loadMarkets();
1460
1454
  const market = this.market(symbol);
1461
1455
  const request = {
@@ -1496,9 +1490,7 @@ class bitrue extends bitrue$1 {
1496
1490
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
1497
1491
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1498
1492
  */
1499
- if (symbol === undefined) {
1500
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1501
- }
1493
+ this.checkRequiredSymbol('cancelOrder', symbol);
1502
1494
  await this.loadMarkets();
1503
1495
  const market = this.market(symbol);
1504
1496
  const origClientOrderId = this.safeValue2(params, 'origClientOrderId', 'clientOrderId');
@@ -312,8 +312,8 @@ class bitvavo extends bitvavo$1 {
312
312
  * @returns {object[]} an array of objects representing market data
313
313
  */
314
314
  const response = await this.publicGetMarkets(params);
315
- const currencies = this.currencies;
316
- const currenciesById = this.indexBy(currencies, 'symbol');
315
+ const currencies = await this.fetchCurrencies();
316
+ const currenciesById = this.indexBy(currencies, 'id');
317
317
  //
318
318
  // [
319
319
  // {
@@ -338,7 +338,8 @@ class bitvavo extends bitvavo$1 {
338
338
  const quote = this.safeCurrencyCode(quoteId);
339
339
  const status = this.safeString(market, 'status');
340
340
  const baseCurrency = this.safeValue(currenciesById, baseId);
341
- result.push({
341
+ const basePrecision = this.safeInteger(baseCurrency, 'precision');
342
+ result.push(this.safeMarketStructure({
342
343
  'id': id,
343
344
  'symbol': base + '/' + quote,
344
345
  'base': base,
@@ -363,7 +364,7 @@ class bitvavo extends bitvavo$1 {
363
364
  'strike': undefined,
364
365
  'optionType': undefined,
365
366
  'precision': {
366
- 'amount': this.safeInteger(baseCurrency, 'decimals', 8),
367
+ 'amount': this.safeInteger(baseCurrency, 'decimals', basePrecision),
367
368
  'price': this.safeInteger(market, 'pricePrecision'),
368
369
  },
369
370
  'limits': {
@@ -386,7 +387,7 @@ class bitvavo extends bitvavo$1 {
386
387
  },
387
388
  'created': undefined,
388
389
  'info': market,
389
- });
390
+ }));
390
391
  }
391
392
  return result;
392
393
  }
@@ -1143,9 +1144,7 @@ class bitvavo extends bitvavo$1 {
1143
1144
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1144
1145
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1145
1146
  */
1146
- if (symbol === undefined) {
1147
- throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1148
- }
1147
+ this.checkRequiredSymbol('cancelOrder', symbol);
1149
1148
  await this.loadMarkets();
1150
1149
  const market = this.market(symbol);
1151
1150
  const request = {
@@ -1195,9 +1194,7 @@ class bitvavo extends bitvavo$1 {
1195
1194
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1196
1195
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1197
1196
  */
1198
- if (symbol === undefined) {
1199
- throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1200
- }
1197
+ this.checkRequiredSymbol('fetchOrder', symbol);
1201
1198
  await this.loadMarkets();
1202
1199
  const market = this.market(symbol);
1203
1200
  const request = {
@@ -1512,9 +1509,7 @@ class bitvavo extends bitvavo$1 {
1512
1509
  * @param {boolean} [params.paginate] 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)
1513
1510
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1514
1511
  */
1515
- if (symbol === undefined) {
1516
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1517
- }
1512
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
1518
1513
  await this.loadMarkets();
1519
1514
  let paginate = false;
1520
1515
  [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
@@ -525,13 +525,11 @@ class btctradeua extends btctradeua$1 {
525
525
  * @description fetch all unfilled currently open orders
526
526
  * @param {string} symbol unified market symbol
527
527
  * @param {int} [since] the earliest time in ms to fetch open orders for
528
- * @param {int} [limit] the maximum number of open orders structures to retrieve
528
+ * @param {int} [limit] the maximum number of open order structures to retrieve
529
529
  * @param {object} [params] extra parameters specific to the btctradeua api endpoint
530
530
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
531
531
  */
532
- if (symbol === undefined) {
533
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
534
- }
532
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
535
533
  await this.loadMarkets();
536
534
  const market = this.market(symbol);
537
535
  const request = {