ccxt 4.4.41 → 4.4.42

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 (170) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ace.js +1 -1
  5. package/dist/cjs/src/alpaca.js +0 -1
  6. package/dist/cjs/src/ascendex.js +0 -1
  7. package/dist/cjs/src/base/Exchange.js +21 -16
  8. package/dist/cjs/src/bigone.js +0 -1
  9. package/dist/cjs/src/binance.js +3 -0
  10. package/dist/cjs/src/bingx.js +3 -0
  11. package/dist/cjs/src/bitfinex.js +123 -0
  12. package/dist/cjs/src/blofin.js +16 -7
  13. package/dist/cjs/src/cex.js +1 -1
  14. package/dist/cjs/src/coinbase.js +8 -9
  15. package/dist/cjs/src/coinbaseexchange.js +5 -6
  16. package/dist/cjs/src/coinbaseinternational.js +7 -8
  17. package/dist/cjs/src/coincatch.js +0 -1
  18. package/dist/cjs/src/coincheck.js +0 -1
  19. package/dist/cjs/src/coinex.js +91 -6
  20. package/dist/cjs/src/coinlist.js +3 -4
  21. package/dist/cjs/src/coinmate.js +1 -3
  22. package/dist/cjs/src/coinmetro.js +4 -5
  23. package/dist/cjs/src/coinone.js +0 -1
  24. package/dist/cjs/src/coinsph.js +7 -8
  25. package/dist/cjs/src/cryptocom.js +3 -0
  26. package/dist/cjs/src/currencycom.js +3 -4
  27. package/dist/cjs/src/defx.js +6 -7
  28. package/dist/cjs/src/deribit.js +1 -3
  29. package/dist/cjs/src/digifinex.js +0 -1
  30. package/dist/cjs/src/ellipx.js +0 -2
  31. package/dist/cjs/src/exmo.js +1 -2
  32. package/dist/cjs/src/gate.js +1 -2
  33. package/dist/cjs/src/gemini.js +4 -5
  34. package/dist/cjs/src/hashkey.js +79 -83
  35. package/dist/cjs/src/hitbtc.js +49 -5
  36. package/dist/cjs/src/hollaex.js +4 -6
  37. package/dist/cjs/src/htx.js +1 -3
  38. package/dist/cjs/src/huobijp.js +0 -1
  39. package/dist/cjs/src/idex.js +8 -8
  40. package/dist/cjs/src/independentreserve.js +0 -1
  41. package/dist/cjs/src/indodax.js +0 -1
  42. package/dist/cjs/src/kraken.js +63 -3
  43. package/dist/cjs/src/krakenfutures.js +75 -3
  44. package/dist/cjs/src/kucoin.js +1 -3
  45. package/dist/cjs/src/kucoinfutures.js +10 -9
  46. package/dist/cjs/src/kuna.js +1 -3
  47. package/dist/cjs/src/latoken.js +1 -3
  48. package/dist/cjs/src/lbank.js +0 -1
  49. package/dist/cjs/src/luno.js +0 -1
  50. package/dist/cjs/src/lykke.js +0 -1
  51. package/dist/cjs/src/mercado.js +0 -1
  52. package/dist/cjs/src/mexc.js +3 -4
  53. package/dist/cjs/src/ndax.js +1 -1
  54. package/dist/cjs/src/novadax.js +4 -6
  55. package/dist/cjs/src/oceanex.js +0 -1
  56. package/dist/cjs/src/okcoin.js +1 -3
  57. package/dist/cjs/src/okx.js +1 -3
  58. package/dist/cjs/src/onetrading.js +1 -3
  59. package/dist/cjs/src/p2b.js +1 -1
  60. package/dist/cjs/src/paradex.js +5 -7
  61. package/dist/cjs/src/phemex.js +8 -10
  62. package/dist/cjs/src/poloniex.js +1 -3
  63. package/dist/cjs/src/poloniexfutures.js +6 -6
  64. package/dist/cjs/src/probit.js +0 -1
  65. package/dist/cjs/src/timex.js +0 -1
  66. package/dist/cjs/src/tokocrypto.js +11 -14
  67. package/dist/cjs/src/tradeogre.js +1 -1
  68. package/dist/cjs/src/upbit.js +0 -1
  69. package/dist/cjs/src/wavesexchange.js +4 -5
  70. package/dist/cjs/src/whitebit.js +8 -9
  71. package/dist/cjs/src/woo.js +99 -13
  72. package/dist/cjs/src/woofipro.js +96 -15
  73. package/dist/cjs/src/xt.js +3 -2
  74. package/dist/cjs/src/yobit.js +0 -1
  75. package/dist/cjs/src/zaif.js +0 -1
  76. package/dist/cjs/src/zonda.js +1 -2
  77. package/js/ccxt.d.ts +1 -1
  78. package/js/ccxt.js +1 -1
  79. package/js/src/abstract/binance.d.ts +3 -0
  80. package/js/src/abstract/binancecoinm.d.ts +3 -0
  81. package/js/src/abstract/binanceus.d.ts +3 -0
  82. package/js/src/abstract/binanceusdm.d.ts +3 -0
  83. package/js/src/ace.js +1 -1
  84. package/js/src/alpaca.js +0 -1
  85. package/js/src/ascendex.js +0 -1
  86. package/js/src/base/Exchange.d.ts +6 -6
  87. package/js/src/base/Exchange.js +21 -16
  88. package/js/src/bigone.js +0 -1
  89. package/js/src/binance.js +3 -0
  90. package/js/src/bingx.js +3 -0
  91. package/js/src/bitfinex.d.ts +11 -1
  92. package/js/src/bitfinex.js +123 -0
  93. package/js/src/blofin.d.ts +1 -1
  94. package/js/src/blofin.js +16 -7
  95. package/js/src/cex.js +1 -1
  96. package/js/src/coinbase.js +8 -9
  97. package/js/src/coinbaseexchange.js +5 -6
  98. package/js/src/coinbaseinternational.d.ts +1 -1
  99. package/js/src/coinbaseinternational.js +7 -8
  100. package/js/src/coincatch.js +0 -1
  101. package/js/src/coincheck.js +0 -1
  102. package/js/src/coinex.js +91 -6
  103. package/js/src/coinlist.js +3 -4
  104. package/js/src/coinmate.js +1 -3
  105. package/js/src/coinmetro.js +4 -5
  106. package/js/src/coinone.js +0 -1
  107. package/js/src/coinsph.js +7 -8
  108. package/js/src/cryptocom.js +3 -0
  109. package/js/src/currencycom.js +3 -4
  110. package/js/src/defx.js +6 -7
  111. package/js/src/deribit.js +1 -3
  112. package/js/src/digifinex.js +0 -1
  113. package/js/src/ellipx.js +0 -2
  114. package/js/src/exmo.d.ts +1 -1
  115. package/js/src/exmo.js +1 -2
  116. package/js/src/gate.d.ts +1 -1
  117. package/js/src/gate.js +1 -2
  118. package/js/src/gemini.js +4 -5
  119. package/js/src/hashkey.js +79 -83
  120. package/js/src/hitbtc.d.ts +11 -1
  121. package/js/src/hitbtc.js +49 -5
  122. package/js/src/hollaex.js +4 -6
  123. package/js/src/htx.js +1 -3
  124. package/js/src/huobijp.js +0 -1
  125. package/js/src/idex.js +8 -8
  126. package/js/src/independentreserve.js +0 -1
  127. package/js/src/indodax.js +0 -1
  128. package/js/src/kraken.d.ts +2 -2
  129. package/js/src/kraken.js +63 -3
  130. package/js/src/krakenfutures.d.ts +2 -2
  131. package/js/src/krakenfutures.js +75 -3
  132. package/js/src/kucoin.js +1 -3
  133. package/js/src/kucoinfutures.d.ts +5 -4
  134. package/js/src/kucoinfutures.js +10 -9
  135. package/js/src/kuna.js +1 -3
  136. package/js/src/latoken.js +1 -3
  137. package/js/src/lbank.js +0 -1
  138. package/js/src/luno.js +0 -1
  139. package/js/src/lykke.js +0 -1
  140. package/js/src/mercado.js +0 -1
  141. package/js/src/mexc.js +3 -4
  142. package/js/src/ndax.js +1 -1
  143. package/js/src/novadax.js +4 -6
  144. package/js/src/oceanex.js +0 -1
  145. package/js/src/okcoin.js +1 -3
  146. package/js/src/okx.js +1 -3
  147. package/js/src/onetrading.js +1 -3
  148. package/js/src/p2b.js +1 -1
  149. package/js/src/paradex.d.ts +1 -1
  150. package/js/src/paradex.js +5 -7
  151. package/js/src/phemex.js +8 -10
  152. package/js/src/poloniex.js +1 -3
  153. package/js/src/poloniexfutures.js +6 -6
  154. package/js/src/probit.js +0 -1
  155. package/js/src/timex.js +0 -1
  156. package/js/src/tokocrypto.js +11 -14
  157. package/js/src/tradeogre.js +1 -1
  158. package/js/src/upbit.js +0 -1
  159. package/js/src/wavesexchange.d.ts +1 -1
  160. package/js/src/wavesexchange.js +4 -5
  161. package/js/src/whitebit.js +8 -9
  162. package/js/src/woo.d.ts +1 -1
  163. package/js/src/woo.js +99 -13
  164. package/js/src/woofipro.js +96 -15
  165. package/js/src/xt.d.ts +2 -1
  166. package/js/src/xt.js +3 -2
  167. package/js/src/yobit.js +0 -1
  168. package/js/src/zaif.js +0 -1
  169. package/js/src/zonda.js +1 -2
  170. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -200,7 +200,7 @@ var xt$1 = require('./src/pro/xt.js');
