ccxt 4.3.30 → 4.3.31

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 (132) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/binance.js +14 -1
  5. package/dist/cjs/src/bitfinex2.js +100 -58
  6. package/dist/cjs/src/bitmart.js +3 -3
  7. package/dist/cjs/src/bitmex.js +1 -1
  8. package/dist/cjs/src/coinbase.js +1 -1
  9. package/dist/cjs/src/coinex.js +111 -87
  10. package/dist/cjs/src/gate.js +3 -3
  11. package/dist/cjs/src/hyperliquid.js +1 -1
  12. package/dist/cjs/src/kraken.js +2 -7
  13. package/dist/cjs/src/mexc.js +5 -5
  14. package/dist/cjs/src/poloniexfutures.js +8 -3
  15. package/dist/cjs/src/pro/bingx.js +1 -1
  16. package/js/ccxt.d.ts +1 -1
  17. package/js/ccxt.js +1 -1
  18. package/js/src/abstract/binance.d.ts +2 -0
  19. package/js/src/abstract/binancecoinm.d.ts +2 -0
  20. package/js/src/abstract/binanceus.d.ts +2 -0
  21. package/js/src/abstract/binanceusdm.d.ts +2 -0
  22. package/js/src/ace.d.ts +3 -3
  23. package/js/src/alpaca.d.ts +5 -5
  24. package/js/src/ascendex.d.ts +12 -23
  25. package/js/src/base/Exchange.d.ts +36 -36
  26. package/js/src/base/functions/type.d.ts +9 -9
  27. package/js/src/base/types.d.ts +2 -0
  28. package/js/src/bigone.d.ts +4 -4
  29. package/js/src/binance.d.ts +20 -23
  30. package/js/src/binance.js +14 -1
  31. package/js/src/bingx.d.ts +8 -19
  32. package/js/src/bit2c.d.ts +2 -2
  33. package/js/src/bitbank.d.ts +4 -4
  34. package/js/src/bitbns.d.ts +3 -3
  35. package/js/src/bitfinex.d.ts +4 -4
  36. package/js/src/bitfinex2.d.ts +8 -8
  37. package/js/src/bitfinex2.js +100 -58
  38. package/js/src/bitflyer.d.ts +4 -4
  39. package/js/src/bitget.d.ts +14 -25
  40. package/js/src/bithumb.d.ts +4 -4
  41. package/js/src/bitmart.d.ts +8 -8
  42. package/js/src/bitmart.js +3 -3
  43. package/js/src/bitmex.d.ts +10 -21
  44. package/js/src/bitmex.js +1 -1
  45. package/js/src/bitopro.d.ts +4 -4
  46. package/js/src/bitrue.d.ts +5 -16
  47. package/js/src/bitso.d.ts +8 -8
  48. package/js/src/bitstamp.d.ts +11 -13
  49. package/js/src/bitteam.d.ts +4 -4
  50. package/js/src/bitvavo.d.ts +8 -19
  51. package/js/src/bl3p.d.ts +1 -1
  52. package/js/src/blockchaincom.d.ts +4 -6
  53. package/js/src/blofin.d.ts +11 -11
  54. package/js/src/btcalpha.d.ts +4 -4
  55. package/js/src/btcbox.d.ts +3 -3
  56. package/js/src/btcmarkets.d.ts +4 -4
  57. package/js/src/btcturk.d.ts +3 -3
  58. package/js/src/bybit.d.ts +19 -33
  59. package/js/src/cex.d.ts +3 -3
  60. package/js/src/coinbase.d.ts +11 -13
  61. package/js/src/coinbase.js +1 -1
  62. package/js/src/coinbaseexchange.d.ts +6 -6
  63. package/js/src/coinbaseinternational.d.ts +10 -10
  64. package/js/src/coincheck.d.ts +3 -3
  65. package/js/src/coinex.d.ts +14 -14
  66. package/js/src/coinex.js +111 -87
  67. package/js/src/coinlist.d.ts +6 -6
  68. package/js/src/coinmate.d.ts +5 -5
  69. package/js/src/coinmetro.d.ts +5 -11
  70. package/js/src/coinone.d.ts +4 -4
  71. package/js/src/coinsph.d.ts +5 -5
  72. package/js/src/coinspot.d.ts +1 -1
  73. package/js/src/cryptocom.d.ts +10 -21
  74. package/js/src/currencycom.d.ts +6 -22
  75. package/js/src/delta.d.ts +8 -8
  76. package/js/src/deribit.d.ts +6 -6
  77. package/js/src/digifinex.d.ts +16 -16
  78. package/js/src/exmo.d.ts +6 -6
  79. package/js/src/gate.d.ts +17 -28
  80. package/js/src/gate.js +3 -3
  81. package/js/src/gemini.d.ts +4 -4
  82. package/js/src/hitbtc.d.ts +8 -8
  83. package/js/src/hollaex.d.ts +6 -17
  84. package/js/src/htx.d.ts +15 -15
  85. package/js/src/huobijp.d.ts +5 -5
  86. package/js/src/hyperliquid.d.ts +4 -4
  87. package/js/src/hyperliquid.js +1 -1
  88. package/js/src/idex.d.ts +4 -4
  89. package/js/src/independentreserve.d.ts +3 -3
  90. package/js/src/indodax.d.ts +5 -7
  91. package/js/src/kraken.d.ts +7 -7
  92. package/js/src/kraken.js +2 -7
  93. package/js/src/krakenfutures.d.ts +9 -9
  94. package/js/src/kucoin.d.ts +11 -22
  95. package/js/src/kucoinfutures.d.ts +6 -6
  96. package/js/src/kuna.d.ts +7 -7
  97. package/js/src/latoken.d.ts +5 -5
  98. package/js/src/lbank.d.ts +10 -10
  99. package/js/src/luno.d.ts +3 -3
  100. package/js/src/lykke.d.ts +4 -4
  101. package/js/src/mercado.d.ts +4 -4
  102. package/js/src/mexc.d.ts +12 -12
  103. package/js/src/mexc.js +5 -5
  104. package/js/src/ndax.d.ts +6 -6
  105. package/js/src/novadax.d.ts +4 -4
  106. package/js/src/oceanex.d.ts +4 -4
  107. package/js/src/okcoin.d.ts +6 -6
  108. package/js/src/okx.d.ts +18 -24
  109. package/js/src/onetrading.d.ts +7 -7
  110. package/js/src/p2b.d.ts +3 -3
  111. package/js/src/paymium.d.ts +3 -3
  112. package/js/src/phemex.d.ts +11 -11
  113. package/js/src/poloniex.d.ts +6 -6
  114. package/js/src/poloniexfutures.d.ts +4 -4
  115. package/js/src/poloniexfutures.js +8 -3
  116. package/js/src/pro/bingx.js +1 -1
  117. package/js/src/pro/coinbase.d.ts +2 -2
  118. package/js/src/pro/phemex.d.ts +3 -45
  119. package/js/src/probit.d.ts +5 -5
  120. package/js/src/timex.d.ts +6 -6
  121. package/js/src/tokocrypto.d.ts +4 -4
  122. package/js/src/tradeogre.d.ts +3 -3
  123. package/js/src/upbit.d.ts +5 -5
  124. package/js/src/wavesexchange.d.ts +4 -4
  125. package/js/src/wazirx.d.ts +4 -4
  126. package/js/src/whitebit.d.ts +11 -11
  127. package/js/src/woo.d.ts +8 -8
  128. package/js/src/woofipro.d.ts +10 -10
  129. package/js/src/yobit.d.ts +3 -3
  130. package/js/src/zaif.d.ts +3 -3
  131. package/js/src/zonda.d.ts +6 -6
  132. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -185,7 +185,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
