ccxt 4.5.55 → 4.5.56

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 (177) hide show
  1. package/README.md +209 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/aftermath.js +10 -5
  5. package/dist/cjs/src/alpaca.js +2 -2
  6. package/dist/cjs/src/apex.js +25 -16
  7. package/dist/cjs/src/arkham.js +7 -4
  8. package/dist/cjs/src/ascendex.js +6 -3
  9. package/dist/cjs/src/base/Exchange.js +3 -3
  10. package/dist/cjs/src/bigone.js +7 -4
  11. package/dist/cjs/src/binance.js +4 -4
  12. package/dist/cjs/src/bingx.js +4 -4
  13. package/dist/cjs/src/bitflyer.js +2 -1
  14. package/dist/cjs/src/bitget.js +14 -3
  15. package/dist/cjs/src/bitmart.js +5 -4
  16. package/dist/cjs/src/bitmex.js +7 -4
  17. package/dist/cjs/src/bitopro.js +1 -1
  18. package/dist/cjs/src/bitrue.js +2 -1
  19. package/dist/cjs/src/bitso.js +6 -3
  20. package/dist/cjs/src/bitstamp.js +5 -3
  21. package/dist/cjs/src/bittrade.js +2 -1
  22. package/dist/cjs/src/blofin.js +2 -1
  23. package/dist/cjs/src/bybit.js +19 -17
  24. package/dist/cjs/src/bybiteu.js +1 -0
  25. package/dist/cjs/src/coinbaseexchange.js +2 -1
  26. package/dist/cjs/src/coinbaseinternational.js +15 -9
  27. package/dist/cjs/src/coinex.js +5 -3
  28. package/dist/cjs/src/coinsph.js +4 -4
  29. package/dist/cjs/src/cryptocom.js +6 -6
  30. package/dist/cjs/src/deepcoin.js +6 -3
  31. package/dist/cjs/src/delta.js +2 -1
  32. package/dist/cjs/src/deribit.js +4 -2
  33. package/dist/cjs/src/derive.js +5 -3
  34. package/dist/cjs/src/digifinex.js +2 -1
  35. package/dist/cjs/src/exmo.js +12 -39
  36. package/dist/cjs/src/foxbit.js +1 -1
  37. package/dist/cjs/src/gemini.js +4 -2
  38. package/dist/cjs/src/grvt.js +13 -7
  39. package/dist/cjs/src/hashkey.js +4 -4
  40. package/dist/cjs/src/hibachi.js +1 -1
  41. package/dist/cjs/src/hitbtc.js +2 -1
  42. package/dist/cjs/src/htx.js +9 -5
  43. package/dist/cjs/src/hyperliquid.js +19 -13
  44. package/dist/cjs/src/indodax.js +2 -1
  45. package/dist/cjs/src/kraken.js +14 -13
  46. package/dist/cjs/src/krakenfutures.js +2 -1
  47. package/dist/cjs/src/lbank.js +8 -4
  48. package/dist/cjs/src/lighter.js +1 -1
  49. package/dist/cjs/src/luno.js +1 -1
  50. package/dist/cjs/src/mercado.js +2 -1
  51. package/dist/cjs/src/mexc.js +24 -14
  52. package/dist/cjs/src/modetrade.js +1 -1
  53. package/dist/cjs/src/okx.js +6 -3
  54. package/dist/cjs/src/oxfun.js +5 -3
  55. package/dist/cjs/src/p2b.js +8 -4
  56. package/dist/cjs/src/paradex.js +3 -2
  57. package/dist/cjs/src/phemex.js +4 -2
  58. package/dist/cjs/src/poloniex.js +2 -1
  59. package/dist/cjs/src/pro/apex.js +10 -1
  60. package/dist/cjs/src/pro/aster.js +10 -9
  61. package/dist/cjs/src/pro/binance.js +3 -3
  62. package/dist/cjs/src/pro/bingx.js +7 -2
  63. package/dist/cjs/src/pro/bitmart.js +10 -0
  64. package/dist/cjs/src/pro/bitmex.js +1 -1
  65. package/dist/cjs/src/pro/grvt.js +8 -0
  66. package/dist/cjs/src/pro/htx.js +4 -4
  67. package/dist/cjs/src/pro/krakenfutures.js +16 -4
  68. package/dist/cjs/src/pro/modetrade.js +3 -3
  69. package/dist/cjs/src/pro/okx.js +4 -4
  70. package/dist/cjs/src/pro/oxfun.js +4 -4
  71. package/dist/cjs/src/pro/woo.js +4 -4
  72. package/dist/cjs/src/pro/woofipro.js +3 -3
  73. package/dist/cjs/src/pro/xt.js +1 -1
  74. package/dist/cjs/src/toobit.js +1 -1
  75. package/dist/cjs/src/woo.js +1 -1
  76. package/dist/cjs/src/woofipro.js +1 -1
  77. package/dist/cjs/src/xt.js +2 -1
  78. package/dist/cjs/src/yobit.js +4 -2
  79. package/dist/cjs/src/zebpay.js +3 -3
  80. package/js/ccxt.d.ts +1 -1
  81. package/js/ccxt.js +1 -1
  82. package/js/src/abstract/mexc.d.ts +1 -0
  83. package/js/src/aftermath.js +10 -5
  84. package/js/src/alpaca.js +2 -2
  85. package/js/src/apex.d.ts +1 -1
  86. package/js/src/apex.js +25 -16
  87. package/js/src/arkham.js +7 -4
  88. package/js/src/ascendex.js +6 -3
  89. package/js/src/base/Exchange.js +3 -3
  90. package/js/src/bigone.js +7 -4
  91. package/js/src/binance.js +4 -4
  92. package/js/src/bingx.js +4 -4
  93. package/js/src/bitflyer.js +2 -1
  94. package/js/src/bitget.js +14 -3
  95. package/js/src/bitmart.js +5 -4
  96. package/js/src/bitmex.js +7 -4
  97. package/js/src/bitopro.js +1 -1
  98. package/js/src/bitrue.js +2 -1
  99. package/js/src/bitso.js +6 -3
  100. package/js/src/bitstamp.js +5 -3
  101. package/js/src/bittrade.js +2 -1
  102. package/js/src/blofin.js +2 -1
  103. package/js/src/bybit.d.ts +1 -1
  104. package/js/src/bybit.js +19 -17
  105. package/js/src/bybiteu.js +1 -0
  106. package/js/src/coinbaseexchange.js +2 -1
  107. package/js/src/coinbaseinternational.d.ts +1 -1
  108. package/js/src/coinbaseinternational.js +15 -9
  109. package/js/src/coinex.d.ts +1 -1
  110. package/js/src/coinex.js +5 -3
  111. package/js/src/coinsph.js +4 -4
  112. package/js/src/cryptocom.js +6 -6
  113. package/js/src/deepcoin.js +6 -3
  114. package/js/src/delta.js +2 -1
  115. package/js/src/deribit.js +4 -2
  116. package/js/src/derive.js +5 -3
  117. package/js/src/digifinex.js +2 -1
  118. package/js/src/exmo.js +12 -39
  119. package/js/src/foxbit.js +1 -1
  120. package/js/src/gemini.js +4 -2
  121. package/js/src/grvt.d.ts +1 -1
  122. package/js/src/grvt.js +13 -7
  123. package/js/src/hashkey.js +4 -4
  124. package/js/src/hibachi.d.ts +1 -1
  125. package/js/src/hibachi.js +1 -1
  126. package/js/src/hitbtc.js +2 -1
  127. package/js/src/htx.js +9 -5
  128. package/js/src/hyperliquid.d.ts +4 -4
  129. package/js/src/hyperliquid.js +19 -13
  130. package/js/src/indodax.js +2 -1
  131. package/js/src/kraken.js +14 -13
  132. package/js/src/krakenfutures.js +2 -1
  133. package/js/src/lbank.js +8 -4
  134. package/js/src/lighter.d.ts +1 -1
  135. package/js/src/lighter.js +1 -1
  136. package/js/src/luno.js +1 -1
  137. package/js/src/mercado.js +2 -1
  138. package/js/src/mexc.d.ts +2 -2
  139. package/js/src/mexc.js +24 -14
  140. package/js/src/modetrade.js +1 -1
  141. package/js/src/okx.js +6 -3
  142. package/js/src/oxfun.js +5 -3
  143. package/js/src/p2b.js +8 -4
  144. package/js/src/paradex.js +3 -2
  145. package/js/src/phemex.js +4 -2
  146. package/js/src/poloniex.js +2 -1
  147. package/js/src/pro/apex.js +10 -1
  148. package/js/src/pro/aster.js +10 -9
  149. package/js/src/pro/binance.d.ts +1 -1
  150. package/js/src/pro/binance.js +3 -3
  151. package/js/src/pro/bingx.js +7 -2
  152. package/js/src/pro/bitmart.js +10 -0
  153. package/js/src/pro/bitmex.js +1 -1
  154. package/js/src/pro/grvt.js +8 -0
  155. package/js/src/pro/htx.d.ts +4 -4
  156. package/js/src/pro/htx.js +4 -4
  157. package/js/src/pro/krakenfutures.d.ts +4 -4
  158. package/js/src/pro/krakenfutures.js +16 -4
  159. package/js/src/pro/modetrade.d.ts +3 -3
  160. package/js/src/pro/modetrade.js +3 -3
  161. package/js/src/pro/okx.d.ts +4 -4
  162. package/js/src/pro/okx.js +4 -4
  163. package/js/src/pro/oxfun.d.ts +4 -4
  164. package/js/src/pro/oxfun.js +4 -4
  165. package/js/src/pro/woo.d.ts +4 -4
  166. package/js/src/pro/woo.js +4 -4
  167. package/js/src/pro/woofipro.d.ts +3 -3
  168. package/js/src/pro/woofipro.js +3 -3
  169. package/js/src/pro/xt.js +1 -1
  170. package/js/src/toobit.d.ts +1 -1
  171. package/js/src/toobit.js +1 -1
  172. package/js/src/woo.js +1 -1
  173. package/js/src/woofipro.js +1 -1
  174. package/js/src/xt.js +2 -1
  175. package/js/src/yobit.js +4 -2
  176. package/js/src/zebpay.js +3 -3
  177. package/package.json +21 -7
