ccxt 4.4.41 → 4.4.43

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 (188) hide show
  1. package/README.md +36 -34
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -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 +35 -12
  11. package/dist/cjs/src/bitfinex.js +123 -0
  12. package/dist/cjs/src/bitstamp.js +54 -0
  13. package/dist/cjs/src/blofin.js +16 -7
  14. package/dist/cjs/src/cex.js +1 -1
  15. package/dist/cjs/src/coinbase.js +8 -9
  16. package/dist/cjs/src/coinbaseexchange.js +5 -6
  17. package/dist/cjs/src/coinbaseinternational.js +7 -8
  18. package/dist/cjs/src/coincatch.js +0 -1
  19. package/dist/cjs/src/coincheck.js +0 -1
  20. package/dist/cjs/src/coinex.js +91 -6
  21. package/dist/cjs/src/coinlist.js +3 -4
  22. package/dist/cjs/src/coinmate.js +1 -3
  23. package/dist/cjs/src/coinmetro.js +4 -5
  24. package/dist/cjs/src/coinone.js +0 -1
  25. package/dist/cjs/src/coinsph.js +7 -8
  26. package/dist/cjs/src/cryptocom.js +3 -0
  27. package/dist/cjs/src/currencycom.js +3 -4
  28. package/dist/cjs/src/defx.js +6 -7
  29. package/dist/cjs/src/deribit.js +1 -3
  30. package/dist/cjs/src/digifinex.js +0 -1
  31. package/dist/cjs/src/ellipx.js +0 -2
  32. package/dist/cjs/src/exmo.js +1 -2
  33. package/dist/cjs/src/gate.js +1 -2
  34. package/dist/cjs/src/gemini.js +63 -6
  35. package/dist/cjs/src/hashkey.js +79 -83
  36. package/dist/cjs/src/hitbtc.js +49 -5
  37. package/dist/cjs/src/hollaex.js +4 -6
  38. package/dist/cjs/src/htx.js +1 -3
  39. package/dist/cjs/src/huobijp.js +0 -1
  40. package/dist/cjs/src/hyperliquid.js +1 -1
  41. package/dist/cjs/src/idex.js +8 -8
  42. package/dist/cjs/src/independentreserve.js +0 -1
  43. package/dist/cjs/src/indodax.js +0 -1
  44. package/dist/cjs/src/kraken.js +63 -3
  45. package/dist/cjs/src/krakenfutures.js +75 -3
  46. package/dist/cjs/src/kucoin.js +1 -3
  47. package/dist/cjs/src/kucoinfutures.js +10 -9
  48. package/dist/cjs/src/kuna.js +1 -3
  49. package/dist/cjs/src/latoken.js +1 -3
  50. package/dist/cjs/src/lbank.js +0 -1
  51. package/dist/cjs/src/luno.js +0 -1
  52. package/dist/cjs/src/lykke.js +0 -1
  53. package/dist/cjs/src/mercado.js +0 -1
  54. package/dist/cjs/src/mexc.js +3 -4
  55. package/dist/cjs/src/myokx.js +35 -0
  56. package/dist/cjs/src/ndax.js +1 -1
  57. package/dist/cjs/src/novadax.js +4 -6
  58. package/dist/cjs/src/oceanex.js +0 -1
  59. package/dist/cjs/src/okcoin.js +1 -3
  60. package/dist/cjs/src/okx.js +1 -3
  61. package/dist/cjs/src/onetrading.js +1 -3
  62. package/dist/cjs/src/p2b.js +1 -1
  63. package/dist/cjs/src/paradex.js +5 -7
  64. package/dist/cjs/src/phemex.js +15 -15
  65. package/dist/cjs/src/poloniex.js +1 -3
  66. package/dist/cjs/src/poloniexfutures.js +6 -6
  67. package/dist/cjs/src/pro/myokx.js +24 -0
  68. package/dist/cjs/src/probit.js +0 -1
  69. package/dist/cjs/src/timex.js +0 -1
  70. package/dist/cjs/src/tokocrypto.js +11 -14
  71. package/dist/cjs/src/tradeogre.js +1 -1
  72. package/dist/cjs/src/upbit.js +0 -1
  73. package/dist/cjs/src/vertex.js +69 -4
  74. package/dist/cjs/src/wavesexchange.js +4 -5
  75. package/dist/cjs/src/whitebit.js +8 -9
  76. package/dist/cjs/src/woo.js +101 -15
  77. package/dist/cjs/src/woofipro.js +96 -15
  78. package/dist/cjs/src/xt.js +3 -2
  79. package/dist/cjs/src/yobit.js +0 -1
  80. package/dist/cjs/src/zaif.js +0 -1
  81. package/dist/cjs/src/zonda.js +1 -2
  82. package/js/ccxt.d.ts +8 -2
  83. package/js/ccxt.js +6 -2
  84. package/js/src/abstract/binance.d.ts +3 -0
  85. package/js/src/abstract/binancecoinm.d.ts +3 -0
  86. package/js/src/abstract/binanceus.d.ts +3 -0
  87. package/js/src/abstract/binanceusdm.d.ts +3 -0
  88. package/js/src/abstract/bingx.d.ts +4 -0
  89. package/js/src/abstract/bitstamp.d.ts +1 -0
  90. package/js/src/abstract/myokx.d.ts +343 -0
  91. package/js/src/abstract/myokx.js +11 -0
  92. package/js/src/ace.js +1 -1
  93. package/js/src/alpaca.js +0 -1
  94. package/js/src/ascendex.js +0 -1
  95. package/js/src/base/Exchange.d.ts +6 -6
  96. package/js/src/base/Exchange.js +21 -16
  97. package/js/src/bigone.js +0 -1
  98. package/js/src/binance.js +3 -0
  99. package/js/src/bingx.js +35 -12
  100. package/js/src/bitfinex.d.ts +11 -1
  101. package/js/src/bitfinex.js +123 -0
  102. package/js/src/bitstamp.js +54 -0
  103. package/js/src/blofin.d.ts +1 -1
  104. package/js/src/blofin.js +16 -7
  105. package/js/src/cex.js +1 -1
  106. package/js/src/coinbase.js +8 -9
  107. package/js/src/coinbaseexchange.js +5 -6
  108. package/js/src/coinbaseinternational.d.ts +1 -1
  109. package/js/src/coinbaseinternational.js +7 -8
  110. package/js/src/coincatch.js +0 -1
  111. package/js/src/coincheck.js +0 -1
  112. package/js/src/coinex.js +91 -6
  113. package/js/src/coinlist.js +3 -4
  114. package/js/src/coinmate.js +1 -3
  115. package/js/src/coinmetro.js +4 -5
  116. package/js/src/coinone.js +0 -1
  117. package/js/src/coinsph.js +7 -8
  118. package/js/src/cryptocom.js +3 -0
  119. package/js/src/currencycom.js +3 -4
  120. package/js/src/defx.js +6 -7
  121. package/js/src/deribit.js +1 -3
  122. package/js/src/digifinex.js +0 -1
  123. package/js/src/ellipx.js +0 -2
  124. package/js/src/exmo.d.ts +1 -1
  125. package/js/src/exmo.js +1 -2
  126. package/js/src/gate.d.ts +1 -1
  127. package/js/src/gate.js +1 -2
  128. package/js/src/gemini.js +63 -6
  129. package/js/src/hashkey.js +79 -83
  130. package/js/src/hitbtc.d.ts +11 -1
  131. package/js/src/hitbtc.js +49 -5
  132. package/js/src/hollaex.js +4 -6
  133. package/js/src/htx.js +1 -3
  134. package/js/src/huobijp.js +0 -1
  135. package/js/src/hyperliquid.js +1 -1
  136. package/js/src/idex.js +8 -8
  137. package/js/src/independentreserve.js +0 -1
  138. package/js/src/indodax.js +0 -1
  139. package/js/src/kraken.d.ts +2 -2
  140. package/js/src/kraken.js +63 -3
  141. package/js/src/krakenfutures.d.ts +2 -2
  142. package/js/src/krakenfutures.js +75 -3
  143. package/js/src/kucoin.js +1 -3
  144. package/js/src/kucoinfutures.d.ts +5 -4
  145. package/js/src/kucoinfutures.js +10 -9
  146. package/js/src/kuna.js +1 -3
  147. package/js/src/latoken.js +1 -3
  148. package/js/src/lbank.js +0 -1
  149. package/js/src/luno.js +0 -1
  150. package/js/src/lykke.js +0 -1
  151. package/js/src/mercado.js +0 -1
  152. package/js/src/mexc.js +3 -4
  153. package/js/src/myokx.d.ts +4 -0
  154. package/js/src/myokx.js +36 -0
  155. package/js/src/ndax.js +1 -1
  156. package/js/src/novadax.js +4 -6
  157. package/js/src/oceanex.js +0 -1
  158. package/js/src/okcoin.js +1 -3
  159. package/js/src/okx.js +1 -3
  160. package/js/src/onetrading.js +1 -3
  161. package/js/src/p2b.js +1 -1
  162. package/js/src/paradex.d.ts +1 -1
  163. package/js/src/paradex.js +5 -7
  164. package/js/src/phemex.d.ts +1 -0
  165. package/js/src/phemex.js +15 -15
  166. package/js/src/poloniex.js +1 -3
  167. package/js/src/poloniexfutures.js +6 -6
  168. package/js/src/pro/myokx.d.ts +4 -0
  169. package/js/src/pro/myokx.js +25 -0
  170. package/js/src/probit.js +0 -1
  171. package/js/src/timex.js +0 -1
  172. package/js/src/tokocrypto.js +11 -14
  173. package/js/src/tradeogre.js +1 -1
  174. package/js/src/upbit.js +0 -1
  175. package/js/src/vertex.d.ts +11 -1
  176. package/js/src/vertex.js +69 -4
  177. package/js/src/wavesexchange.d.ts +1 -1
  178. package/js/src/wavesexchange.js +4 -5
  179. package/js/src/whitebit.js +8 -9
  180. package/js/src/woo.d.ts +1 -1
  181. package/js/src/woo.js +101 -15
  182. package/js/src/woofipro.js +96 -15
  183. package/js/src/xt.d.ts +2 -1
  184. package/js/src/xt.js +3 -2
  185. package/js/src/yobit.js +0 -1
  186. package/js/src/zaif.js +0 -1
  187. package/js/src/zonda.js +1 -2
  188. package/package.json +15 -8