185
185
 
186
186
  //-----------------------------------------------------------------------------
187
187
  // this is updated by vss.js when building
188
- const version = '4.3.30';
188
+ const version = '4.3.31';
189
189
  Exchange["default"].ccxtVersion = version;
190
190
  const exchanges = {
191
191
  'ace': ace,
@@ -842,6 +842,7 @@ class binance extends binance$1 {
842
842
  'order/asyn/id': 10,
843
843
  'trade/asyn': 1000,
844
844
  'trade/asyn/id': 10,
845
+ 'feeBurn': 1,
845
846
  },
846
847
  'post': {
847
848
  'batchOrders': 5,
@@ -856,6 +857,7 @@ class binance extends binance$1 {
856
857
  // broker endpoints
857
858
  'apiReferral/customization': 1,
858
859
  'apiReferral/userCustomization': 1,
860
+ 'feeBurn': 1,
859
861
  },
860
862
  'put': {
861
863
  'listenKey': 1,
@@ -5983,6 +5985,17 @@ class binance extends binance$1 {
5983
5985
  }
5984
5986
  }
5985
5987
  }
5988
+ else {
5989
+ postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
5990
+ if (postOnly) {
5991
+ if (!market['contract']) {
5992
+ uppercaseType = 'LIMIT_MAKER'; // only this endpoint accepts GTXhttps://binance-docs.github.io/apidocs/pm/en/#new-margin-order-trade
5993
+ }
5994
+ else {
5995
+ request['timeInForce'] = 'GTX';
5996
+ }
5997
+ }
5998
+ }
5986
5999
  // handle newOrderRespType response type
5987
6000
  if (((marketType === 'spot') || (marketType === 'margin')) && !isPortfolioMargin) {
5988
6001
  request['newOrderRespType'] = this.safeString(this.options['newOrderRespType'], type, 'FULL'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
@@ -6116,7 +6129,7 @@ class binance extends binance$1 {
6116
6129
  request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
6117
6130
  }
6118
6131
  }
6119
- if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
6132
+ if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined) && (this.safeString(request, 'timeInForce') === undefined)) {
6120
6133
  request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
6121
6134
  }
