ccxt 4.4.82 → 4.4.86

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 (145) hide show
  1. package/README.md +6 -9
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +6 -17
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -1
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +15 -2
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/bitget.js +6 -7
  10. package/dist/cjs/src/bitmart.js +1 -1
  11. package/dist/cjs/src/bitrue.js +14 -35
  12. package/dist/cjs/src/bitso.js +33 -0
  13. package/dist/cjs/src/bitstamp.js +33 -0
  14. package/dist/cjs/src/bittrade.js +2049 -0
  15. package/dist/cjs/src/blofin.js +154 -13
  16. package/dist/cjs/src/btcbox.js +25 -5
  17. package/dist/cjs/src/bybit.js +16 -40
  18. package/dist/cjs/src/cex.js +2 -4
  19. package/dist/cjs/src/coinbase.js +58 -46
  20. package/dist/cjs/src/coinbaseexchange.js +142 -32
  21. package/dist/cjs/src/coincatch.js +14 -67
  22. package/dist/cjs/src/coinex.js +29 -32
  23. package/dist/cjs/src/coinlist.js +16 -15
  24. package/dist/cjs/src/coinmetro.js +22 -11
  25. package/dist/cjs/src/coinone.js +8 -10
  26. package/dist/cjs/src/coinsph.js +126 -1
  27. package/dist/cjs/src/cryptocom.js +111 -1
  28. package/dist/cjs/src/cryptomus.js +43 -89
  29. package/dist/cjs/src/delta.js +76 -36
  30. package/dist/cjs/src/deribit.js +4 -5
  31. package/dist/cjs/src/derive.js +46 -10
  32. package/dist/cjs/src/ellipx.js +175 -79
  33. package/dist/cjs/src/gate.js +1 -1
  34. package/dist/cjs/src/gemini.js +3 -5
  35. package/dist/cjs/src/hitbtc.js +56 -69
  36. package/dist/cjs/src/hollaex.js +107 -49
  37. package/dist/cjs/src/htx.js +20 -44
  38. package/dist/cjs/src/hyperliquid.js +6 -6
  39. package/dist/cjs/src/kraken.js +29 -24
  40. package/dist/cjs/src/kucoinfutures.js +6 -0
  41. package/dist/cjs/src/lbank.js +1 -1
  42. package/dist/cjs/src/mexc.js +2 -2
  43. package/dist/cjs/src/ndax.js +25 -24
  44. package/dist/cjs/src/okcoin.js +12 -31
  45. package/dist/cjs/src/okx.js +9 -0
  46. package/dist/cjs/src/onetrading.js +9 -6
  47. package/dist/cjs/src/oxfun.js +42 -114
  48. package/dist/cjs/src/paradex.js +124 -4
  49. package/dist/cjs/src/pro/binance.js +32 -33
  50. package/dist/cjs/src/pro/bithumb.js +5 -3
  51. package/dist/cjs/src/pro/bittrade.js +605 -0
  52. package/dist/cjs/src/pro/kraken.js +289 -79
  53. package/dist/cjs/src/pro/luno.js +6 -5
  54. package/dist/cjs/src/pro/mexc.js +304 -7
  55. package/dist/cjs/src/pro/poloniex.js +6 -2
  56. package/examples/js/cli.js +127 -13
  57. package/js/ccxt.d.ts +8 -20
  58. package/js/ccxt.js +6 -14
  59. package/js/src/abstract/blofin.d.ts +8 -0
  60. package/js/src/abstract/btcbox.d.ts +1 -0
  61. package/js/src/abstract/myokx.d.ts +2 -0
  62. package/js/src/abstract/okx.d.ts +2 -0
  63. package/js/src/apex.js +2 -1
  64. package/js/src/ascendex.d.ts +2 -0
  65. package/js/src/ascendex.js +189 -155
  66. package/js/src/base/Exchange.d.ts +15 -1
  67. package/js/src/base/Exchange.js +15 -2
  68. package/js/src/base/types.d.ts +3 -0
  69. package/js/src/bequant.js +1 -1
  70. package/js/src/bitget.js +6 -7
  71. package/js/src/bitmart.js +1 -1
  72. package/js/src/bitrue.js +14 -35
  73. package/js/src/bitso.js +33 -0
  74. package/js/src/bitstamp.js +33 -0
  75. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  76. package/js/src/{huobijp.js → bittrade.js} +35 -35
  77. package/js/src/blofin.d.ts +42 -2
  78. package/js/src/blofin.js +154 -13
  79. package/js/src/btcbox.js +25 -5
  80. package/js/src/bybit.js +16 -40
  81. package/js/src/cex.js +2 -4
  82. package/js/src/coinbase.js +58 -46
  83. package/js/src/coinbaseexchange.js +142 -32
  84. package/js/src/coincatch.js +14 -67
  85. package/js/src/coinex.js +28 -29
  86. package/js/src/coinlist.js +16 -15
  87. package/js/src/coinmetro.js +22 -11
  88. package/js/src/coinone.js +8 -10
  89. package/js/src/coinsph.d.ts +10 -1
  90. package/js/src/coinsph.js +126 -1
  91. package/js/src/cryptocom.d.ts +10 -1
  92. package/js/src/cryptocom.js +111 -1
  93. package/js/src/cryptomus.js +43 -89
  94. package/js/src/delta.js +76 -36
  95. package/js/src/deribit.js +4 -5
  96. package/js/src/derive.js +46 -10
  97. package/js/src/ellipx.d.ts +2 -3
  98. package/js/src/ellipx.js +175 -80
  99. package/js/src/gate.js +1 -1
  100. package/js/src/gemini.js +3 -5
  101. package/js/src/hitbtc.js +56 -69
  102. package/js/src/hollaex.js +107 -49
  103. package/js/src/htx.js +20 -44
  104. package/js/src/hyperliquid.js +6 -6
  105. package/js/src/kraken.js +29 -24
  106. package/js/src/kucoinfutures.d.ts +1 -0
  107. package/js/src/kucoinfutures.js +6 -0
  108. package/js/src/lbank.js +1 -1
  109. package/js/src/mexc.js +2 -2
  110. package/js/src/ndax.js +25 -24
  111. package/js/src/okcoin.js +12 -31
  112. package/js/src/okx.js +9 -0
  113. package/js/src/onetrading.js +9 -6
  114. package/js/src/oxfun.js +42 -114
  115. package/js/src/paradex.d.ts +12 -1
  116. package/js/src/paradex.js +124 -4
  117. package/js/src/pro/binance.d.ts +26 -26
  118. package/js/src/pro/binance.js +32 -33
  119. package/js/src/pro/bithumb.js +5 -3
  120. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  121. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  122. package/js/src/pro/kraken.d.ts +7 -6
  123. package/js/src/pro/kraken.js +290 -80
  124. package/js/src/pro/luno.js +6 -5
  125. package/js/src/pro/mexc.d.ts +58 -0
  126. package/js/src/pro/mexc.js +304 -7
  127. package/js/src/pro/poloniex.d.ts +1 -1
  128. package/js/src/pro/poloniex.js +6 -2
  129. package/package.json +1 -1
  130. package/js/src/abstract/bl3p.d.ts +0 -22
  131. package/js/src/abstract/huobijp.js +0 -11
  132. package/js/src/abstract/idex.d.ts +0 -29
  133. package/js/src/abstract/idex.js +0 -11
  134. package/js/src/abstract/kuna.d.ts +0 -185
  135. package/js/src/abstract/kuna.js +0 -11
  136. package/js/src/bl3p.d.ts +0 -116
  137. package/js/src/bl3p.js +0 -552
  138. package/js/src/idex.d.ts +0 -312
  139. package/js/src/idex.js +0 -1961
  140. package/js/src/kuna.d.ts +0 -335
  141. package/js/src/kuna.js +0 -2006
  142. package/js/src/pro/idex.d.ts +0 -81
  143. package/js/src/pro/idex.js +0 -720
  144. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  145. /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