package/dist/cjs/ccxt.js CHANGED
@@ -95,6 +95,7 @@ var luno = require('./src/luno.js');
95
95
  var lykke = require('./src/lykke.js');
96
96
  var mercado = require('./src/mercado.js');
97
97
  var mexc = require('./src/mexc.js');
98
+ var myokx = require('./src/myokx.js');
98
99
  var ndax = require('./src/ndax.js');
99
100
  var novadax = require('./src/novadax.js');
100
101
  var oceanex = require('./src/oceanex.js');
@@ -179,6 +180,7 @@ var kucoinfutures$1 = require('./src/pro/kucoinfutures.js');
179
180
  var lbank$1 = require('./src/pro/lbank.js');
180
181
  var luno$1 = require('./src/pro/luno.js');
181
182
  var mexc$1 = require('./src/pro/mexc.js');
183
+ var myokx$1 = require('./src/pro/myokx.js');
182
184
  var ndax$1 = require('./src/pro/ndax.js');
183
185
  var okcoin$1 = require('./src/pro/okcoin.js');
184
186
  var okx$1 = require('./src/pro/okx.js');
@@ -200,7 +202,7 @@ var xt$1 = require('./src/pro/xt.js');
200
202
 
201
203
  //-----------------------------------------------------------------------------
202
204
  // this is updated by vss.js when building