6122
6135
  if (!isPortfolioMargin && market['contract'] && postOnly) {
@@ -1260,14 +1260,15 @@ class bitfinex2 extends bitfinex2$1 {
1260
1260
  // ...
1261
1261
  // ]
1262
1262
  //
1263
- const tradeLength = trade.length;
1263
+ const tradeList = this.safeList(trade, 'result', []);
1264
+ const tradeLength = tradeList.length;
1264
1265
  const isPrivate = (tradeLength > 5);
1265
- const id = this.safeString(trade, 0);
1266
+ const id = this.safeString(tradeList, 0);
1266
1267
  const amountIndex = isPrivate ? 4 : 2;
1267
1268
  let side = undefined;
1268
- let amountString = this.safeString(trade, amountIndex);
1269
+ let amountString = this.safeString(tradeList, amountIndex);
1269
1270
  const priceIndex = isPrivate ? 5 : 3;
1270
- const priceString = this.safeString(trade, priceIndex);
1271
+ const priceString = this.safeString(tradeList, priceIndex);
1271
1272
  if (amountString[0] === '-') {
1272
1273
  side = 'sell';
1273
1274
  amountString = Precise["default"].stringAbs(amountString);
@@ -1281,22 +1282,22 @@ class bitfinex2 extends bitfinex2$1 {
1281
1282
  let fee = undefined;
1282
1283
  let symbol = this.safeSymbol(undefined, market);
1283
1284
  const timestampIndex = isPrivate ? 2 : 1;
1284
- const timestamp = this.safeInteger(trade, timestampIndex);
1285
+ const timestamp = this.safeInteger(tradeList, timestampIndex);
1285
1286
  if (isPrivate) {
1286
- const marketId = trade[1];
1287
+ const marketId = tradeList[1];
1287
1288
  symbol = this.safeSymbol(marketId);
1288
- orderId = this.safeString(trade, 3);
1289
- const maker = this.safeInteger(trade, 8);
1289
+ orderId = this.safeString(tradeList, 3);
1290
+ const maker = this.safeInteger(tradeList, 8);
1290
1291
  takerOrMaker = (maker === 1) ? 'maker' : 'taker';
1291
- let feeCostString = this.safeString(trade, 9);
1292
+ let feeCostString = this.safeString(tradeList, 9);
1292
1293
  feeCostString = Precise["default"].stringNeg(feeCostString);
1293
- const feeCurrencyId = this.safeString(trade, 10);
1294
+ const feeCurrencyId = this.safeString(tradeList, 10);
1294
1295
  const feeCurrency = this.safeCurrencyCode(feeCurrencyId);
1295
1296
  fee = {
1296
1297
  'cost': feeCostString,
1297
1298
  'currency': feeCurrency,
1298
1299
  };
1299
- const orderType = trade[6];
1300
+ const orderType = tradeList[6];
1300
1301
  type = this.safeString(this.options['exchangeTypes'], orderType);
1301
1302
  }
1302
1303
  return this.safeTrade({
@@ -1312,7 +1313,7 @@ class bitfinex2 extends bitfinex2$1 {
1312
1313
  'amount': amountString,
1313
1314
  'cost': undefined,
1314
1315
  'fee': fee,
1315
- 'info': trade,
1316
+ 'info': tradeList,
1316
1317
  }, market);
1317
1318
  }
1318
1319
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -1361,7 +1362,11 @@ class bitfinex2 extends bitfinex2$1 {
1361
1362
  // ]
1362
1363
  //
1363
1364
  const trades = this.sortBy(response, 1);
1364
- return this.parseTrades(trades, market, undefined, limit);
1365
+ const tradesList = [];
1366
+ for (let i = 0; i < trades.length; i++) {
1367
+ tradesList.push({ 'result': trades[i] }); // convert to array of dicts to match parseOrder signature
1368
+ }
1369
+ return this.parseTrades(tradesList, market, undefined, limit);
1365
1370
  }
1366
1371
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = 100, params = {}) {
1367
1372
  /**
@@ -1474,20 +1479,21 @@ class bitfinex2 extends bitfinex2$1 {
1474
1479
  return this.safeString(orderTypes, orderType, 'GTC');
1475
1480
  }
1476
1481
  parseOrder(order, market = undefined) {
1477
- const id = this.safeString(order, 0);
1478
- const marketId = this.safeString(order, 3);
1482
+ const orderList = this.safeList(order, 'result');
1483
+ const id = this.safeString(orderList, 0);
1484
+ const marketId = this.safeString(orderList, 3);
1479
1485
  const symbol = this.safeSymbol(marketId);
1480
1486
  // https://github.com/ccxt/ccxt/issues/6686
1481
- // const timestamp = this.safeTimestamp (order, 5);
1482
- const timestamp = this.safeInteger(order, 5);
1483
- const remaining = Precise["default"].stringAbs(this.safeString(order, 6));
1484
- const signedAmount = this.safeString(order, 7);
1487
+ // const timestamp = this.safeTimestamp (orderObject, 5);
1488
+ const timestamp = this.safeInteger(orderList, 5);
1489
+ const remaining = Precise["default"].stringAbs(this.safeString(orderList, 6));
1490
+ const signedAmount = this.safeString(orderList, 7);
1485
1491
  const amount = Precise["default"].stringAbs(signedAmount);
1486
1492
  const side = Precise["default"].stringLt(signedAmount, '0') ? 'sell' : 'buy';
1487
- const orderType = this.safeString(order, 8);
1493
+ const orderType = this.safeString(orderList, 8);
1488
1494
  const type = this.safeString(this.safeValue(this.options, 'exchangeTypes'), orderType);
1489
1495
  const timeInForce = this.parseTimeInForce(orderType);
1490
- const rawFlags = this.safeString(order, 12);
1496
+ const rawFlags = this.safeString(orderList, 12);
1491
1497
  const flags = this.parseOrderFlags(rawFlags);
1492
1498
  let postOnly = false;
1493
1499
  if (flags !== undefined) {
@@ -1497,25 +1503,25 @@ class bitfinex2 extends bitfinex2$1 {
1497
1503
  }
1498
1504
  }
1499
1505
  }
1500
- let price = this.safeString(order, 16);
1506
+ let price = this.safeString(orderList, 16);
1501
1507
  let stopPrice = undefined;
1502
1508
  if ((orderType === 'EXCHANGE STOP') || (orderType === 'EXCHANGE STOP LIMIT')) {
1503
1509
  price = undefined;
1504
- stopPrice = this.safeString(order, 16);
1510
+ stopPrice = this.safeString(orderList, 16);
1505
1511
  if (orderType === 'EXCHANGE STOP LIMIT') {
1506
- price = this.safeString(order, 19);
1512
+ price = this.safeString(orderList, 19);
1507
1513
  }
1508
1514
  }
1509
1515
  let status = undefined;
1510
- const statusString = this.safeString(order, 13);
1516
+ const statusString = this.safeString(orderList, 13);
1511
1517
  if (statusString !== undefined) {
1512
1518
  const parts = statusString.split(' @ ');
1513
1519
  status = this.parseOrderStatus(this.safeString(parts, 0));
1514
1520
  }
1515
- const average = this.safeString(order, 17);
1516
- const clientOrderId = this.safeString(order, 2);
1521
+ const average = this.safeString(orderList, 17);
1522
+ const clientOrderId = this.safeString(orderList, 2);
1517
1523
  return this.safeOrder({
1518
- 'info': order,
1524
+ 'info': orderList,
1519
1525
  'id': id,
1520
1526
  'clientOrderId': clientOrderId,
1521
1527
  'timestamp': timestamp,
@@ -1774,7 +1780,7 @@ class bitfinex2 extends bitfinex2$1 {
1774
1780
  for (let i = 0; i < data.length; i++) {
1775
1781
  const entry = data[i];
1776
1782
  const individualOrder = entry[4];
1777
- results.push(individualOrder[0]);
1783
+ results.push({ 'result': individualOrder[0] });
1778
1784
  }
1779
1785
  return this.parseOrders(results);
1780
1786
  }
@@ -1794,7 +1800,11 @@ class bitfinex2 extends bitfinex2$1 {
1794
1800
  };
1795
1801
  const response = await this.privatePostAuthWOrderCancelMulti(this.extend(request, params));
1796
1802
  const orders = this.safeList(response, 4, []);
1797
- return this.parseOrders(orders);
1803
+ const ordersList = [];
1804
+ for (let i = 0; i < orders.length; i++) {
1805
+ ordersList.push({ 'result': orders[i] });
1806
+ }
1807
+ return this.parseOrders(ordersList);
1798
1808
  }
1799
1809
  async cancelOrder(id, symbol = undefined, params = {}) {
1800
1810
  /**
@@ -1828,7 +1838,8 @@ class bitfinex2 extends bitfinex2$1 {
1828
1838
  }
1829
1839
  const response = await this.privatePostAuthWOrderCancel(this.extend(request, params));
1830
1840
  const order = this.safeValue(response, 4);
1831
- return this.parseOrder(order);
1841
+ const orderObject = { 'result': order };
1842
+ return this.parseOrder(orderObject);
1832
1843
  }
1833
1844
  async cancelOrders(ids, symbol = undefined, params = {}) {
1834
1845
  /**
@@ -1904,7 +1915,11 @@ class bitfinex2 extends bitfinex2$1 {
1904
1915
  // ]
1905
1916
  //
1906
1917
  const orders = this.safeList(response, 4, []);
1907
- return this.parseOrders(orders, market);
1918
+ const ordersList = [];
1919
+ for (let i = 0; i < orders.length; i++) {
1920
+ ordersList.push({ 'result': orders[i] });
1921
+ }
1922
+ return this.parseOrders(ordersList, market);
1908
1923
  }
1909
1924
  async fetchOpenOrder(id, symbol = undefined, params = {}) {
1910
1925
  /**
@@ -2013,7 +2028,11 @@ class bitfinex2 extends bitfinex2$1 {
2013
2028
  // ],
2014
2029
  // ]
2015
2030
  //
2016
- return this.parseOrders(response, market, since, limit);
2031
+ const ordersList = [];
2032
+ for (let i = 0; i < response.length; i++) {
2033
+ ordersList.push({ 'result': response[i] });
2034
+ }
2035
+ return this.parseOrders(ordersList, market, since, limit);
2017
2036
  }
2018
2037
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2019
2038
  /**
@@ -2093,7 +2112,11 @@ class bitfinex2 extends bitfinex2$1 {
2093
2112
  // ]
2094
2113
  // ]
2095
2114
  //
2096
- return this.parseOrders(response, market, since, limit);
2115
+ const ordersList = [];
2116
+ for (let i = 0; i < response.length; i++) {
2117
+ ordersList.push({ 'result': response[i] });
2118
+ }
2119
+ return this.parseOrders(ordersList, market, since, limit);
2097
2120
  }
2098
2121
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2099
2122
  /**
@@ -2120,7 +2143,11 @@ class bitfinex2 extends bitfinex2$1 {
2120
2143
  };
2121
2144
  // valid for trades upto 10 days old
2122
2145
  const response = await this.privatePostAuthROrderSymbolIdTrades(this.extend(request, params));
2123
- return this.parseTrades(response, market, since, limit);
2146
+ const tradesList = [];
2147
+ for (let i = 0; i < response.length; i++) {
2148
+ tradesList.push({ 'result': response[i] }); // convert to array of dicts to match parseOrder signature
2149
+ }
2150
+ return this.parseTrades(tradesList, market, since, limit);
2124
2151
  }
2125
2152
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2126
2153
  /**
@@ -2155,7 +2182,11 @@ class bitfinex2 extends bitfinex2$1 {
2155
2182
  else {
2156
2183
  response = await this.privatePostAuthRTradesHist(this.extend(request, params));
2157
2184
  }
2158
- return this.parseTrades(response, market, since, limit);
2185
+ const tradesList = [];
2186
+ for (let i = 0; i < response.length; i++) {
2187
+ tradesList.push({ 'result': response[i] }); // convert to array of dicts to match parseOrder signature
2188
+ }
2189
+ return this.parseTrades(tradesList, market, since, limit);
2159
2190
  }
2160
2191
  async createDepositAddress(code, params = {}) {
2161
2192
  /**
@@ -2701,7 +2732,11 @@ class bitfinex2 extends bitfinex2$1 {
2701
2732
  // ]
2702
2733
  // ]
2703
2734
  //
2704
- return this.parsePositions(response, symbols);
2735
+ const positionsList = [];
2736
+ for (let i = 0; i < response.length; i++) {
2737
+ positionsList.push({ 'result': response[i] });
2738
+ }
2739
+ return this.parsePositions(positionsList, symbols);
2705
2740
  }
2706
2741
  parsePosition(position, market = undefined) {
2707
2742
  //
@@ -2736,22 +2771,23 @@ class bitfinex2 extends bitfinex2$1 {
2736
2771
  // }
2737
2772
  // ]
2738
2773
  //
2739
- const marketId = this.safeString(position, 0);
2740
- const amount = this.safeString(position, 2);
2741
- const timestamp = this.safeInteger(position, 12);
2742
- const meta = this.safeString(position, 19);
2774
+ const positionList = this.safeList(position, 'result');
2775
+ const marketId = this.safeString(positionList, 0);
2776
+ const amount = this.safeString(positionList, 2);
2777
+ const timestamp = this.safeInteger(positionList, 12);
2778
+ const meta = this.safeString(positionList, 19);
2743
2779
  const tradePrice = this.safeString(meta, 'trade_price');
2744
2780
  const tradeAmount = this.safeString(meta, 'trade_amount');
2745
2781
  return this.safePosition({
2746
- 'info': position,
2747
- 'id': this.safeString(position, 11),
2782
+ 'info': positionList,
2783
+ 'id': this.safeString(positionList, 11),
2748
2784
  'symbol': this.safeSymbol(marketId, market),
2749
2785
  'notional': this.parseNumber(amount),
2750
2786
  'marginMode': 'isolated',
2751
- 'liquidationPrice': this.safeNumber(position, 8),
2752
- 'entryPrice': this.safeNumber(position, 3),
2753
- 'unrealizedPnl': this.safeNumber(position, 6),
2754
- 'percentage': this.safeNumber(position, 7),
2787
+ 'liquidationPrice': this.safeNumber(positionList, 8),
2788
+ 'entryPrice': this.safeNumber(positionList, 3),
2789
+ 'unrealizedPnl': this.safeNumber(positionList, 6),
2790
+ 'percentage': this.safeNumber(positionList, 7),
2755
2791
  'contracts': undefined,
2756
2792
  'contractSize': undefined,
2757
2793
  'markPrice': undefined,
@@ -2760,13 +2796,13 @@ class bitfinex2 extends bitfinex2$1 {
2760
2796
  'hedged': undefined,
2761
2797
  'timestamp': timestamp,
2762
2798
  'datetime': this.iso8601(timestamp),
2763
- 'lastUpdateTimestamp': this.safeInteger(position, 13),
2764
- 'maintenanceMargin': this.safeNumber(position, 18),
2799
+ 'lastUpdateTimestamp': this.safeInteger(positionList, 13),
2800
+ 'maintenanceMargin': this.safeNumber(positionList, 18),
2765
2801
  'maintenanceMarginPercentage': undefined,
2766
- 'collateral': this.safeNumber(position, 17),
2802
+ 'collateral': this.safeNumber(positionList, 17),
2767
2803
  'initialMargin': this.parseNumber(Precise["default"].stringMul(tradeAmount, tradePrice)),
2768
2804
  'initialMarginPercentage': undefined,
2769
- 'leverage': this.safeNumber(position, 9),
2805
+ 'leverage': this.safeNumber(positionList, 9),
2770
2806
  'marginRatio': undefined,
2771
2807
  'stopLossPrice': undefined,
2772
2808
  'takeProfitPrice': undefined,
@@ -2876,14 +2912,15 @@ class bitfinex2 extends bitfinex2$1 {
2876
2912
  // ]
2877
2913
  // ]
2878
2914
  //
2915
+ const itemList = this.safeList(item, 'result', []);
2879
2916
  let type = undefined;
2880
- const id = this.safeString(item, 0);
2881
- const currencyId = this.safeString(item, 1);
2917
+ const id = this.safeString(itemList, 0);
2918
+ const currencyId = this.safeString(itemList, 1);
2882
2919
  const code = this.safeCurrencyCode(currencyId, currency);
2883
- const timestamp = this.safeInteger(item, 3);
2884
- const amount = this.safeNumber(item, 5);
2885
- const after = this.safeNumber(item, 6);
2886
- const description = this.safeString(item, 8);
2920
+ const timestamp = this.safeInteger(itemList, 3);
2921
+ const amount = this.safeNumber(itemList, 5);
2922
+ const after = this.safeNumber(itemList, 6);
2923
+ const description = this.safeString(itemList, 8);
2887
2924
  if (description !== undefined) {
2888
2925
  const parts = description.split(' @ ');
2889
2926
  const first = this.safeStringLower(parts, 0);
@@ -2960,7 +2997,12 @@ class bitfinex2 extends bitfinex2$1 {
2960
2997
  // ]
2961
2998
  // ]
2962
2999
  //
2963
- return this.parseLedger(response, currency, since, limit);
3000
+ const ledgerObjects = [];
3001
+ for (let i = 0; i < response.length; i++) {
3002
+ const item = response[i];
3003
+ ledgerObjects.push({ 'result': item });
3004
+ }
3005
+ return this.parseLedger(ledgerObjects, currency, since, limit);
2964
3006
  }
2965
3007
  async fetchFundingRate(symbol, params = {}) {
2966
3008
  /**
@@ -2727,7 +2727,7 @@ class bitmart extends bitmart$1 {
2727
2727
  }
2728
2728
  const data = this.safeValue(response, 'data');
2729
2729
  if (data === true) {
2730
- return this.parseOrder(id, market);
2730
+ return this.safeOrder({ 'id': id }, market);
2731
2731
  }
2732
2732
  const succeeded = this.safeValue(data, 'succeed');
2733
2733
  if (succeeded !== undefined) {
@@ -2742,8 +2742,8 @@ class bitmart extends bitmart$1 {
2742
2742
  throw new errors.InvalidOrder(this.id + ' cancelOrder() ' + symbol + ' order id ' + id + ' is filled or canceled');
2743
2743
  }
2744
2744
  }
2745
- const order = this.parseOrder(id, market);
2746
- return this.extend(order, { 'id': id });
2745
+ const order = this.safeOrder({ 'id': id, 'symbol': market['symbol'], 'info': {} }, market);
2746
+ return order;
2747
2747
  }
2748
2748
  async cancelOrders(ids, symbol = undefined, params = {}) {
2749
2749
  /**
@@ -1489,7 +1489,7 @@ class bitmex extends bitmex$1 {
1489
1489
  }
1490
1490
  // send JSON key/value pairs, such as {"key": "value"}
1491
1491
  // filter by individual fields and do advanced queries on timestamps
1492
- // let filter = { 'key': 'value' };
1492
+ // let filter: Dict = { 'key': 'value' };
1493
1493
  // send a bare series (e.g. XBU) to nearest expiring contract in that series
1494
1494
  // you can also send a timeframe, e.g. XBU:monthly
1495
1495
  // timeframes: daily, weekly, monthly, quarterly, and biquarterly
@@ -4569,7 +4569,7 @@ class coinbase extends coinbase$1 {
4569
4569
  // uri = uri.slice (0, quesPos);
4570
4570
  // }
4571
4571
  // const nonce = this.randomBytes (16);
4572
- // const request = {
4572
+ // const request: Dict = {
4573
4573
  // 'aud': [ 'retail_rest_api_proxy' ],
4574
4574
  // 'iss': 'coinbase-cloud',
4575
4575
  // 'nbf': seconds,
@@ -68,8 +68,8 @@ class coinex extends coinex$1 {
68
68
  'fetchDepositAddressByNetwork': false,
69
69
  'fetchDepositAddresses': false,
70
70
  'fetchDeposits': true,
71
- 'fetchDepositWithdrawFee': 'emulated',
72
- 'fetchDepositWithdrawFees': true,
71
+ 'fetchDepositWithdrawFee': true,
72
+ 'fetchDepositWithdrawFees': false,
73
73
  'fetchFundingHistory': true,
74
74
  'fetchFundingRate': true,
75
75
  'fetchFundingRateHistory': true,
@@ -5403,101 +5403,125 @@ class coinex extends coinex$1 {
5403
5403
  'info': info,
5404
5404
  };
5405
5405
  }
5406
- async fetchDepositWithdrawFees(codes = undefined, params = {}) {
5406
+ async fetchDepositWithdrawFee(code, params = {}) {
5407
5407
  /**
5408
5408
  * @method
5409
- * @name coinex#fetchDepositWithdrawFees
5410
- * @description fetch deposit and withdraw fees
5411
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market010_asset_config
5412
- * @param {string[]|undefined} codes list of unified currency codes
5409
+ * @name coinex#fetchDepositWithdrawFee
5410
+ * @description fetch the fee for deposits and withdrawals
5411
+ * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-withdrawal-config
5412
+ * @param {string} code unified currency code
5413
5413
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5414
- * @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
5414
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
5415
5415
  */
5416
5416
  await this.loadMarkets();
5417
- const request = {};
5418
- if (codes !== undefined) {
5419
- const codesLength = codes.length;
5420
- if (codesLength === 1) {
5421
- request['coin_type'] = this.safeValue(codes, 0);
5422
- }
5423
- }
5424
- const response = await this.v1PublicGetCommonAssetConfig(this.extend(request, params));
5425
- //
5426
- // {
5427
- // "code": 0,
5428
- // "data": {
5429
- // "CET-CSC": {
5430
- // "asset": "CET",
5431
- // "chain": "CSC",
5432
- // "can_deposit": true,
5433
- // "can_withdraw ": false,
5434
- // "deposit_least_amount": "1",
5435
- // "withdraw_least_amount": "1",
5436
- // "withdraw_tx_fee": "0.1"
5437
- // },
5438
- // "CET-ERC20": {
5439
- // "asset": "CET",
5440
- // "chain": "ERC20",
5441
- // "can_deposit": true,
5442
- // "can_withdraw": false,
5443
- // "deposit_least_amount": "14",
5444
- // "withdraw_least_amount": "14",
5445
- // "withdraw_tx_fee": "14"
5446
- // }
5447
- // },
5448
- // "message": "Success"
5449
- // }
5450
- //
5451
- return this.parseDepositWithdrawFees(response, codes);
5417
+ const currency = this.currency(code);
5418
+ const request = {
5419
+ 'ccy': currency['id'],
5420
+ };
5421
+ const response = await this.v2PrivateGetAssetsDepositWithdrawConfig(this.extend(request, params));
5422
+ //
5423
+ // {
5424
+ // "code": 0,
5425
+ // "data": {
5426
+ // "asset": {
5427
+ // "ccy": "USDT",
5428
+ // "deposit_enabled": true,
5429
+ // "withdraw_enabled": true,
5430
+ // "inter_transfer_enabled": true,
5431
+ // "is_st": false
5432
+ // },
5433
+ // "chains": [
5434
+ // {
5435
+ // "chain": "TRC20",
5436
+ // "min_deposit_amount": "2.4",
5437
+ // "min_withdraw_amount": "2.4",
5438
+ // "deposit_enabled": true,
5439
+ // "withdraw_enabled": true,
5440
+ // "deposit_delay_minutes": 0,
5441
+ // "safe_confirmations": 10,
5442
+ // "irreversible_confirmations": 20,
5443
+ // "deflation_rate": "0",
5444
+ // "withdrawal_fee": "2.4",
5445
+ // "withdrawal_precision": 6,
5446
+ // "memo": "",
5447
+ // "is_memo_required_for_deposit": false,
5448
+ // "explorer_asset_url": "https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
5449
+ // },
5450
+ // ]
5451
+ // },
5452
+ // "message": "OK"
5453
+ // }
5454
+ //
5455
+ const data = this.safeDict(response, 'data', {});
5456
+ return this.parseDepositWithdrawFee(data, currency);
5452
5457
  }
5453
- parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
5454
- const depositWithdrawFees = {};
5455
- codes = this.marketCodes(codes);
5456
- const data = this.safeValue(response, 'data');
5457
- const currencyIds = Object.keys(data);
5458
- for (let i = 0; i < currencyIds.length; i++) {
5459
- const entry = currencyIds[i];
5460
- const splitEntry = entry.split('-');
5461
- const feeInfo = data[currencyIds[i]];
5462
- const currencyId = this.safeString(feeInfo, 'asset');
5463
- const currency = this.safeCurrency(currencyId);
5464
- const code = this.safeString(currency, 'code');
5465
- if ((codes === undefined) || (this.inArray(code, codes))) {
5466
- const depositWithdrawFee = this.safeValue(depositWithdrawFees, code);
5467
- if (depositWithdrawFee === undefined) {
5468
- depositWithdrawFees[code] = this.depositWithdrawFee({});
5469
- }
5470
- depositWithdrawFees[code]['info'][entry] = feeInfo;
5471
- const networkId = this.safeString(splitEntry, 1);
5472
- const withdrawFee = this.safeValue(feeInfo, 'withdraw_tx_fee');
5473
- const withdrawResult = {
5474
- 'fee': withdrawFee,
5475
- 'percentage': (withdrawFee !== undefined) ? false : undefined,
5476
- };
5477
- const depositResult = {
5478
- 'fee': undefined,
5479
- 'percentage': undefined,
5480
- };
5481
- if (networkId !== undefined) {
5482
- const networkCode = this.networkIdToCode(networkId);
5483
- depositWithdrawFees[code]['networks'][networkCode] = {
5484
- 'withdraw': withdrawResult,
5485
- 'deposit': depositResult,
5458
+ parseDepositWithdrawFee(fee, currency = undefined) {
5459
+ //
5460
+ // {
5461
+ // "asset": {
5462
+ // "ccy": "USDT",
5463
+ // "deposit_enabled": true,
5464
+ // "withdraw_enabled": true,
5465
+ // "inter_transfer_enabled": true,
5466
+ // "is_st": false
5467
+ // },
5468
+ // "chains": [
5469
+ // {
5470
+ // "chain": "TRC20",
5471
+ // "min_deposit_amount": "2.4",
5472
+ // "min_withdraw_amount": "2.4",
5473
+ // "deposit_enabled": true,
5474
+ // "withdraw_enabled": true,
5475
+ // "deposit_delay_minutes": 0,
5476
+ // "safe_confirmations": 10,
5477
+ // "irreversible_confirmations": 20,
5478
+ // "deflation_rate": "0",
5479
+ // "withdrawal_fee": "2.4",
5480
+ // "withdrawal_precision": 6,
5481
+ // "memo": "",
5482
+ // "is_memo_required_for_deposit": false,
5483
+ // "explorer_asset_url": "https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
5484
+ // },
5485
+ // ]
5486
+ // }
5487
+ //
5488
+ const result = {
5489
+ 'info': fee,
5490
+ 'withdraw': {
5491
+ 'fee': undefined,
5492
+ 'percentage': undefined,
5493
+ },
5494
+ 'deposit': {
5495
+ 'fee': undefined,
5496
+ 'percentage': undefined,
5497
+ },
5498
+ 'networks': {},
5499
+ };
5500
+ const chains = this.safeList(fee, 'chains', []);
5501
+ const asset = this.safeDict(fee, 'asset', {});
5502
+ for (let i = 0; i < chains.length; i++) {
5503
+ const entry = chains[i];
5504
+ const isWithdrawEnabled = this.safeBool(entry, 'withdraw_enabled');
5505
+ if (isWithdrawEnabled) {
5506
+ result['withdraw']['fee'] = this.safeNumber(entry, 'withdrawal_fee');
5507
+ result['withdraw']['percentage'] = false;
5508
+ const networkId = this.safeString(entry, 'chain');
5509
+ if (networkId) {
5510
+ const networkCode = this.networkIdToCode(networkId, this.safeString(asset, 'ccy'));
5511
+ result['networks'][networkCode] = {
5512
+ 'withdraw': {
5513
+ 'fee': this.safeNumber(entry, 'withdrawal_fee'),
5514
+ 'percentage': false,
5515
+ },
5516
+ 'deposit': {
5517
+ 'fee': undefined,
5518
+ 'percentage': undefined,
5519
+ },
5486
5520
  };
5487
5521
  }
5488
- else {
5489
- depositWithdrawFees[code]['withdraw'] = withdrawResult;
5490
- depositWithdrawFees[code]['deposit'] = depositResult;
5491
- }
5492
5522
  }
5493
5523
  }
5494
- const depositWithdrawCodes = Object.keys(depositWithdrawFees);
5495
- for (let i = 0; i < depositWithdrawCodes.length; i++) {
5496
- const code = depositWithdrawCodes[i];
5497
- const currency = this.currency(code);
5498
- depositWithdrawFees[code] = this.assignDefaultDepositWithdrawFees(depositWithdrawFees[code], currency);
5499
- }
5500
- return depositWithdrawFees;
5524
+ return result;
5501
5525
  }
5502
5526
  async fetchLeverages(symbols = undefined, params = {}) {
5503
5527
  /**