200
200
 
201
201
  //-----------------------------------------------------------------------------
202
202
  // this is updated by vss.js when building
203
- const version = '4.4.41';
203
+ const version = '4.4.42';
204
204
  Exchange["default"].ccxtVersion = version;
205
205
  const exchanges = {
206
206
  'ace': ace,
@@ -589,7 +589,7 @@ class ace extends ace$1 {
589
589
  'postOnly': undefined,
590
590
  'side': side,
591
591
  'price': price,
592
- 'stopPrice': undefined,
592
+ 'triggerPrice': undefined,
593
593
  'amount': amount,
594
594
  'cost': undefined,
595
595
  'average': average,
@@ -1211,7 +1211,6 @@ class alpaca extends alpaca$1 {
1211
1211
  'postOnly': undefined,
1212
1212
  'side': this.safeString(order, 'side'),
1213
1213
  'price': this.safeNumber(order, 'limit_price'),
1214
- 'stopPrice': this.safeNumber(order, 'stop_price'),
1215
1214
  'triggerPrice': this.safeNumber(order, 'stop_price'),
1216
1215
  'cost': undefined,
1217
1216
  'average': this.safeNumber(order, 'filled_avg_price'),
@@ -1418,7 +1418,6 @@ class ascendex extends ascendex$1 {
1418
1418
  'reduceOnly': reduceOnly,
1419
1419
  'side': side,
1420
1420
  'price': price,
1421
- 'stopPrice': triggerPrice,
1422
1421
  'triggerPrice': triggerPrice,
1423
1422
  'amount': amount,
1424
1423
  'cost': undefined,
@@ -4466,10 +4466,15 @@ class Exchange {
4466
4466
  }
4467
4467
  handleOptionAndParams2(params, methodName1, optionName1, optionName2, defaultValue = undefined) {
4468
4468
  let value = undefined;
4469
- [value, params] = this.handleOptionAndParams(params, methodName1, optionName1, defaultValue);
4469
+ [value, params] = this.handleOptionAndParams(params, methodName1, optionName1);
4470
+ if (value !== undefined) {
4471
+ // omit optionName2 too from params
4472
+ params = this.omit(params, optionName2);
4473
+ return [value, params];
4474
+ }
4470
4475
  // if still undefined, try optionName2
4471
4476
  let value2 = undefined;
4472
- [value2, params] = this.handleOptionAndParams(params, methodName1, optionName2, value);
4477
+ [value2, params] = this.handleOptionAndParams(params, methodName1, optionName2, defaultValue);
4473
4478
  return [value2, params];
4474
4479
  }
4475
4480
  handleOption(methodName, optionName, defaultValue = undefined) {
@@ -5524,52 +5529,52 @@ class Exchange {
5524
5529
  const query = this.extend(params, { 'reduceOnly': true });
5525
5530
  return await this.createOrderWs(symbol, type, side, amount, price, query);
5526
5531
  }
5527
- async createStopOrder(symbol, type, side, amount, price = undefined, stopPrice = undefined, params = {}) {
5532
+ async createStopOrder(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
5528
5533
  if (!this.has['createStopOrder']) {
5529
5534
  throw new errors.NotSupported(this.id + ' createStopOrder() is not supported yet');
5530
5535
  }
5531
- if (stopPrice === undefined) {
5536
+ if (triggerPrice === undefined) {
5532
5537
  throw new errors.ArgumentsRequired(this.id + ' create_stop_order() requires a stopPrice argument');
5533
5538
  }
5534
- const query = this.extend(params, { 'stopPrice': stopPrice });
5539
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5535
5540
  return await this.createOrder(symbol, type, side, amount, price, query);
5536
5541
  }
5537
- async createStopOrderWs(symbol, type, side, amount, price = undefined, stopPrice = undefined, params = {}) {
5542
+ async createStopOrderWs(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
5538
5543
  if (!this.has['createStopOrderWs']) {
5539
5544
  throw new errors.NotSupported(this.id + ' createStopOrderWs() is not supported yet');
5540
5545
  }
5541
- if (stopPrice === undefined) {
5546
+ if (triggerPrice === undefined) {
5542
5547
  throw new errors.ArgumentsRequired(this.id + ' createStopOrderWs() requires a stopPrice argument');
5543
5548
  }
5544
- const query = this.extend(params, { 'stopPrice': stopPrice });
5549
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5545
5550
  return await this.createOrderWs(symbol, type, side, amount, price, query);
5546
5551
  }
5547
- async createStopLimitOrder(symbol, side, amount, price, stopPrice, params = {}) {
5552
+ async createStopLimitOrder(symbol, side, amount, price, triggerPrice, params = {}) {
5548
5553
  if (!this.has['createStopLimitOrder']) {
5549
5554
  throw new errors.NotSupported(this.id + ' createStopLimitOrder() is not supported yet');
5550
5555
  }
5551
- const query = this.extend(params, { 'stopPrice': stopPrice });
5556
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5552
5557
  return await this.createOrder(symbol, 'limit', side, amount, price, query);
5553
5558
  }
5554
- async createStopLimitOrderWs(symbol, side, amount, price, stopPrice, params = {}) {
5559
+ async createStopLimitOrderWs(symbol, side, amount, price, triggerPrice, params = {}) {
5555
5560
  if (!this.has['createStopLimitOrderWs']) {
5556
5561
  throw new errors.NotSupported(this.id + ' createStopLimitOrderWs() is not supported yet');
5557
5562
  }
5558
- const query = this.extend(params, { 'stopPrice': stopPrice });
5563
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5559
5564
  return await this.createOrderWs(symbol, 'limit', side, amount, price, query);
5560
5565
  }
5561
- async createStopMarketOrder(symbol, side, amount, stopPrice, params = {}) {
5566
+ async createStopMarketOrder(symbol, side, amount, triggerPrice, params = {}) {
5562
5567
  if (!this.has['createStopMarketOrder']) {
5563
5568
  throw new errors.NotSupported(this.id + ' createStopMarketOrder() is not supported yet');
5564
5569
  }
5565
- const query = this.extend(params, { 'stopPrice': stopPrice });
5570
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5566
5571
  return await this.createOrder(symbol, 'market', side, amount, undefined, query);
5567
5572
  }
5568
- async createStopMarketOrderWs(symbol, side, amount, stopPrice, params = {}) {
5573
+ async createStopMarketOrderWs(symbol, side, amount, triggerPrice, params = {}) {
5569
5574
  if (!this.has['createStopMarketOrderWs']) {
5570
5575
  throw new errors.NotSupported(this.id + ' createStopMarketOrderWs() is not supported yet');
5571
5576
  }
5572
- const query = this.extend(params, { 'stopPrice': stopPrice });
5577
+ const query = this.extend(params, { 'stopPrice': triggerPrice });
5573
5578
  return await this.createOrderWs(symbol, 'market', side, amount, undefined, query);
5574
5579
  }
5575
5580
  safeCurrencyCode(currencyId, currency = undefined) {
@@ -1375,7 +1375,6 @@ class bigone extends bigone$1 {
1375
1375
  'postOnly': this.safeBool(order, 'post_only'),
1376
1376
  'side': side,
1377
1377
  'price': price,
1378
- 'stopPrice': triggerPrice,
1379
1378
  'triggerPrice': triggerPrice,
1380
1379
  'amount': amount,
1381
1380
  'cost': cost,
@@ -634,6 +634,8 @@ class binance extends binance$1 {
634
634
  'portfolio/bnb-transfer': 150,
635
635
  'portfolio/repay-futures-switch': 150,
636
636
  'portfolio/repay-futures-negative-balance': 150,
637
+ 'portfolio/mint': 20,
638
+ 'portfolio/redeem': 20,
637
639
  'lending/auto-invest/plan/add': 0.1,
638
640
  'lending/auto-invest/plan/edit': 0.1,
639
641
  'lending/auto-invest/plan/edit-status': 0.1,
@@ -962,6 +964,7 @@ class binance extends binance$1 {
962
964
  'block/order/orders': 5,
963
965
  'block/order/execute': 5,
964
966
  'block/user-trades': 5,
967
+ 'blockTrades': 5,
965
968
  },
966
969
  'post': {
967
970
  'order': 1,
@@ -5598,6 +5598,9 @@ class bingx extends bingx$1 {
5598
5598
  request['endTs'] = now;
5599
5599
  }
5600
5600
  if (market['spot']) {
5601
+ if (limit !== undefined) {
5602
+ request['limit'] = limit; // default 500, maximum 1000
5603
+ }
5601
5604
  response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
5602
5605
  const data = this.safeDict(response, 'data', {});
5603
5606
  fills = this.safeList(data, 'fills', []);
@@ -82,6 +82,7 @@ class bitfinex extends bitfinex$1 {
82
82
  'fetchOHLCV': true,
83
83
  'fetchOpenInterest': true,
84
84
  'fetchOpenInterestHistory': true,
85
+ 'fetchOpenInterests': true,
85
86
  'fetchOpenOrder': true,
86
87
  'fetchOpenOrders': true,
87
88
  'fetchOrder': true,
@@ -401,6 +402,75 @@ class bitfinex extends bitfinex$1 {
401
402
  'TETHERUSE': 'ERC20',
402
403
  },
403
404
  },
405
+ 'features': {
406
+ 'default': {
407
+ 'sandbox': false,
408
+ 'createOrder': {
409
+ 'marginMode': true,
410
+ 'triggerPrice': true,
411
+ 'triggerPriceType': undefined,
412
+ 'triggerDirection': false,
413
+ 'stopLossPrice': true,
414
+ 'takeProfitPrice': true,
415
+ 'attachedStopLossTakeProfit': undefined,
416
+ 'timeInForce': {
417
+ 'IOC': true,
418
+ 'FOK': true,
419
+ 'PO': true,
420
+ 'GTD': false,
421
+ },
422
+ 'hedged': false,
423
+ 'trailing': true, // todo: unify
424
+ // todo: leverage unify
425
+ },
426
+ 'createOrders': {
427
+ 'max': 75,
428
+ },
429
+ 'fetchMyTrades': {
430
+ 'marginMode': false,
431
+ 'limit': 2500,
432
+ 'daysBack': undefined,
433
+ 'untilDays': 100000, // todo: implement
434
+ },
435
+ 'fetchOrder': {
436
+ 'marginMode': false,
437
+ 'trigger': false,
438
+ 'trailing': false,
439
+ },
440
+ 'fetchOpenOrders': {
441
+ 'marginMode': false,
442
+ 'limit': undefined,
443
+ 'trigger': false,
444
+ 'trailing': false,
445
+ },
446
+ 'fetchOrders': undefined,
447
+ 'fetchClosedOrders': {
448
+ 'marginMode': false,
449
+ 'limit': undefined,
450
+ 'daysBackClosed': undefined,
451
+ 'daysBackCanceled': undefined,
452
+ 'untilDays': 100000,
453
+ 'trigger': false,
454
+ 'trailing': false,
455
+ },
456
+ 'fetchOHLCV': {
457
+ 'limit': 10000,
458
+ },
459
+ },
460
+ 'spot': {
461
+ 'extends': 'default',
462
+ },
463
+ 'swap': {
464
+ 'linear': {
465
+ 'extends': 'default',
466
+ },
467
+ 'inverse': undefined,
468
+ },
469
+ 'future': {
470
+ 'linear': undefined,
471
+ 'inverse': undefined,
472
+ },
473
+ },
404
474
  'exceptions': {
405
475
  'exact': {
406
476
  '11010': errors.RateLimitExceeded,
@@ -3245,6 +3315,59 @@ class bitfinex extends bitfinex$1 {
3245
3315
  'previousFundingDatetime': undefined,
3246
3316
  };
3247
3317
  }
3318
+ /**
3319
+ * @method
3320
+ * @name bitfinex#fetchOpenInterests
3321
+ * @description Retrieves the open interest for a list of symbols
3322
+ * @see https://docs.bitfinex.com/reference/rest-public-derivatives-status
3323
+ * @param {string[]} [symbols] a list of unified CCXT market symbols
3324
+ * @param {object} [params] exchange specific parameters
3325
+ * @returns {object[]} a list of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
3326
+ */
3327
+ async fetchOpenInterests(symbols = undefined, params = {}) {
3328
+ await this.loadMarkets();
3329
+ symbols = this.marketSymbols(symbols);
3330
+ let marketIds = ['ALL'];
3331
+ if (symbols !== undefined) {
3332
+ marketIds = this.marketIds(symbols);
3333
+ }
3334
+ const request = {
3335
+ 'keys': marketIds.join(','),
3336
+ };
3337
+ const response = await this.publicGetStatusDeriv(this.extend(request, params));
3338
+ //
3339
+ // [
3340
+ // [
3341
+ // "tXRPF0:USTF0", // market id
3342
+ // 1706256986000, // millisecond timestamp
3343
+ // null,
3344
+ // 0.512705, // derivative mid price
3345
+ // 0.512395, // underlying spot mid price
3346
+ // null,
3347
+ // 37671483.04, // insurance fund balance
3348
+ // null,
3349
+ // 1706284800000, // timestamp of next funding
3350
+ // 0.00002353, // accrued funding for next period
3351
+ // 317, // next funding step
3352
+ // null,
3353
+ // 0, // current funding
3354
+ // null,
3355
+ // null,
3356
+ // 0.5123016, // mark price
3357
+ // null,
3358
+ // null,
3359
+ // 2233562.03115, // open interest in contracts
3360
+ // null,
3361
+ // null,
3362
+ // null,
3363
+ // 0.0005, // average spread without funding payment
3364
+ // 0.0025 // funding payment cap
3365
+ // ]
3366
+ // ]
3367
+ //
3368
+ const result = this.parseOpenInterests(response);
3369
+ return this.filterByArray(result, 'symbol', symbols);
3370
+ }
3248
3371
  /**
3249
3372
  * @method
3250
3373
  * @name bitfinex#fetchOpenInterest
@@ -158,7 +158,7 @@ class blofin extends blofin$1 {
158
158
  'rest': 'https://openapi.blofin.com',
159
159
  },
160
160
  'referral': {
161
- 'url': 'https://blofin.com/register?referral_code=jBd8U1',
161
+ 'url': 'https://blofin.com/register?referral_code=f79EsS',
162
162
  'discount': 0.05,
163
163
  },
164
164
  'www': 'https://www.blofin.com',
@@ -278,10 +278,18 @@ class blofin extends blofin$1 {
278
278
  'brokerId': 'ec6dd3a7dd982d0b',
279
279
  'accountsByType': {
280
280
  'swap': 'futures',
281
+ 'funding': 'funding',
281
282
  'future': 'futures',
283
+ 'copy_trading': 'copy_trading',
284
+ 'earn': 'earn',
285
+ 'spot': 'spot',
282
286
  },
283
287
  'accountsById': {
288
+ 'funding': 'funding',
284
289
  'futures': 'swap',
290
+ 'copy_trading': 'copy_trading',
291
+ 'earn': 'earn',
292
+ 'spot': 'spot',
285
293
  },
286
294
  'sandboxMode': false,
287
295
  'defaultNetwork': 'ERC20',
@@ -879,8 +887,9 @@ class blofin extends blofin$1 {
879
887
  const entry = this.safeDict(data, 0, {});
880
888
  return this.parseFundingRate(entry, market);
881
889
  }
882
- parseBalanceByType(type, response) {
883
- if (type) {
890
+ parseBalanceByType(response) {
891
+ const data = this.safeList(response, 'data');
892
+ if ((data !== undefined) && Array.isArray(data)) {
884
893
  return this.parseFundingBalance(response);
885
894
  }
886
895
  else {
@@ -998,11 +1007,11 @@ class blofin extends blofin$1 {
998
1007
  */
999
1008
  async fetchBalance(params = {}) {
1000
1009
  await this.loadMarkets();
1001
- const accountType = this.safeString2(params, 'accountType', 'type');
1002
- params = this.omit(params, ['accountType', 'type']);
1010
+ let accountType = undefined;
1011
+ [accountType, params] = this.handleOptionAndParams2(params, 'fetchBalance', 'accountType', 'type');
1003
1012
  const request = {};
1004
1013
  let response = undefined;
1005
- if (accountType !== undefined) {
1014
+ if (accountType !== undefined && accountType !== 'swap') {
1006
1015
  const options = this.safeDict(this.options, 'accountsByType', {});
1007
1016
  const parsedAccountType = this.safeString(options, accountType, accountType);
1008
1017
  request['accountType'] = parsedAccountType;
@@ -1011,7 +1020,7 @@ class blofin extends blofin$1 {
1011
1020
  else {
1012
1021
  response = await this.privateGetAccountBalance(this.extend(request, params));
1013
1022
  }
1014
- return this.parseBalanceByType(accountType, response);
1023
+ return this.parseBalanceByType(response);
1015
1024
  }
1016
1025
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
1017
1026
  const market = this.market(symbol);
@@ -1087,7 +1087,7 @@ class cex extends cex$1 {
1087
1087
  'postOnly': undefined,
1088
1088
  'side': this.safeStringLower(order, 'side'),
1089
1089
  'price': this.safeNumber(order, 'price'),
1090
- 'stopPrice': this.safeNumber(order, 'stopPrice'),
1090
+ 'triggerPrice': this.safeNumber(order, 'stopPrice'),
1091
1091
  'amount': requestedBase,
1092
1092
  'cost': executedQuote,
1093
1093
  'average': this.safeNumber(order, 'averagePrice'),
@@ -2890,10 +2890,10 @@ class coinbase extends coinbase$1 {
2890
2890
  'product_id': market['id'],
2891
2891
  'side': side.toUpperCase(),
2892
2892
  };
2893
- const stopPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
2893
+ const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
2894
2894
  const stopLossPrice = this.safeNumber(params, 'stopLossPrice');
2895
2895
  const takeProfitPrice = this.safeNumber(params, 'takeProfitPrice');
2896
- const isStop = stopPrice !== undefined;
2896
+ const isStop = triggerPrice !== undefined;
2897
2897
  const isStopLoss = stopLossPrice !== undefined;
2898
2898
  const isTakeProfit = takeProfitPrice !== undefined;
2899
2899
  const timeInForce = this.safeString(params, 'timeInForce');
@@ -2913,7 +2913,7 @@ class coinbase extends coinbase$1 {
2913
2913
  'stop_limit_stop_limit_gtd': {
2914
2914
  'base_size': this.amountToPrecision(symbol, amount),
2915
2915
  'limit_price': this.priceToPrecision(symbol, price),
2916
- 'stop_price': this.priceToPrecision(symbol, stopPrice),
2916
+ 'stop_price': this.priceToPrecision(symbol, triggerPrice),
2917
2917
  'stop_direction': stopDirection,
2918
2918
  'end_time': endTime,
2919
2919
  },
@@ -2924,31 +2924,31 @@ class coinbase extends coinbase$1 {
2924
2924
  'stop_limit_stop_limit_gtc': {
2925
2925
  'base_size': this.amountToPrecision(symbol, amount),
2926
2926
  'limit_price': this.priceToPrecision(symbol, price),
2927
- 'stop_price': this.priceToPrecision(symbol, stopPrice),
2927
+ 'stop_price': this.priceToPrecision(symbol, triggerPrice),
2928
2928
  'stop_direction': stopDirection,
2929
2929
  },
2930
2930
  };
2931
2931
  }
2932
2932
  }
2933
2933
  else if (isStopLoss || isTakeProfit) {
2934
- let triggerPrice = undefined;
2934
+ let tpslPrice = undefined;
2935
2935
  if (isStopLoss) {
2936
2936
  if (stopDirection === undefined) {
2937
2937
  stopDirection = (side === 'buy') ? 'STOP_DIRECTION_STOP_UP' : 'STOP_DIRECTION_STOP_DOWN';
2938
2938
  }
2939
- triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
2939
+ tpslPrice = this.priceToPrecision(symbol, stopLossPrice);
2940
2940
  }
2941
2941
  else {
2942
2942
  if (stopDirection === undefined) {
2943
2943
  stopDirection = (side === 'buy') ? 'STOP_DIRECTION_STOP_DOWN' : 'STOP_DIRECTION_STOP_UP';
2944
2944
  }
2945
- triggerPrice = this.priceToPrecision(symbol, takeProfitPrice);
2945
+ tpslPrice = this.priceToPrecision(symbol, takeProfitPrice);
2946
2946
  }
2947
2947
  request['order_configuration'] = {
2948
2948
  'stop_limit_stop_limit_gtc': {
2949
2949
  'base_size': this.amountToPrecision(symbol, amount),
2950
2950
  'limit_price': this.priceToPrecision(symbol, price),
2951
- 'stop_price': triggerPrice,
2951
+ 'stop_price': tpslPrice,
2952
2952
  'stop_direction': stopDirection,
2953
2953
  },
2954
2954
  };
@@ -3231,7 +3231,6 @@ class coinbase extends coinbase$1 {
3231
3231
  'postOnly': postOnly,
3232
3232
  'side': this.safeStringLower(order, 'side'),
3233
3233
  'price': price,
3234
- 'stopPrice': triggerPrice,
3235
3234
  'triggerPrice': triggerPrice,
3236
3235
  'amount': amount,
3237
3236
  'filled': this.safeString(order, 'filled_size'),
@@ -1061,7 +1061,7 @@ class coinbaseexchange extends coinbaseexchange$1 {
1061
1061
  const side = this.safeString(order, 'side');
1062
1062
  const timeInForce = this.safeString(order, 'time_in_force');
1063
1063
  const postOnly = this.safeValue(order, 'post_only');
1064
- const stopPrice = this.safeNumber(order, 'stop_price');
1064
+ const triggerPrice = this.safeNumber(order, 'stop_price');
1065
1065
  const clientOrderId = this.safeString(order, 'client_oid');
1066
1066
  return this.safeOrder({
1067
1067
  'id': id,
@@ -1077,8 +1077,7 @@ class coinbaseexchange extends coinbaseexchange$1 {
1077
1077
  'postOnly': postOnly,
1078
1078
  'side': side,
1079
1079
  'price': price,
1080
- 'stopPrice': stopPrice,
1081
- 'triggerPrice': stopPrice,
1080
+ 'triggerPrice': triggerPrice,
1082
1081
  'cost': cost,
1083
1082
  'amount': amount,
1084
1083
  'filled': filled,
@@ -1254,9 +1253,9 @@ class coinbaseexchange extends coinbaseexchange$1 {
1254
1253
  if (clientOrderId !== undefined) {
1255
1254
  request['client_oid'] = clientOrderId;
1256
1255
  }
1257
- const stopPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
1258
- if (stopPrice !== undefined) {
1259
- request['stop_price'] = this.priceToPrecision(symbol, stopPrice);
1256
+ const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
1257
+ if (triggerPrice !== undefined) {
1258
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1260
1259
  }
1261
1260
  const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
1262
1261
  if (timeInForce !== undefined) {
@@ -1678,7 +1678,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
1678
1678
  * @param {float} amount how much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders
1679
1679
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
1680
1680
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1681
- * @param {float} [params.stopPrice] price to trigger stop orders
1681
+ * @param {float} [params.stopPrice] alias for triggerPrice
1682
1682
  * @param {float} [params.triggerPrice] price to trigger stop orders
1683
1683
  * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
1684
1684
  * @param {bool} [params.postOnly] true or false
@@ -1691,7 +1691,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
1691
1691
  await this.loadMarkets();
1692
1692
  const market = this.market(symbol);
1693
1693
  let typeId = type.toUpperCase();
1694
- const stopPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1694
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1695
1695
  const clientOrderIdprefix = this.safeString(this.options, 'brokerId', 'nfqkvdjp');
1696
1696
  let clientOrderId = clientOrderIdprefix + '-' + this.uuid();
1697
1697
  clientOrderId = clientOrderId.slice(0, 17);
@@ -1701,14 +1701,14 @@ class coinbaseinternational extends coinbaseinternational$1 {
1701
1701
  'instrument': market['id'],
1702
1702
  'size': this.amountToPrecision(market['symbol'], amount),
1703
1703
  };
1704
- if (stopPrice !== undefined) {
1704
+ if (triggerPrice !== undefined) {
1705
1705
  if (type === 'limit') {
1706
1706
  typeId = 'STOP_LIMIT';
1707
1707
  }
1708
1708
  else {
1709
1709
  typeId = 'STOP';
1710
1710
  }
1711
- request['stop_price'] = stopPrice;
1711
+ request['stop_price'] = triggerPrice;
1712
1712
  }
1713
1713
  request['type'] = typeId;
1714
1714
  if (type === 'limit') {
@@ -1811,7 +1811,6 @@ class coinbaseinternational extends coinbaseinternational$1 {
1811
1811
  'postOnly': undefined,
1812
1812
  'side': this.safeStringLower(order, 'side'),
1813
1813
  'price': this.safeString(order, 'price'),
1814
- 'stopPrice': this.safeString(order, 'stop_price'),
1815
1814
  'triggerPrice': this.safeString(order, 'stop_price'),
1816
1815
  'amount': this.safeString(order, 'size'),
1817
1816
  'filled': this.safeString(order, 'exec_qty'),
@@ -1953,9 +1952,9 @@ class coinbaseinternational extends coinbaseinternational$1 {
1953
1952
  if (price !== undefined) {
1954
1953
  request['price'] = this.priceToPrecision(symbol, price);
1955
1954
  }
1956
- const stopPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
1957
- if (stopPrice !== undefined) {
1958
- request['stop_price'] = stopPrice;
1955
+ const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
1956
+ if (triggerPrice !== undefined) {
1957
+ request['stop_price'] = triggerPrice;
1959
1958
  }
1960
1959
  const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
1961
1960
  if (clientOrderId === undefined) {
@@ -4149,7 +4149,6 @@ class coincatch extends coincatch$1 {
4149
4149
  'amount': amount,
4150
4150
  'filled': this.safeString2(order, 'fillQuantity', 'filledQty'),
4151
4151
  'remaining': undefined,
4152
- 'stopPrice': undefined,
4153
4152
  'triggerPrice': triggerPrice,
4154
4153
  'takeProfitPrice': takeProfitPrice,
4155
4154
  'stopLossPrice': stopLossPrice,
@@ -267,7 +267,6 @@ class coincheck extends coincheck$1 {
267
267
  'status': status,
268
268
  'symbol': symbol,
269
269
  'price': price,
270
- 'stopPrice': undefined,
271
270
  'triggerPrice': undefined,
272
271
  'cost': undefined,
273
272
  'fee': undefined,