203
- const version = '4.4.41';
205
+ const version = '4.4.43';
204
206
  Exchange["default"].ccxtVersion = version;
205
207
  const exchanges = {
206
208
  'ace': ace,
@@ -286,6 +288,7 @@ const exchanges = {
286
288
  'lykke': lykke,
287
289
  'mercado': mercado,
288
290
  'mexc': mexc,
291
+ 'myokx': myokx,
289
292
  'ndax': ndax,
290
293
  'novadax': novadax,
291
294
  'oceanex': oceanex,
@@ -372,6 +375,7 @@ const pro = {
372
375
  'lbank': lbank$1,
373
376
  'luno': luno$1,
374
377
  'mexc': mexc$1,
378
+ 'myokx': myokx$1,
375
379
  'ndax': ndax$1,
376
380
  'okcoin': okcoin$1,
377
381
  'okx': okx$1,
@@ -524,6 +528,7 @@ exports.luno = luno;
524
528
  exports.lykke = lykke;
525
529
  exports.mercado = mercado;
526
530
  exports.mexc = mexc;
531
+ exports.myokx = myokx;
527
532
  exports.ndax = ndax;
528
533
  exports.novadax = novadax;
529
534
  exports.oceanex = oceanex;
@@ -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,
@@ -384,12 +384,26 @@ class bingx extends bingx$1 {
384
384
  'get': {
385
385
  'uid': 1,
386
386
  'apiKey/query': 2,
387
+ 'account/apiPermissions': 5,
387
388
  },
388
389
  'post': {
389
390
  'innerTransfer/authorizeSubAccount': 1,
390
391
  },
391
392
  },
392
393
  },
394
+ 'transfer': {
395
+ 'v1': {
396
+ 'private': {
397
+ 'get': {
398
+ 'subAccount/asset/transferHistory': 1,
399
+ },
400
+ 'post': {
401
+ 'subAccount/transferAsset/supportCoins': 1,
402
+ 'subAccount/transferAsset': 1,
403
+ },
404
+ },
405
+ },
406
+ },
393
407
  },
394
408
  'user': {
395
409
  'auth': {
@@ -5598,6 +5612,9 @@ class bingx extends bingx$1 {
5598
5612
  request['endTs'] = now;
5599
5613
  }
5600
5614
  if (market['spot']) {
5615
+ if (limit !== undefined) {
5616
+ request['limit'] = limit; // default 500, maximum 1000
5617
+ }
5601
5618
  response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
5602
5619
  const data = this.safeDict(response, 'data', {});
5603
5620
  fills = this.safeList(data, 'fills', []);
@@ -6426,23 +6443,29 @@ class bingx extends bingx$1 {
6426
6443
  };
6427
6444
  }
6428
6445
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
6429
- const type = section[0];
6430
- const version = section[1];
6431
- const access = section[2];
6446
+ let type = section[0];
6447
+ let version = section[1];
6448
+ let access = section[2];
6432
6449
  const isSandbox = this.safeBool(this.options, 'sandboxMode', false);
6433
6450
  if (isSandbox && (type !== 'swap')) {
6434
6451
  throw new errors.NotSupported(this.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints');
6435
6452
  }
6436
6453
  let url = this.implodeHostname(this.urls['api'][type]);
6437
- if (type === 'spot' && version === 'v3') {
6438
- url += '/api';
6439
- }
6440
- else {
6441
- url += '/' + type;
6442
- }
6443
- url += '/' + version + '/';
6444
6454
  path = this.implodeParams(path, params);
6445
- url += path;
6455
+ if (version === 'transfer') {
6456
+ type = 'account/transfer';
6457
+ version = section[2];
6458
+ access = section[3];
6459
+ }
6460
+ if (path !== 'account/apiPermissions') {
6461
+ if (type === 'spot' && version === 'v3') {
6462
+ url += '/api';
6463
+ }
6464
+ else {
6465
+ url += '/' + type;
6466
+ }
6467
+ }
6468
+ url += '/' + version + '/' + path;
6446
6469
  params = this.omit(params, this.extractParams(path));
6447
6470
  params['timestamp'] = this.nonce();
6448
6471
  params = this.keysort(params);
@@ -6453,7 +6476,7 @@ class bingx extends bingx$1 {
6453
6476
  }
6454
6477
  else if (access === 'private') {
6455
6478
  this.checkRequiredCredentials();
6456
- const isJsonContentType = ((type === 'subAccount') && (method === 'POST'));
6479
+ const isJsonContentType = (((type === 'subAccount') || (type === 'account/transfer')) && (method === 'POST'));
6457
6480
  const parsedParams = this.parseParams(params);
6458
6481
  const signature = this.hmac(this.encode(this.rawencode(parsedParams)), this.encode(this.secret), sha256.sha256);
6459
6482
  headers = {
@@ -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
@@ -152,6 +152,7 @@ class bitstamp extends bitstamp$1 {
152
152
  'user_transactions/': 1,
153
153
  'user_transactions/{pair}/': 1,
154
154
  'crypto-transactions/': 1,
155
+ 'open_order': 1,
155
156
  'open_orders/all/': 1,
156
157
  'open_orders/{pair}/': 1,
157
158
  'order_status/': 1,
@@ -492,6 +493,59 @@ class bitstamp extends bitstamp$1 {
492
493
  'Ensure that there are no more than': errors.InvalidOrder, // {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
493
494
  },
494
495
  },
496
+ 'features': {
497
+ 'spot': {
498
+ 'sandbox': false,
499
+ 'createOrder': {
500
+ 'marginMode': false,
501
+ 'triggerPrice': false,
502
+ 'triggerPriceType': undefined,
503
+ 'triggerDirection': false,
504
+ 'stopLossPrice': false,
505
+ 'takeProfitPrice': false,
506
+ 'attachedStopLossTakeProfit': undefined,
507
+ 'timeInForce': {
508
+ 'IOC': true,
509
+ 'FOK': true,
510
+ 'PO': true,
511
+ 'GTD': true,
512
+ },
513
+ 'hedged': false,
514
+ 'trailing': false,
515
+ },
516
+ 'createOrders': undefined,
517
+ 'fetchMyTrades': {
518
+ 'marginMode': false,
519
+ 'limit': 1000,
520
+ 'daysBack': undefined,
521
+ 'untilDays': 30,
522
+ },
523
+ 'fetchOrder': {
524
+ 'marginMode': false,
525
+ 'trigger': false,
526
+ 'trailing': false,
527
+ },
528
+ 'fetchOpenOrders': {
529
+ 'marginMode': false,
530
+ 'limit': undefined,
531
+ 'trigger': false,
532
+ 'trailing': false,
533
+ },
534
+ 'fetchOrders': undefined,
535
+ 'fetchClosedOrders': undefined,
536
+ 'fetchOHLCV': {
537
+ 'limit': 1000,
538
+ },
539
+ },
540
+ 'swap': {
541
+ 'linear': undefined,
542
+ 'inverse': undefined,
543
+ },
544
+ 'future': {
545
+ 'linear': undefined,
546
+ 'inverse': undefined,
547
+ },
548
+ },
495
549
  });
496
550
  }
497
551
  /**
@@ -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'),