@@ -1534,6 +1534,7 @@ export default class kucoinfutures extends kucoin {
1534
1534
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
1535
1535
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
1536
1536
  * @param {float} [params.cost] the cost of the order in units of USDT
1537
+ * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'isolated'
1537
1538
  * ----------------- Exchange Specific Parameters -----------------
1538
1539
  * @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1)
1539
1540
  * @param {string} [params.clientOid] client order id, defaults to uuid if not passed
@@ -1637,6 +1638,11 @@ export default class kucoinfutures extends kucoin {
1637
1638
  'type': type,
1638
1639
  'leverage': 1,
1639
1640
  };
1641
+ const marginModeUpper = this.safeStringUpper(params, 'marginMode');
1642
+ if (marginModeUpper !== undefined) {
1643
+ params = this.omit(params, 'marginMode');
1644
+ request['marginMode'] = marginModeUpper;
1645
+ }
1640
1646
  const cost = this.safeString(params, 'cost');
1641
1647
  params = this.omit(params, 'cost');
1642
1648
  if (cost !== undefined) {
package/js/src/lbank.js CHANGED
@@ -879,7 +879,7 @@ export default class lbank extends Exchange {
879
879
  if (market['swap']) {
880
880
  return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
881
881
  }
882
- return this.parseOrderBook(orderbook, market['symbol'], timestamp);
882
+ return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 1, 0);
883
883
  }
