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
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.46';
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);
@@ -70,7 +70,6 @@ class Exchange {
70
70
  this.orders = undefined;
71
71
  this.triggerOrders = undefined;
72
72
  this.transactions = {};
73
- this.positions = {};
74
73
  this.requiresWeb3 = false;
75
74
  this.requiresEddsa = false;
76
75
  this.enableLastJsonResponse = true;
@@ -264,7 +263,7 @@ class Exchange {
264
263
  this.transactions = {};
265
264
  this.ohlcvs = {};
266
265
  this.myTrades = undefined;
267
- this.positions = {};
266
+ this.positions = undefined;
268
267
  // web3 and cryptography flags
269
268
  this.requiresWeb3 = false;
270
269
  this.requiresEddsa = false;
@@ -2749,7 +2748,7 @@ class Exchange {
2749
2748
  const symbol = this.safeString(position, 'symbol');
2750
2749
  let market = undefined;
2751
2750
  if (symbol !== undefined) {
2752
- market = this.market(symbol);
2751
+ market = this.safeValue(this.markets, symbol);
2753
2752
  }
2754
2753
  if (contractSize === undefined && market !== undefined) {
2755
2754
  contractSize = this.safeNumber(market, 'contractSize');
@@ -2970,6 +2969,15 @@ class Exchange {
2970
2969
  async fetchPosition(symbol, params = {}) {
2971
2970
  throw new errors.NotSupported(this.id + ' fetchPosition() is not supported yet');
2972
2971
  }
2972
+ async watchPosition(symbol = undefined, params = {}) {
2973
+ throw new errors.NotSupported(this.id + ' watchPosition() is not supported yet');
2974
+ }
2975
+ async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
2976
+ throw new errors.NotSupported(this.id + ' watchPositions() is not supported yet');
2977
+ }
2978
+ async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
2979
+ return this.watchPositions(symbols, since, limit, params);
2980
+ }
2973
2981
  async fetchPositionsBySymbol(symbol, params = {}) {
2974
2982
  /**
2975
2983
  * @method
@@ -198,7 +198,57 @@ class ArrayCacheBySymbolById extends ArrayCache {
198
198
  this.allNewUpdates = (this.allNewUpdates || 0) + (afterLength - beforeLength);
199
199
  }
200
200
  }
201
+ class ArrayCacheBySymbolBySide extends ArrayCache {
202
+ constructor() {
203
+ super();
204
+ this.nestedNewUpdatesBySymbol = true;
205
+ Object.defineProperty(this, 'hashmap', {
206
+ __proto__: null,
207
+ value: {},
208
+ writable: true,
209
+ });
210
+ }
211
+ append(item) {
212
+ const bySide = this.hashmap[item.symbol] = this.hashmap[item.symbol] || {};
213
+ if (item.side in bySide) {
214
+ const reference = bySide[item.side];
215
+ if (reference !== item) {
216
+ for (const prop in item) {
217
+ reference[prop] = item[prop];
218
+ }
219
+ }
220
+ item = reference;
221
+ const index = this.findIndex((x) => x.symbol === item.symbol && x.side === item.side);
222
+ // move the order to the end of the array
223
+ this.splice(index, 1);
224
+ }
225
+ else {
226
+ bySide[item.side] = item;
227
+ }
228
+ this.push(item);
229
+ if (this.clearAllUpdates) {
230
+ this.clearAllUpdates = false;
231
+ this.clearUpdatesBySymbol = {};
232
+ this.allNewUpdates = 0;
233
+ this.newUpdatesBySymbol = {};
234
+ }
235
+ if (this.newUpdatesBySymbol[item.symbol] === undefined) {
236
+ this.newUpdatesBySymbol[item.symbol] = new Set();
237
+ }
238
+ if (this.clearUpdatesBySymbol[item.symbol]) {
239
+ this.clearUpdatesBySymbol[item.symbol] = false;
240
+ this.newUpdatesBySymbol[item.symbol].clear();
241
+ }
242
+ // in case an exchange updates the same order id twice
243
+ const sideSet = this.newUpdatesBySymbol[item.symbol];
244
+ const beforeLength = sideSet.size;
245
+ sideSet.add(item.side);
246
+ const afterLength = sideSet.size;
247
+ this.allNewUpdates = (this.allNewUpdates || 0) + (afterLength - beforeLength);
248
+ }
249
+ }
201
250
 
202
251
  exports.ArrayCache = ArrayCache;
203
252
  exports.ArrayCacheBySymbolById = ArrayCacheBySymbolById;
253
+ exports.ArrayCacheBySymbolBySide = ArrayCacheBySymbolBySide;
204
254
  exports.ArrayCacheByTimestamp = ArrayCacheByTimestamp;
@@ -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']);