package/dist/cjs/ccxt.js CHANGED
@@ -203,7 +203,7 @@ var xt$1 = require('./src/pro/xt.js');
203
203
 
204
204
  //-----------------------------------------------------------------------------
205
205
  // this is updated by vss.js when building
206
- const version = '4.5.55';
206
+ const version = '4.5.56';
207
207
  Exchange["default"].ccxtVersion = version;
208
208
  const exchanges = {
209
209
  'aftermath': aftermath["default"],
@@ -821,7 +821,8 @@ class aftermath extends aftermath$1["default"] {
821
821
  let account = undefined;
822
822
  [account, params] = this.handleOptionAndParams(params, 'createOrder', 'account');
823
823
  const order = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
824
- const orders = await this.createOrders([order], { 'account': account });
824
+ const accountObj = { 'account': account };
825
+ const orders = await this.createOrders([order], accountObj);
825
826
  return orders[0];
826
827
  }
827
828
  /**
@@ -1180,10 +1181,14 @@ class aftermath extends aftermath$1["default"] {
1180
1181
  // "collateral": 39.0
1181
1182
  // }
1182
1183
  //
1183
- return this.extend(this.parseTransaction(response, currency), {
1184
- 'addressFrom': account,
1185
- 'amount': amount,
1186
- });
1184
+ const parsedTx = this.parseTransaction(response, currency);
1185
+ parsedTx['addressFrom '] = account;
1186
+ parsedTx['amount'] = amount;
1187
+ return parsedTx;
1188
+ // return this.extend (, {
1189
+ // 'addressFrom': account,
1190
+ // 'amount': amount,
1191
+ // });
1187
1192
  }
1188
1193
  parseTransaction(transaction, currency = undefined) {
1189
1194
  return {
@@ -1147,7 +1147,7 @@ class alpaca extends alpaca$1["default"] {
1147
1147
  await this.loadMarkets();
1148
1148
  const response = await this.traderPrivateDeleteV2Orders(params);
1149
1149
  if (Array.isArray(response)) {
1150
- return this.parseOrders(response, undefined);
1150
+ return this.parseOrders(response);
1151
1151
  }
1152
1152
  else {
1153
1153
  return [
@@ -1896,7 +1896,7 @@ class alpaca extends alpaca$1["default"] {
1896
1896
  if (code !== undefined) {
1897
1897
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
1898
1898
  }
1899
- const message = this.safeValue(response, 'message', undefined);
1899
+ const message = this.safeValue(response, 'message');
1900
1900
  if (message !== undefined) {
1901
1901
  this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
1902
1902
  this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
@@ -1213,7 +1213,7 @@ class apex extends apex$1["default"] {
1213
1213
  'IMMEDIATE_OR_CANCEL': 'IMMEDIATE_OR_CANCEL',
1214
1214
  'POST_ONLY': 'POST_ONLY',
1215
1215
  };
1216
- return this.safeString(timeInForces, timeInForce, undefined);
1216
+ return this.safeString(timeInForces, timeInForce);
1217
1217
  }
1218
1218
  parseOrderStatus(status) {
1219
1219
  if (status !== undefined) {
@@ -1361,14 +1361,16 @@ class apex extends apex$1["default"] {
1361
1361
  if (clientOrderId === undefined) {
1362
1362
  clientOrderId = this.generateRandomClientIdOmni(accountId);
1363
1363
  }
1364
+ const finalClientOrderId = clientOrderId; // java req
1364
1365
  params = this.omit(params, ['clientId', 'clientOrderId', 'client_order_id', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice']);
1366
+ const finalOrderPrice = orderPrice; // java req
1365
1367
  const orderToSign = {
1366
1368
  'accountId': accountId,
1367
- 'slotId': clientOrderId,
1368
- 'nonce': clientOrderId,
1369
+ 'slotId': finalClientOrderId,
1370
+ 'nonce': finalClientOrderId,
1369
1371
  'pairId': market['quoteId'],
1370
1372
  'size': orderSize,
1371
- 'price': orderPrice,
1373
+ 'price': finalOrderPrice,
1372
1374
  'direction': orderSide,
1373
1375
  'makerFeeRate': maker,
1374
1376
  'takerFeeRate': taker,
@@ -1382,11 +1384,11 @@ class apex extends apex$1["default"] {
1382
1384
  'side': orderSide,
1383
1385
  'type': orderType,
1384
1386
  'size': orderSize,
1385
- 'price': orderPrice,
1387
+ 'price': finalOrderPrice,
1386
1388
  'limitFee': limitFee,
1387
1389
  'expiration': Math.floor(timeNow / 1000 + 30 * 24 * 60 * 60),
1388
1390
  'timeInForce': timeInForce,
1389
- 'clientId': clientOrderId,
1391
+ 'clientId': finalClientOrderId,
1390
1392
  'brokerId': this.safeString(this.options, 'brokerId', '6956'),
1391
1393
  };
1392
1394
  if (triggerPrice !== undefined) {
@@ -1432,6 +1434,7 @@ class apex extends apex$1["default"] {
1432
1434
  if (subAccounts.length > 0) {
1433
1435
  nonce = this.safeString(subAccounts[0], 'nonce', '0');
1434
1436
  }
1437
+ const finalNonce = nonce; // java req
1435
1438
  const ethAddress = this.safeString(accountData, 'ethereumAddress', '');
1436
1439
  const accountId = this.safeString(accountData, 'id', '');
1437
1440
  let currency = {};
@@ -1448,12 +1451,15 @@ class apex extends apex$1["default"] {
1448
1451
  }
1449
1452
  }
1450
1453
  const tokenId = this.safeString(currency, 'tokenId', '');
1451
- const amountNumber = this.parseToInt(amount * (Math.pow(10, this.safeNumber(currency, 'decimals', 0))));
1454
+ const decimalsNum = this.safeNumber(currency, 'decimals', 0);
1455
+ const mathPowResult = (Math.pow(10, decimalsNum));
1456
+ const amountNumber = this.parseToInt(amount * mathPowResult);
1452
1457
  const timestampSeconds = this.parseToInt(this.milliseconds() / 1000);
1453
1458
  let clientOrderId = this.safeStringN(params, ['clientId', 'clientOrderId', 'client_order_id']);
1454
1459
  if (clientOrderId === undefined) {
1455
1460
  clientOrderId = this.generateRandomClientIdOmni(this.safeString(this.options, 'accountId'));
1456
1461
  }
1462
+ const finalClientOrderId = clientOrderId; // java req
1457
1463
  params = this.omit(params, ['clientId', 'clientOrderId', 'client_order_id']);
1458
1464
  if (fromAccount !== undefined && fromAccount.toLowerCase() === 'contract') {
1459
1465
  const formattedUint32 = '4294967295';
@@ -1467,7 +1473,7 @@ class apex extends apex$1["default"] {
1467
1473
  'tokenId': tokenId,
1468
1474
  'amount': amountNumber.toString(),
1469
1475
  'fee': '0',
1470
- 'nonce': clientOrderId,
1476
+ 'nonce': finalClientOrderId,
1471
1477
  'timestampSeconds': expireTime,
1472
1478
  'isContract': true,
1473
1479
  };
@@ -1475,7 +1481,7 @@ class apex extends apex$1["default"] {
1475
1481
  const request = {
1476
1482
  'amount': amount,
1477
1483
  'expireTime': expireTime,
1478
- 'clientWithdrawId': clientOrderId,
1484
+ 'clientWithdrawId': finalClientOrderId,
1479
1485
  'signature': signature,
1480
1486
  'token': code,
1481
1487
  'ethAddress': ethAddress,
@@ -1483,10 +1489,11 @@ class apex extends apex$1["default"] {
1483
1489
  const response = await this.privatePostV3ContractTransferOut(this.extend(request, params));
1484
1490
  const data = this.safeDict(response, 'data', {});
1485
1491
  const currentTime = this.milliseconds();
1492
+ const parsedAmount = this.parseNumber(amount);
1486
1493
  return this.extend(this.parseTransfer(data, this.currency(code)), {
1487
1494
  'timestamp': currentTime,
1488
1495
  'datetime': this.iso8601(currentTime),
1489
- 'amount': this.parseNumber(amount),
1496
+ 'amount': parsedAmount,
1490
1497
  'fromAccount': 'contract',
1491
1498
  'toAccount': 'spot',
1492
1499
  });
@@ -1500,14 +1507,16 @@ class apex extends apex$1["default"] {
1500
1507
  'tokenId': tokenId,
1501
1508
  'amount': amountNumber.toString(),
1502
1509
  'fee': '0',
1503
- 'nonce': nonce,
1510
+ 'nonce': finalNonce,
1504
1511
  'timestampSeconds': timestampSeconds,
1505
1512
  };
1506
1513
  const signature = await this.getZKTransferSignatureObj(this.remove0xPrefix(this.getSeeds()), orderToSign);
1514
+ const amountStr = amount.toString();
1515
+ const ts = timestampSeconds; // java req
1507
1516
  const request = {
1508
- 'amount': amount.toString(),
1509
- 'timestamp': timestampSeconds,
1510
- 'clientTransferId': clientOrderId,
1517
+ 'amount': amountStr,
1518
+ 'timestamp': ts,
1519
+ 'clientTransferId': finalClientOrderId,
1511
1520
  'signature': signature,
1512
1521
  'zkAccountId': zkAccountId,
1513
1522
  'subAccountId': subAccountId,
@@ -1518,7 +1527,7 @@ class apex extends apex$1["default"] {
1518
1527
  'receiverZkAccountId': receiverZkAccountId,
1519
1528
  'receiverSubAccountId': receiverSubAccountId,
1520
1529
  'receiverAddress': receiverAddress,
1521
- 'nonce': nonce,
1530
+ 'nonce': finalNonce,
1522
1531
  };
1523
1532
  const response = await this.privatePostV3TransferOut(this.extend(request, params));
1524
1533
  const data = this.safeDict(response, 'data', {});
@@ -1576,7 +1585,7 @@ class apex extends apex$1["default"] {
1576
1585
  * @description cancels an open order
1577
1586
  * @see https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-post-cancel-order
1578
1587
  * @param {string} id order id
1579
- * @param symbol
1588
+ * @param {string} [symbol] unified symbol of the market the order was made in
1580
1589
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1581
1590
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
1582
1591
  */
@@ -1294,7 +1294,7 @@ class arkham extends arkham$1["default"] {
1294
1294
  //
1295
1295
  // [] returns an empty array, even when successfully cancels orders
1296
1296
  //
1297
- return this.parseOrders(response, undefined);
1297
+ return this.parseOrders(response);
1298
1298
  }
1299
1299
  /**
1300
1300
  * @method
@@ -1833,7 +1833,8 @@ class arkham extends arkham$1["default"] {
1833
1833
  // }
1834
1834
  //
1835
1835
  const data = this.safeList(response, 'addresses');
1836
- const parsed = this.parseDepositAddresses(data, undefined, false, { 'network': networkCode });
1836
+ const networkCodeUnified = networkCode; // java req
1837
+ const parsed = this.parseDepositAddresses(data, undefined, false, { 'network': networkCodeUnified });
1837
1838
  return this.indexBy(parsed, 'network');
1838
1839
  }
1839
1840
  parseDepositAddress(entry, currency = undefined) {
@@ -2391,11 +2392,13 @@ class arkham extends arkham$1["default"] {
2391
2392
  const marketId = this.safeString(info, 'market');
2392
2393
  market = this.safeMarket(marketId, market, undefined, 'swap');
2393
2394
  const maxNotional = this.safeNumber(tier, 'positionLimit');
2395
+ const curr = market['linear'] ? market['base'] : market['quote'];
2396
+ const notional = minNotional;
2394
2397
  tiers.push({
2395
2398
  'tier': this.sum(i, 1),
2396
2399
  'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
2397
- 'currency': market['linear'] ? market['base'] : market['quote'],
2398
- 'minNotional': minNotional,
2400
+ 'currency': curr,
2401
+ 'minNotional': notional,
2399
2402
  'maxNotional': maxNotional,
2400
2403
  'maintenanceMarginRate': this.safeNumber(tier, 'marginRate'),
2401
2404
  'maxLeverage': this.safeInteger(tier, 'leverageRate'),
@@ -907,12 +907,14 @@ class ascendex extends ascendex$1["default"] {
907
907
  accountGroup = this.safeString(data, 'accountGroup');
908
908
  this.options['account-group'] = accountGroup;
909
909
  }
910
+ const finalResponse = response; // java req
911
+ const finalAccountGroup = accountGroup;
910
912
  return [
911
913
  {
912
- 'id': accountGroup,
914
+ 'id': finalAccountGroup,
913
915
  'type': undefined,
914
916
  'code': undefined,
915
- 'info': response,
917
+ 'info': finalResponse,
916
918
  },
917
919
  ];
918
920
  }
@@ -3046,8 +3048,9 @@ class ascendex extends ascendex$1["default"] {
3046
3048
  if (type === 'reduce') {
3047
3049
  amount = Precise["default"].stringAbs(amount);
3048
3050
  }
3051
+ const parsedAmount = this.parseNumber(amount);
3049
3052
  return this.extend(this.parseMarginModification(response, market), {
3050
- 'amount': this.parseNumber(amount),
3053
+ 'amount': parsedAmount,
3051
3054
  'type': type,
3052
3055
  });
3053
3056
  }
@@ -3005,7 +3005,7 @@ class Exchange {
3005
3005
  }
3006
3006
  else {
3007
3007
  if (marketType === 'spot') {
3008
- this.features[marketType] = this.featuresMapper(initialFeatures, marketType, undefined);
3008
+ this.features[marketType] = this.featuresMapper(initialFeatures, marketType);
3009
3009
  }
3010
3010
  else {
3011
3011
  this.features[marketType] = {};
@@ -4887,7 +4887,7 @@ class Exchange {
4887
4887
  positions = this.toArray(positions);
4888
4888
  const result = [];
4889
4889
  for (let i = 0; i < positions.length; i++) {
4890
- const position = this.extend(this.parsePosition(positions[i], undefined), params);
4890
+ const position = this.extend(this.parsePosition(positions[i]), params);
4891
4891
  result.push(position);
4892
4892
  }
4893
4893
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
@@ -4900,7 +4900,7 @@ class Exchange {
4900
4900
  ranks = this.toArray(ranks);
4901
4901
  const result = [];
4902
4902
  for (let i = 0; i < ranks.length; i++) {
4903
- const rank = this.extend(this.parseADLRank(ranks[i], undefined), params);
4903
+ const rank = this.extend(this.parseADLRank(ranks[i]), params);
4904
4904
  result.push(rank);
4905
4905
  }
4906
4906
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
@@ -1244,18 +1244,21 @@ class bigone extends bigone$1["default"] {
1244
1244
  const makerFeeCost = this.safeString(trade, 'maker_fee');
1245
1245
  const takerFeeCost = this.safeString(trade, 'taker_fee');
1246
1246
  if (makerFeeCost !== undefined) {
1247
+ const makerCode = makerCurrencyCode;
1247
1248
  if (takerFeeCost !== undefined) {
1249
+ const takerCode = takerCurrencyCode;
1248
1250
  result['fees'] = [
1249
- { 'cost': makerFeeCost, 'currency': makerCurrencyCode },
1250
- { 'cost': takerFeeCost, 'currency': takerCurrencyCode },
1251
+ { 'cost': makerFeeCost, 'currency': makerCode },
1252
+ { 'cost': takerFeeCost, 'currency': takerCode },
1251
1253
  ];
1252
1254
  }
1253
1255
  else {
1254
- result['fee'] = { 'cost': makerFeeCost, 'currency': makerCurrencyCode };
1256
+ result['fee'] = { 'cost': makerFeeCost, 'currency': makerCode };
1255
1257
  }
1256
1258
  }
1257
1259
  else if (takerFeeCost !== undefined) {
1258
- result['fee'] = { 'cost': takerFeeCost, 'currency': takerCurrencyCode };
1260
+ const takerCode2 = takerCurrencyCode;
1261
+ result['fee'] = { 'cost': takerFeeCost, 'currency': takerCode2 };
1259
1262
  }
1260
1263
  else {
1261
1264
  result['fee'] = undefined;
@@ -6591,9 +6591,10 @@ class binance extends binance$1["default"] {
6591
6591
  const initialUppercaseType = type.toUpperCase();
6592
6592
  const isMarketOrder = initialUppercaseType === 'MARKET';
6593
6593
  const isLimitOrder = initialUppercaseType === 'LIMIT';
6594
+ const upperCaseSide = side.toUpperCase();
6594
6595
  const request = {
6595
6596
  'symbol': market['id'],
6596
- 'side': side.toUpperCase(),
6597
+ 'side': upperCaseSide,
6597
6598
  };
6598
6599
  let isPortfolioMargin = undefined;
6599
6600
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
@@ -8091,10 +8092,9 @@ class binance extends binance$1["default"] {
8091
8092
  return this.parseOrders(response, market);
8092
8093
  }
8093
8094
  else {
8095
+ const order = this.safeOrder({ 'info': response });
8094
8096
  return [
8095
- this.safeOrder({
8096
- 'info': response,
8097
- }),
8097
+ order,
8098
8098
  ];
8099
8099
  }
8100
8100
  }
@@ -1704,10 +1704,10 @@ class bingx extends bingx$1["default"] {
1704
1704
  [subType, params] = this.handleSubTypeAndParams('fetchFundingRates', firstMarket, params, subType);
1705
1705
  let response = undefined;
1706
1706
  if (subType === 'inverse') {
1707
- response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(params));
1707
+ response = await this.cswapV1PublicGetMarketPremiumIndex(params);
1708
1708
  }
1709
1709
  else {
1710
- response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1710
+ response = await this.swapV2PublicGetQuotePremiumIndex(params);
1711
1711
  }
1712
1712
  const data = this.safeList(response, 'data', []);
1713
1713
  return this.parseFundingRates(data, symbols);
@@ -5254,7 +5254,7 @@ class bingx extends bingx$1["default"] {
5254
5254
  await this.loadMarkets();
5255
5255
  const currency = this.currency(code);
5256
5256
  const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
5257
- const recvWindow = this.safeInteger(this.parseParams, 'recvWindow', defaultRecvWindow);
5257
+ const recvWindow = this.safeInteger(params, 'recvWindow', defaultRecvWindow);
5258
5258
  const request = {
5259
5259
  'coin': currency['id'],
5260
5260
  'offset': 0,
@@ -6325,7 +6325,7 @@ class bingx extends bingx$1["default"] {
6325
6325
  async closeAllPositions(params = {}) {
6326
6326
  await this.loadMarkets();
6327
6327
  const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
6328
- const recvWindow = this.safeInteger(this.parseParams, 'recvWindow', defaultRecvWindow);
6328
+ const recvWindow = this.safeInteger(params, 'recvWindow', defaultRecvWindow);
6329
6329
  let marketType = undefined;
6330
6330
  [marketType, params] = this.handleMarketTypeAndParams('closeAllPositions', undefined, params);
6331
6331
  let subType = undefined;
@@ -1196,7 +1196,8 @@ class bitflyer extends bitflyer$1["default"] {
1196
1196
  if (api === 'private') {
1197
1197
  this.checkRequiredCredentials();
1198
1198
  const nonce = this.nonce().toString();
1199
- let auth = [nonce, method, request].join('');
1199
+ const content = [nonce, method, request];
1200
+ let auth = content.join('');
1200
1201
  if (Object.keys(params).length) {
1201
1202
  if (method !== 'GET') {
1202
1203
  body = this.json(params);
@@ -1965,9 +1965,7 @@ class bitget extends bitget$1["default"] {
1965
1965
  if (uta) {
1966
1966
  return await this.fetchUtaMarkets(params);
1967
1967
  }
1968
- else {
1969
- return await this.fetchDefaultMarkets(params);
1970
- }
1968
+ return await this.fetchDefaultMarkets(params);
1971
1969
  }
1972
1970
  async fetchDefaultMarkets(params) {
1973
1971
  let types = undefined;
@@ -5368,6 +5366,13 @@ class bitget extends bitget$1["default"] {
5368
5366
  const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', this.numberToString(price));
5369
5367
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
5370
5368
  const isTrailingPercentOrder = trailingPercent !== undefined;
5369
+ // const multipleTriggers = (isTriggerOrder && (isStopLossTriggerOrder || isTakeProfitTriggerOrder || isTrailingPercentOrder))
5370
+ // || (isStopLossTriggerOrder && (isTakeProfitTriggerOrder || isTrailingPercentOrder))
5371
+ // || (isTakeProfitTriggerOrder && isTrailingPercentOrder);
5372
+ // if (multipleTriggers) {
5373
+ // throw new ExchangeError (this.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
5374
+ // }
5375
+ //
5371
5376
  if (this.sum(isTriggerOrder, isStopLossTriggerOrder, isTakeProfitTriggerOrder, isTrailingPercentOrder) > 1) {
5372
5377
  throw new errors.ExchangeError(this.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
5373
5378
  }
@@ -5792,6 +5797,12 @@ class bitget extends bitget$1["default"] {
5792
5797
  const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', this.numberToString(price));
5793
5798
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'newCallbackRatio');
5794
5799
  const isTrailingPercentOrder = trailingPercent !== undefined;
5800
+ // const multipleTriggers = (isTriggerOrder && (isStopLossOrder || isTakeProfitOrder || isTrailingPercentOrder))
5801
+ // || (isStopLossOrder && (isTakeProfitOrder || isTrailingPercentOrder))
5802
+ // || (isTakeProfitOrder && isTrailingPercentOrder);
5803
+ // if (multipleTriggers) {
5804
+ // throw new ExchangeError (this.id + ' editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
5805
+ // }
5795
5806
  if (this.sum(isTriggerOrder, isStopLossOrder, isTakeProfitOrder, isTrailingPercentOrder) > 1) {
5796
5807
  throw new errors.ExchangeError(this.id + ' editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent');
5797
5808
  }
@@ -3301,9 +3301,9 @@ class bitmart extends bitmart$1["default"] {
3301
3301
  }
3302
3302
  const succeeded = this.safeValue(data, 'succeed');
3303
3303
  if (succeeded !== undefined) {
3304
- id = this.safeString(succeeded, 0);
3305
- if (id === undefined) {
3306
- throw new errors.InvalidOrder(this.id + ' cancelOrder() failed to cancel ' + symbol + ' order id ' + id);
3304
+ const id2 = this.safeString(succeeded, 0);
3305
+ if (id2 === undefined) {
3306
+ throw new errors.InvalidOrder(this.id + ' cancelOrder() failed to cancel ' + symbol + ' order id ' + id2);
3307
3307
  }
3308
3308
  }
3309
3309
  else {
@@ -4641,8 +4641,9 @@ class bitmart extends bitmart$1["default"] {
4641
4641
  if (limit === undefined) {
4642
4642
  limit = 10;
4643
4643
  }
4644
+ const pageNumber = this.safeInteger(params, 'page', 1);
4644
4645
  const request = {
4645
- 'page': this.safeInteger(params, 'page', 1),
4646
+ 'page': pageNumber,
4646
4647
  'limit': limit, // default is 10, max is 100
4647
4648
  };
4648
4649
  let currency = undefined;
@@ -1486,13 +1486,14 @@ class bitmex extends bitmex$1["default"] {
1486
1486
  if (status !== undefined) {
1487
1487
  status = this.parseTransactionStatus(status);
1488
1488
  }
1489
+ const code = currency['code'];
1489
1490
  return {
1490
1491
  'info': transaction,
1491
1492
  'id': this.safeString(transaction, 'transactID'),
1492
1493
  'txid': this.safeString(transaction, 'tx'),
1493
1494
  'type': type,
1494
- 'currency': currency['code'],
1495
- 'network': this.networkIdToCode(this.safeString(transaction, 'network'), currency['code']),
1495
+ 'currency': code,
1496
+ 'network': this.networkIdToCode(this.safeString(transaction, 'network'), code),
1496
1497
  'amount': this.parseNumber(amount),
1497
1498
  'status': status,
1498
1499
  'timestamp': transactTime,
@@ -2027,6 +2028,7 @@ class bitmex extends bitmex$1["default"] {
2027
2028
  await this.loadMarkets();
2028
2029
  const market = this.market(symbol);
2029
2030
  let orderType = this.capitalize(type);
2031
+ const capitalizeOrderType = orderType;
2030
2032
  const reduceOnly = this.safeValue(params, 'reduceOnly');
2031
2033
  if (reduceOnly !== undefined) {
2032
2034
  if ((!market['swap']) && (!market['future'])) {
@@ -2041,7 +2043,7 @@ class bitmex extends bitmex$1["default"] {
2041
2043
  'symbol': market['id'],
2042
2044
  'side': this.capitalize(side),
2043
2045
  'orderQty': qty,
2044
- 'ordType': orderType,
2046
+ 'ordType': capitalizeOrderType,
2045
2047
  'text': brokerId,
2046
2048
  };
2047
2049
  const execInstructions = [];
@@ -2862,9 +2864,10 @@ class bitmex extends bitmex$1["default"] {
2862
2864
  }
2863
2865
  const currency = this.currency(code);
2864
2866
  params = this.omit(params, 'network');
2867
+ const parsedNetwork = this.networkCodeToId(networkCode, currency['code']);
2865
2868
  const request = {
2866
2869
  'currency': currency['id'],
2867
- 'network': this.networkCodeToId(networkCode, currency['code']),
2870
+ 'network': parsedNetwork,
2868
2871
  };
2869
2872
  const response = await this.privateGetUserDepositAddress(this.extend(request, params));
2870
2873
  //
@@ -1020,7 +1020,7 @@ class bitopro extends bitopro$1["default"] {
1020
1020
  '4': 'canceled',
1021
1021
  '6': 'canceled',
1022
1022
  };
1023
- return this.safeString(statuses, status, undefined);
1023
+ return this.safeString(statuses, status);
1024
1024
  }
1025
1025
  parseOrder(order, market = undefined) {
1026
1026
  //
@@ -983,6 +983,7 @@ class bitrue extends bitrue$1["default"] {
983
983
  if (minCost === undefined) {
984
984
  minCost = this.safeNumber(market, 'minOrderMoney');
985
985
  }
986
+ const isSpot = (type === 'spot');
986
987
  return {
987
988
  'id': id,
988
989
  'lowercaseId': lowercaseId,
@@ -994,7 +995,7 @@ class bitrue extends bitrue$1["default"] {
994
995
  'quoteId': quoteId,
995
996
  'settleId': settleId,
996
997
  'type': type,
997
- 'spot': (type === 'spot'),
998
+ 'spot': isSpot,
998
999
  'margin': false,
999
1000
  'swap': isContract,
1000
1001
  'future': false,
@@ -1051,8 +1051,9 @@ class bitso extends bitso$1["default"] {
1051
1051
  }
1052
1052
  // convert it to an integer unconditionally
1053
1053
  if (markerInParams) {
1054
+ const marker = parseInt(params['marker']);
1054
1055
  params = this.extend(params, {
1055
- 'marker': parseInt(params['marker']),
1056
+ 'marker': marker,
1056
1057
  });
1057
1058
  }
1058
1059
  const request = {
@@ -1271,8 +1272,9 @@ class bitso extends bitso$1["default"] {
1271
1272
  }
1272
1273
  // convert it to an integer unconditionally
1273
1274
  if (markerInParams) {
1275
+ const marker = parseInt(params['marker']);
1274
1276
  params = this.extend(params, {
1275
- 'marker': parseInt(params['marker']),
1277
+ 'marker': marker,
1276
1278
  });
1277
1279
  }
1278
1280
  const request = {
@@ -1832,7 +1834,8 @@ class bitso extends bitso$1["default"] {
1832
1834
  this.checkRequiredCredentials();
1833
1835
  const nonce = this.nonce().toString();
1834
1836
  endpoint = '/api' + endpoint;
1835
- let request = [nonce, method, endpoint].join('');
1837
+ const content = [nonce, method, endpoint];
1838
+ let request = content.join('');
1836
1839
  if (method !== 'GET' && method !== 'DELETE') {
1837
1840
  if (Object.keys(query).length) {
1838
1841
  body = this.json(query);
@@ -682,12 +682,13 @@ class bitstamp extends bitstamp$1["default"] {
682
682
  }
683
683
  }
684
684
  const isSpot = (type === 'spot');
685
+ const settle = settleId ? this.safeCurrencyCode(settleId) : undefined;
685
686
  result.push({
686
687
  'id': this.safeString(market, 'market_symbol'),
687
688
  'symbol': symbol,
688
689
  'base': base,
689
690
  'quote': quote,
690
- 'settle': settleId ? this.safeCurrencyCode(settleId) : undefined,
691
+ 'settle': settle,
691
692
  'baseId': baseId,
692
693
  'quoteId': quoteId,
693
694
  'settleId': settleId,
@@ -915,7 +916,7 @@ class bitstamp extends bitstamp$1["default"] {
915
916
  // }
916
917
  //
917
918
  const marketId = this.safeString(ticker, 'pair');
918
- const symbol = this.safeSymbol(marketId, market, undefined);
919
+ const symbol = this.safeSymbol(marketId, market);
919
920
  const timestamp = this.safeTimestamp(ticker, 'timestamp');
920
921
  const vwap = this.safeString(ticker, 'vwap');
921
922
  const baseVolume = this.safeString(ticker, 'volume');
@@ -1337,8 +1338,9 @@ class bitstamp extends bitstamp$1["default"] {
1337
1338
  return this.parseOHLCVs(ohlc, market, timeframe, since, limit);
1338
1339
  }
1339
1340
  parseBalance(response) {
1341
+ const finalResponse = response; // java req
1340
1342
  const result = {
1341
- 'info': response,
1343
+ 'info': finalResponse,
1342
1344
  'timestamp': undefined,
1343
1345
  'datetime': undefined,
1344
1346
  };
@@ -1996,8 +1996,9 @@ class bittrade extends bittrade$1["default"] {
1996
1996
  const requestSorted = this.keysort(request);
1997
1997
  let auth = this.urlencode(requestSorted);
1998
1998
  // unfortunately, PHP demands double quotes for the escaped newline symbol
1999
+ const content = [method, this.hostname, url, auth];
1999
2000
  // eslint-disable-next-line quotes
2000
- const payload = [method, this.hostname, url, auth].join("\n");
2001
+ const payload = content.join("\n");
2001
2002
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
2002
2003
  auth += '&' + this.urlencode({ 'Signature': signature });
2003
2004
  url += '?' + auth;
@@ -551,6 +551,7 @@ class blofin extends blofin$1["default"] {
551
551
  let maxLeverage = this.safeString(market, 'maxLeverage', '100');
552
552
  maxLeverage = Precise["default"].stringMax(maxLeverage, '1');
553
553
  const isActive = (this.safeString(market, 'state') === 'live');
554
+ const isMargin = spot && (Precise["default"].stringGt(maxLeverage, '1'));
554
555
  return this.safeMarketStructure({
555
556
  'id': id,
556
557
  'symbol': symbol,
@@ -563,7 +564,7 @@ class blofin extends blofin$1["default"] {
563
564
  'type': type,
564
565
  'spot': spot,
565
566
  'option': option,
566
- 'margin': spot && (Precise["default"].stringGt(maxLeverage, '1')),
567
+ 'margin': isMargin,
567
568
  'swap': swap,
568
569
  'future': future,
569
570
  'active': isActive,