884
884
  parseTrade(trade, market = undefined) {
885
885
  //
package/js/src/mexc.js CHANGED
@@ -1090,7 +1090,6 @@ export default class mexc extends Exchange {
1090
1090
  const currency = response[i];
1091
1091
  const id = this.safeString(currency, 'coin');
1092
1092
  const code = this.safeCurrencyCode(id);
1093
- const name = this.safeString(currency, 'name');
1094
1093
  const networks = {};
1095
1094
  const chains = this.safeValue(currency, 'networkList', []);
1096
1095
  for (let j = 0; j < chains.length; j++) {
@@ -1112,13 +1111,14 @@ export default class mexc extends Exchange {
1112
1111
  'max': this.safeString(chain, 'withdrawMax'),
1113
1112
  },
1114
1113
  },
1114
+ 'contract': this.safeString(chain, 'contract'),
1115
1115
  };
1116
1116
  }
1117
1117
  result[code] = this.safeCurrencyStructure({
1118
1118
  'info': currency,
1119
1119
  'id': id,
1120
1120
  'code': code,
1121
- 'name': name,
1121
+ 'name': this.safeString(currency, 'name'),
1122
1122
  'active': undefined,
1123
1123
  'deposit': undefined,
1124
1124
  'withdraw': undefined,
package/js/src/ndax.js CHANGED
@@ -455,45 +455,45 @@ export default class ndax extends Exchange {
455
455
  };
456
456
  const response = await this.publicGetGetProducts(this.extend(request, params));
457
457
  //
458
- // [
459
- // {
460
- // "OMSId":1,
461
- // "ProductId":1,
462
- // "Product":"BTC",
463
- // "ProductFullName":"Bitcoin",
464
- // "ProductType":"CryptoCurrency",
465
- // "DecimalPlaces":8,
466
- // "TickSize":0.0000000100000000000000000000,
467
- // "NoFees":false,
468
- // "IsDisabled":false,
469
- // "MarginEnabled":false
470
- // },
471
- // ]
458
+ // [
459
+ // {
460
+ // "OMSId": "1",
461
+ // "ProductId": "1",
462
+ // "Product": "BTC",
463
+ // "ProductFullName": "Bitcoin",
464
+ // "MasterDataUniqueProductSymbol": "",
465
+ // "ProductType": "CryptoCurrency",
466
+ // "DecimalPlaces": "8",
467
+ // "TickSize": "0.0000000100000000000000000000",
468
+ // "DepositEnabled": true,
469
+ // "WithdrawEnabled": true,
470
+ // "NoFees": false,
471
+ // "IsDisabled": false,
472
+ // "MarginEnabled": false
473
+ // },
474
+ // ...
472
475
  //
473
476
  const result = {};
474
477
  for (let i = 0; i < response.length; i++) {
475
478
  const currency = response[i];
476
479
  const id = this.safeString(currency, 'ProductId');
477
- const name = this.safeString(currency, 'ProductFullName');
480
+ const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
478
481
  const ProductType = this.safeString(currency, 'ProductType');
479
482
  let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
480
483
  if (ProductType === 'Unknown') {
481
484
  // such currency is just a blanket entry
482
485
  type = 'other';
483
486
  }
484
- const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
485
- const isDisabled = this.safeValue(currency, 'IsDisabled');
486
- const active = !isDisabled;
487
- result[code] = {
487
+ result[code] = this.safeCurrencyStructure({
488
488
  'id': id,
489
- 'name': name,
489
+ 'name': this.safeString(currency, 'ProductFullName'),
490
490
  'code': code,
491
491
  'type': type,
492
492
  'precision': this.safeNumber(currency, 'TickSize'),
493
493
  'info': currency,
494
- 'active': active,
495
- 'deposit': undefined,
496
- 'withdraw': undefined,
494
+ 'active': !this.safeBool(currency, 'IsDisabled'),
495
+ 'deposit': this.safeBool(currency, 'DepositEnabled'),
496
+ 'withdraw': this.safeBool(currency, 'WithdrawEnabled'),
497
497
  'fee': undefined,
498
498
  'limits': {
499
499
  'amount': {
@@ -506,7 +506,8 @@ export default class ndax extends Exchange {
506
506
  },
507
507
  },
508
508
  'networks': {},
509
- };
509
+ 'margin': this.safeBool(currency, 'MarginEnabled'),
510
+ });
510
511
  }
511
512
  return result;
512
513
  }
package/js/src/okcoin.js CHANGED
@@ -829,49 +829,30 @@ export default class okcoin extends Exchange {
829
829
  }
830
830
  else {
831
831
  const response = await this.privateGetAssetCurrencies(params);
832
- const data = this.safeValue(response, 'data', []);
832
+ const data = this.safeList(response, 'data', []);
833
833
  const result = {};
834
834
  const dataByCurrencyId = this.groupBy(data, 'ccy');
835
835
  const currencyIds = Object.keys(dataByCurrencyId);
836
836
  for (let i = 0; i < currencyIds.length; i++) {
837
837
  const currencyId = currencyIds[i];
838
- const currency = this.safeCurrency(currencyId);
839
- const code = currency['code'];
838
+ const code = this.safeCurrencyCode(currencyId);
840
839
  const chains = dataByCurrencyId[currencyId];
841
840
  const networks = {};
842
- let currencyActive = false;
843
- let depositEnabled = false;
844
- let withdrawEnabled = false;
845
- let maxPrecision = undefined;
846
841
  for (let j = 0; j < chains.length; j++) {
847
842
  const chain = chains[j];
848
- const canDeposit = this.safeValue(chain, 'canDep');
849
- depositEnabled = (canDeposit) ? canDeposit : depositEnabled;
850
- const canWithdraw = this.safeValue(chain, 'canWd');
851
- withdrawEnabled = (canWithdraw) ? canWithdraw : withdrawEnabled;
852
- const canInternal = this.safeValue(chain, 'canInternal');
853
- const active = (canDeposit && canWithdraw && canInternal) ? true : false;
854
- currencyActive = (active) ? active : currencyActive;
855
843
  const networkId = this.safeString(chain, 'chain');
856
844
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
857
845
  const parts = networkId.split('-');
858
846
  const chainPart = this.safeString(parts, 1, networkId);
859
847
  const networkCode = this.networkIdToCode(chainPart);
860
- const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
861
- if (maxPrecision === undefined) {
862
- maxPrecision = precision;
863
- }
864
- else {
865
- maxPrecision = Precise.stringMin(maxPrecision, precision);
866
- }
867
848
  networks[networkCode] = {
868
849
  'id': networkId,
869
850
  'network': networkCode,
870
- 'active': active,
871
- 'deposit': canDeposit,
872
- 'withdraw': canWithdraw,
851
+ 'active': undefined,
852
+ 'deposit': this.safeBool(chain, 'canDep'),
853
+ 'withdraw': this.safeBool(chain, 'canWd'),
873
854
  'fee': this.safeNumber(chain, 'minFee'),
874
- 'precision': this.parseNumber(precision),
855
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
875
856
  'limits': {
876
857
  'withdraw': {
877
858
  'min': this.safeNumber(chain, 'minWd'),
@@ -883,16 +864,16 @@ export default class okcoin extends Exchange {
883
864
  }
884
865
  }
885
866
  const firstChain = this.safeValue(chains, 0);
886
- result[code] = {
867
+ result[code] = this.safeCurrencyStructure({
887
868
  'info': chains,
888
869
  'code': code,
889
870
  'id': currencyId,
890
871
  'name': this.safeString(firstChain, 'name'),
891
- 'active': currencyActive,
892
- 'deposit': depositEnabled,
893
- 'withdraw': withdrawEnabled,
872
+ 'active': undefined,
873
+ 'deposit': undefined,
874
+ 'withdraw': undefined,
894
875
  'fee': undefined,
895
- 'precision': this.parseNumber(maxPrecision),
876
+ 'precision': undefined,
896
877
  'limits': {
897
878
  'amount': {
898
879
  'min': undefined,
@@ -900,7 +881,7 @@ export default class okcoin extends Exchange {
900
881
  },
901
882
  },
902
883
  'networks': networks,
903
- };
884
+ });
904
885
  }
905
886
  return result;
906
887
  }
package/js/src/okx.js CHANGED
@@ -366,6 +366,7 @@ export default class okx extends Exchange {
366
366
  'account/spot-manual-borrow-repay': 10,
367
367
  'account/set-auto-repay': 4,
368
368
  'account/spot-borrow-repay-history': 4,
369
+ 'account/move-positions-history': 10,
369
370
  // subaccount
370
371
  'users/subaccount/list': 10,
371
372
  'account/subaccount/balances': 10 / 3,
@@ -503,6 +504,7 @@ export default class okx extends Exchange {
503
504
  'account/fixed-loan/manual-reborrow': 5,
504
505
  'account/fixed-loan/repay-borrowing-order': 5,
505
506
  'account/bills-history-archive': 72000,
507
+ 'account/move-positions': 10,
506
508
  // subaccount
507
509
  'users/subaccount/modify-apikey': 10,
508
510
  'asset/subaccount/transfer': 10,
@@ -969,6 +971,13 @@ export default class okx extends Exchange {
969
971
  '70010': BadRequest,
970
972
  '70013': BadRequest,
971
973
  '70016': BadRequest,
974
+ '70060': BadRequest,
975
+ '70061': BadRequest,
976
+ '70062': BadRequest,
977
+ '70064': BadRequest,
978
+ '70065': BadRequest,
979
+ '70066': BadRequest,
980
+ '70067': BadRequest,
972
981
  '1009': BadRequest,
973
982
  '4001': AuthenticationError,
974
983
  '4002': BadRequest,
@@ -395,9 +395,12 @@ export default class onetrading extends Exchange {
395
395
  //
396
396
  // [
397
397
  // {
398
- // "code":"BEST",
399
- // "precision":8
400
- // }
398
+ // "code": "USDT",
399
+ // "precision": 6,
400
+ // "unified_cryptoasset_id": 825,
401
+ // "name": "Tether USDt",
402
+ // "collateral_percentage": 0
403
+ // },
401
404
  // ]
402
405
  //
403
406
  const result = {};
@@ -405,10 +408,10 @@ export default class onetrading extends Exchange {
405
408
  const currency = response[i];
406
409
  const id = this.safeString(currency, 'code');
407
410
  const code = this.safeCurrencyCode(id);
408
- result[code] = {
411
+ result[code] = this.safeCurrencyStructure({
409
412
  'id': id,
410
413
  'code': code,
411
- 'name': undefined,
414
+ 'name': this.safeString(currency, 'name'),
412
415
  'info': currency,
413
416
  'active': undefined,
414
417
  'fee': undefined,
@@ -420,7 +423,7 @@ export default class onetrading extends Exchange {
420
423
  'withdraw': { 'min': undefined, 'max': undefined },
421
424
  },
422
425
  'networks': {},
423
- };
426
+ });
424
427
  }
425
428
  return result;
426
429
  }
package/js/src/oxfun.js CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/oxfun.js';
9
- import { Precise } from './base/Precise.js';
10
9
  import { AccountNotEnabled, ArgumentsRequired, AuthenticationError, BadRequest, BadSymbol, ExchangeError, InvalidOrder, InsufficientFunds, OrderNotFound, MarketClosed, NetworkError, NotSupported, OperationFailed, RateLimitExceeded, RequestTimeout } from './base/errors.js';
11
10
  import { TICK_SIZE } from './base/functions/number.js';
12
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
@@ -602,66 +601,7 @@ export default class oxfun extends Exchange {
602
601
  // "minDeposit": "0.00010",
603
602
  // "minWithdrawal": "0.00010"
604
603
  // },
605
- // {
606
- // "network": "Arbitrum",
607
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
608
- // "transactionPrecision": "18",
609
- // "isWithdrawalFeeChargedToUser": true,
610
- // "canDeposit": true,
611
- // "canWithdraw": true,
612
- // "minDeposit": "0.00010",
613
- // "minWithdrawal": "0.00010"
614
- // },
615
- // {
616
- // "network": "Ethereum",
617
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
618
- // "transactionPrecision": "18",
619
- // "isWithdrawalFeeChargedToUser": true,
620
- // "canDeposit": true,
621
- // "canWithdraw": true,
622
- // "minDeposit": "0.00010",
623
- // "minWithdrawal": "0.00010"
624
- // },
625
- // {
626
- // "network": "Arbitrum",
627
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
628
- // "transactionPrecision": "18",
629
- // "isWithdrawalFeeChargedToUser": true,
630
- // "canDeposit": true,
631
- // "canWithdraw": false,
632
- // "minDeposit": "0.00010",
633
- // "minWithdrawal": "0.00010"
634
- // },
635
- // {
636
- // "network": "Avalanche",
637
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
638
- // "transactionPrecision": "18",
639
- // "isWithdrawalFeeChargedToUser": true,
640
- // "canDeposit": true,
641
- // "canWithdraw": false,
642
- // "minDeposit": "0.00010",
643
- // "minWithdrawal": "0.00010"
644
- // },
645
- // {
646
- // "network": "Solana",
647
- // "tokenId": "DV3845GEAVXfwpyVGGgWbqBVCtzHdCXNCGfcdboSEuZz",
648
- // "transactionPrecision": "8",
649
- // "isWithdrawalFeeChargedToUser": true,
650
- // "canDeposit": true,
651
- // "canWithdraw": true,
652
- // "minDeposit": "0.00010",
653
- // "minWithdrawal": "0.00010"
654
- // },
655
- // {
656
- // "network": "Ethereum",
657
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
658
- // "transactionPrecision": "18",
659
- // "isWithdrawalFeeChargedToUser": true,
660
- // "canDeposit": true,
661
- // "canWithdraw": false,
662
- // "minDeposit": "0.00010",
663
- // "minWithdrawal": "0.00010"
664
- // }
604
+ // ...
665
605
  // ]
666
606
  // },
667
607
  // {
@@ -711,79 +651,67 @@ export default class oxfun extends Exchange {
711
651
  const parts = fullId.split('.');
712
652
  const id = parts[0];
713
653
  const code = this.safeCurrencyCode(id);
714
- let networks = {};
654
+ if (!(code in result)) {
655
+ result[code] = {
656
+ 'id': id,
657
+ 'code': code,
658
+ 'precision': undefined,
659
+ 'type': undefined,
660
+ 'name': undefined,
661
+ 'active': undefined,
662
+ 'deposit': undefined,
663
+ 'withdraw': undefined,
664
+ 'fee': undefined,
665
+ 'limits': {
666
+ 'withdraw': {
667
+ 'min': undefined,
668
+ 'max': undefined,
669
+ },
670
+ 'deposit': {
671
+ 'min': undefined,
672
+ 'max': undefined,
673
+ },
674
+ },
675
+ 'networks': {},
676
+ 'info': [],
677
+ };
678
+ }
715
679
  const chains = this.safeList(currency, 'networkList', []);
716
- let currencyMaxPrecision = undefined;
717
- let currencyDepositEnabled = undefined;
718
- let currencyWithdrawEnabled = undefined;
719
680
  for (let j = 0; j < chains.length; j++) {
720
681
  const chain = chains[j];
721
682
  const networkId = this.safeString(chain, 'network');
722
683
  const networkCode = this.networkIdToCode(networkId);
723
- const deposit = this.safeBool(chain, 'canDeposit');
724
- const withdraw = this.safeBool(chain, 'canWithdraw');
725
- const active = (deposit && withdraw);
726
- const minDeposit = this.safeString(chain, 'minDeposit');
727
- const minWithdrawal = this.safeString(chain, 'minWithdrawal');
728
- const precision = this.parsePrecision(this.safeString(chain, 'transactionPrecision'));
729
- networks[networkCode] = {
684
+ result[code]['networks'][networkCode] = {
730
685
  'id': networkId,
731
686
  'network': networkCode,
732
687
  'margin': undefined,
733
- 'deposit': deposit,
734
- 'withdraw': withdraw,
735
- 'active': active,
688
+ 'deposit': this.safeBool(chain, 'canDeposit'),
689
+ 'withdraw': this.safeBool(chain, 'canWithdraw'),
690
+ 'active': undefined,
736
691
  'fee': undefined,
737
- 'precision': this.parseNumber(precision),
692
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'transactionPrecision'))),
738
693
  'limits': {
739
694
  'deposit': {
740
- 'min': minDeposit,
695
+ 'min': this.safeNumber(chain, 'minDeposit'),
741
696
  'max': undefined,
742
697
  },
743
698
  'withdraw': {
744
- 'min': minWithdrawal,
699
+ 'min': this.safeNumber(chain, 'minWithdrawal'),
745
700
  'max': undefined,
746
701
  },
747
702
  },
748
703
  'info': chain,
749
704
  };
750
- if ((currencyDepositEnabled === undefined) || deposit) {
751
- currencyDepositEnabled = deposit;
752
- }
753
- if ((currencyWithdrawEnabled === undefined) || withdraw) {
754
- currencyWithdrawEnabled = withdraw;
755
- }
756
- if ((currencyMaxPrecision === undefined) || Precise.stringGt(currencyMaxPrecision, precision)) {
757
- currencyMaxPrecision = precision;
758
- }
759
- }
760
- if (code in result) {
761
- // checking for specific ids as USDC.ARB
762
- networks = this.extend(result[code]['networks'], networks);
763
705
  }
764
- result[code] = {
765
- 'id': id,
766
- 'code': code,
767
- 'name': undefined,
768
- 'type': undefined,
769
- 'active': undefined,
770
- 'deposit': currencyDepositEnabled,
771
- 'withdraw': currencyWithdrawEnabled,
772
- 'fee': undefined,
773
- 'precision': this.parseNumber(currencyMaxPrecision),
774
- 'limits': {
775
- 'amount': {
776
- 'min': undefined,
777
- 'max': undefined,
778
- },
779
- 'withdraw': {
780
- 'min': undefined,
781
- 'max': undefined,
782
- },
783
- },
784
- 'networks': networks,
785
- 'info': currency,
786
- };
706
+ const infos = this.safeList(result[code], 'info', []);
707
+ infos.push(currency);
708
+ result[code]['info'] = infos;
709
+ }
710
+ // only after all entries are formed in currencies, restructure each entry
711
+ const allKeys = Object.keys(result);
712
+ for (let i = 0; i < allKeys.length; i++) {
713
+ const code = allKeys[i];
714
+ result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
787
715
  }
788
716
  return result;
789
717
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/paradex.js';
2
- import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int, MarginMode, Leverage } from './base/types.js';
2
+ import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int, MarginMode, Leverage, Greeks } from './base/types.js';
3
3
  /**
4
4
  * @class paradex
5
5
  * @description Paradex is a decentralized exchange built on the StarkWare layer 2 scaling solution. To access private methods you can either use the ETH public key and private key by setting (exchange.privateKey and exchange.walletAddress)
@@ -358,6 +358,17 @@ export default class paradex extends Exchange {
358
358
  * @returns {object} response from the exchange
359
359
  */
360
360
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
361
+ /**
362
+ * @method
363
+ * @name paradex#fetchGreeks
364
+ * @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
365
+ * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
366
+ * @param {string} symbol unified symbol of the market to fetch greeks for
367
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
368
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
369
+ */
370
+ fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
371
+ parseGreeks(greeks: Dict, market?: Market): Greeks;
361
372
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
362
373
  url: string;
363
374
  method: string;