ccxt 4.4.85 → 4.4.87

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 (115) hide show
  1. package/README.md +18 -7
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +16 -9
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/abstract/modetrade.js +9 -0
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +10 -8
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/binance.js +1 -1
  10. package/dist/cjs/src/bitget.js +5 -4
  11. package/dist/cjs/src/bitmart.js +1 -1
  12. package/dist/cjs/src/bitteam.js +31 -0
  13. package/dist/cjs/src/bittrade.js +2049 -0
  14. package/dist/cjs/src/coinbase.js +2 -6
  15. package/dist/cjs/src/coinmetro.js +5 -1
  16. package/dist/cjs/src/deribit.js +4 -5
  17. package/dist/cjs/src/derive.js +4 -5
  18. package/dist/cjs/src/ellipx.js +2 -3
  19. package/dist/cjs/src/gate.js +92 -76
  20. package/dist/cjs/src/hollaex.js +107 -49
  21. package/dist/cjs/src/htx.js +30 -52
  22. package/dist/cjs/src/hyperliquid.js +36 -20
  23. package/dist/cjs/src/kraken.js +5 -8
  24. package/dist/cjs/src/mexc.js +2 -2
  25. package/dist/cjs/src/modetrade.js +2839 -0
  26. package/dist/cjs/src/ndax.js +25 -24
  27. package/dist/cjs/src/okcoin.js +12 -31
  28. package/dist/cjs/src/okx.js +104 -2
  29. package/dist/cjs/src/okxus.js +53 -0
  30. package/dist/cjs/src/onetrading.js +9 -6
  31. package/dist/cjs/src/oxfun.js +42 -114
  32. package/dist/cjs/src/paradex.js +10 -1
  33. package/dist/cjs/src/phemex.js +4 -6
  34. package/dist/cjs/src/poloniex.js +181 -170
  35. package/dist/cjs/src/pro/binance.js +1 -0
  36. package/dist/cjs/src/pro/bittrade.js +605 -0
  37. package/dist/cjs/src/pro/luno.js +6 -5
  38. package/dist/cjs/src/pro/mexc.js +3 -0
  39. package/dist/cjs/src/pro/modetrade.js +1334 -0
  40. package/dist/cjs/src/pro/okxus.js +38 -0
  41. package/dist/cjs/src/probit.js +18 -51
  42. package/dist/cjs/src/timex.js +5 -10
  43. package/dist/cjs/src/vertex.js +3 -4
  44. package/dist/cjs/src/whitebit.js +41 -11
  45. package/dist/cjs/src/woo.js +101 -77
  46. package/dist/cjs/src/woofipro.js +24 -21
  47. package/dist/cjs/src/xt.js +36 -44
  48. package/js/ccxt.d.ts +20 -11
  49. package/js/ccxt.js +14 -8
  50. package/js/src/abstract/modetrade.d.ts +122 -0
  51. package/js/src/abstract/myokx.d.ts +2 -0
  52. package/js/src/abstract/okx.d.ts +2 -0
  53. package/js/src/abstract/okxus.d.ts +352 -0
  54. package/js/src/abstract/okxus.js +11 -0
  55. package/js/src/ascendex.d.ts +2 -0
  56. package/js/src/ascendex.js +189 -155
  57. package/js/src/base/Exchange.js +10 -8
  58. package/js/src/bequant.js +1 -1
  59. package/js/src/binance.js +1 -1
  60. package/js/src/bitget.js +5 -4
  61. package/js/src/bitmart.js +1 -1
  62. package/js/src/bitteam.js +31 -0
  63. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  64. package/js/src/{huobijp.js → bittrade.js} +35 -35
  65. package/js/src/coinbase.js +2 -6
  66. package/js/src/coinmetro.js +5 -1
  67. package/js/src/deribit.js +4 -5
  68. package/js/src/derive.js +4 -3
  69. package/js/src/ellipx.d.ts +1 -1
  70. package/js/src/ellipx.js +3 -5
  71. package/js/src/gate.js +92 -76
  72. package/js/src/hollaex.js +107 -49
  73. package/js/src/htx.js +30 -52
  74. package/js/src/hyperliquid.js +36 -20
  75. package/js/src/kraken.js +5 -8
  76. package/js/src/mexc.js +2 -2
  77. package/js/src/modetrade.d.ts +475 -0
  78. package/js/src/modetrade.js +2840 -0
  79. package/js/src/ndax.js +25 -24
  80. package/js/src/okcoin.js +12 -31
  81. package/js/src/okx.d.ts +24 -1
  82. package/js/src/okx.js +104 -2
  83. package/js/src/okxus.d.ts +4 -0
  84. package/js/src/okxus.js +54 -0
  85. package/js/src/onetrading.js +9 -6
  86. package/js/src/oxfun.js +42 -114
  87. package/js/src/paradex.js +10 -1
  88. package/js/src/phemex.js +4 -6
  89. package/js/src/poloniex.d.ts +2 -0
  90. package/js/src/poloniex.js +181 -170
  91. package/js/src/pro/binance.js +1 -0
  92. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  93. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  94. package/js/src/pro/luno.js +6 -5
  95. package/js/src/pro/mexc.js +3 -0
  96. package/js/src/pro/modetrade.d.ts +155 -0
  97. package/js/src/pro/modetrade.js +1335 -0
  98. package/js/src/pro/okxus.d.ts +4 -0
  99. package/js/src/pro/okxus.js +39 -0
  100. package/js/src/probit.js +18 -51
  101. package/js/src/timex.js +5 -10
  102. package/js/src/vertex.js +3 -4
  103. package/js/src/whitebit.js +42 -11
  104. package/js/src/woo.d.ts +2 -0
  105. package/js/src/woo.js +101 -77
  106. package/js/src/woofipro.d.ts +2 -1
  107. package/js/src/woofipro.js +24 -21
  108. package/js/src/xt.js +36 -44
  109. package/package.json +1 -1
  110. package/js/src/abstract/kuna.d.ts +0 -185
  111. package/js/src/kuna.d.ts +0 -335
  112. package/js/src/kuna.js +0 -2006
  113. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  114. /package/js/src/abstract/{huobijp.js → bittrade.js} +0 -0
  115. /package/js/src/abstract/{kuna.js → modetrade.js} +0 -0
@@ -452,45 +452,45 @@ class ndax extends ndax$1 {
452
452
  };
453
453
  const response = await this.publicGetGetProducts(this.extend(request, params));
454
454
  //
455
- // [
456
- // {
457
- // "OMSId":1,
458
- // "ProductId":1,
459
- // "Product":"BTC",
460
- // "ProductFullName":"Bitcoin",
461
- // "ProductType":"CryptoCurrency",
462
- // "DecimalPlaces":8,
463
- // "TickSize":0.0000000100000000000000000000,
464
- // "NoFees":false,
465
- // "IsDisabled":false,
466
- // "MarginEnabled":false
467
- // },
468
- // ]
455
+ // [
456
+ // {
457
+ // "OMSId": "1",
458
+ // "ProductId": "1",
459
+ // "Product": "BTC",
460
+ // "ProductFullName": "Bitcoin",
461
+ // "MasterDataUniqueProductSymbol": "",
462
+ // "ProductType": "CryptoCurrency",
463
+ // "DecimalPlaces": "8",
464
+ // "TickSize": "0.0000000100000000000000000000",
465
+ // "DepositEnabled": true,
466
+ // "WithdrawEnabled": true,
467
+ // "NoFees": false,
468
+ // "IsDisabled": false,
469
+ // "MarginEnabled": false
470
+ // },
471
+ // ...
469
472
  //
470
473
  const result = {};
471
474
  for (let i = 0; i < response.length; i++) {
472
475
  const currency = response[i];
473
476
  const id = this.safeString(currency, 'ProductId');
474
- const name = this.safeString(currency, 'ProductFullName');
477
+ const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
475
478
  const ProductType = this.safeString(currency, 'ProductType');
476
479
  let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
477
480
  if (ProductType === 'Unknown') {
478
481
  // such currency is just a blanket entry
479
482
  type = 'other';
480
483
  }
481
- const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
482
- const isDisabled = this.safeValue(currency, 'IsDisabled');
483
- const active = !isDisabled;
484
- result[code] = {
484
+ result[code] = this.safeCurrencyStructure({
485
485
  'id': id,
486
- 'name': name,
486
+ 'name': this.safeString(currency, 'ProductFullName'),
487
487
  'code': code,
488
488
  'type': type,
489
489
  'precision': this.safeNumber(currency, 'TickSize'),
490
490
  'info': currency,
491
- 'active': active,
492
- 'deposit': undefined,
493
- 'withdraw': undefined,
491
+ 'active': !this.safeBool(currency, 'IsDisabled'),
492
+ 'deposit': this.safeBool(currency, 'DepositEnabled'),
493
+ 'withdraw': this.safeBool(currency, 'WithdrawEnabled'),
494
494
  'fee': undefined,
495
495
  'limits': {
496
496
  'amount': {
@@ -503,7 +503,8 @@ class ndax extends ndax$1 {
503
503
  },
504
504
  },
505
505
  'networks': {},
506
- };
506
+ 'margin': this.safeBool(currency, 'MarginEnabled'),
507
+ });
507
508
  }
508
509
  return result;
509
510
  }
@@ -826,49 +826,30 @@ class okcoin extends okcoin$1 {
826
826
  }
827
827
  else {
828
828
  const response = await this.privateGetAssetCurrencies(params);
829
- const data = this.safeValue(response, 'data', []);
829
+ const data = this.safeList(response, 'data', []);
830
830
  const result = {};
831
831
  const dataByCurrencyId = this.groupBy(data, 'ccy');
832
832
  const currencyIds = Object.keys(dataByCurrencyId);
833
833
  for (let i = 0; i < currencyIds.length; i++) {
834
834
  const currencyId = currencyIds[i];
835
- const currency = this.safeCurrency(currencyId);
836
- const code = currency['code'];
835
+ const code = this.safeCurrencyCode(currencyId);
837
836
  const chains = dataByCurrencyId[currencyId];
838
837
  const networks = {};
839
- let currencyActive = false;
840
- let depositEnabled = false;
841
- let withdrawEnabled = false;
842
- let maxPrecision = undefined;
843
838
  for (let j = 0; j < chains.length; j++) {
844
839
  const chain = chains[j];
845
- const canDeposit = this.safeValue(chain, 'canDep');
846
- depositEnabled = (canDeposit) ? canDeposit : depositEnabled;
847
- const canWithdraw = this.safeValue(chain, 'canWd');
848
- withdrawEnabled = (canWithdraw) ? canWithdraw : withdrawEnabled;
849
- const canInternal = this.safeValue(chain, 'canInternal');
850
- const active = (canDeposit && canWithdraw && canInternal) ? true : false;
851
- currencyActive = (active) ? active : currencyActive;
852
840
  const networkId = this.safeString(chain, 'chain');
853
841
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
854
842
  const parts = networkId.split('-');
855
843
  const chainPart = this.safeString(parts, 1, networkId);
856
844
  const networkCode = this.networkIdToCode(chainPart);
857
- const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
858
- if (maxPrecision === undefined) {
859
- maxPrecision = precision;
860
- }
861
- else {
862
- maxPrecision = Precise["default"].stringMin(maxPrecision, precision);
863
- }
864
845
  networks[networkCode] = {
865
846
  'id': networkId,
866
847
  'network': networkCode,
867
- 'active': active,
868
- 'deposit': canDeposit,
869
- 'withdraw': canWithdraw,
848
+ 'active': undefined,
849
+ 'deposit': this.safeBool(chain, 'canDep'),
850
+ 'withdraw': this.safeBool(chain, 'canWd'),
870
851
  'fee': this.safeNumber(chain, 'minFee'),
871
- 'precision': this.parseNumber(precision),
852
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'wdTickSz'))),
872
853
  'limits': {
873
854
  'withdraw': {
874
855
  'min': this.safeNumber(chain, 'minWd'),
@@ -880,16 +861,16 @@ class okcoin extends okcoin$1 {
880
861
  }
881
862
  }
882
863
  const firstChain = this.safeValue(chains, 0);
883
- result[code] = {
864
+ result[code] = this.safeCurrencyStructure({
884
865
  'info': chains,
885
866
  'code': code,
886
867
  'id': currencyId,
887
868
  'name': this.safeString(firstChain, 'name'),
888
- 'active': currencyActive,
889
- 'deposit': depositEnabled,
890
- 'withdraw': withdrawEnabled,
869
+ 'active': undefined,
870
+ 'deposit': undefined,
871
+ 'withdraw': undefined,
891
872
  'fee': undefined,
892
- 'precision': this.parseNumber(maxPrecision),
873
+ 'precision': undefined,
893
874
  'limits': {
894
875
  'amount': {
895
876
  'min': undefined,
@@ -897,7 +878,7 @@ class okcoin extends okcoin$1 {
897
878
  },
898
879
  },
899
880
  'networks': networks,
900
- };
881
+ });
901
882
  }
902
883
  return result;
903
884
  }
@@ -83,7 +83,7 @@ class okx extends okx$1 {
83
83
  'fetchFundingIntervals': false,
84
84
  'fetchFundingRate': true,
85
85
  'fetchFundingRateHistory': true,
86
- 'fetchFundingRates': false,
86
+ 'fetchFundingRates': true,
87
87
  'fetchGreeks': true,
88
88
  'fetchIndexOHLCV': true,
89
89
  'fetchIsolatedBorrowRate': false,
@@ -106,6 +106,7 @@ class okx extends okx$1 {
106
106
  'fetchOHLCV': true,
107
107
  'fetchOpenInterest': true,
108
108
  'fetchOpenInterestHistory': true,
109
+ 'fetchOpenInterests': true,
109
110
  'fetchOpenOrder': undefined,
110
111
  'fetchOpenOrders': true,
111
112
  'fetchOption': true,
@@ -363,6 +364,7 @@ class okx extends okx$1 {
363
364
  'account/spot-manual-borrow-repay': 10,
364
365
  'account/set-auto-repay': 4,
365
366
  'account/spot-borrow-repay-history': 4,
367
+ 'account/move-positions-history': 10,
366
368
  // subaccount
367
369
  'users/subaccount/list': 10,
368
370
  'account/subaccount/balances': 10 / 3,
@@ -500,6 +502,7 @@ class okx extends okx$1 {
500
502
  'account/fixed-loan/manual-reborrow': 5,
501
503
  'account/fixed-loan/repay-borrowing-order': 5,
502
504
  'account/bills-history-archive': 72000,
505
+ 'account/move-positions': 10,
503
506
  // subaccount
504
507
  'users/subaccount/modify-apikey': 10,
505
508
  'asset/subaccount/transfer': 10,
@@ -966,6 +969,13 @@ class okx extends okx$1 {
966
969
  '70010': errors.BadRequest,
967
970
  '70013': errors.BadRequest,
968
971
  '70016': errors.BadRequest,
972
+ '70060': errors.BadRequest,
973
+ '70061': errors.BadRequest,
974
+ '70062': errors.BadRequest,
975
+ '70064': errors.BadRequest,
976
+ '70065': errors.BadRequest,
977
+ '70066': errors.BadRequest,
978
+ '70067': errors.BadRequest,
969
979
  '1009': errors.BadRequest,
970
980
  '4001': errors.AuthenticationError,
971
981
  '4002': errors.BadRequest,
@@ -6288,7 +6298,7 @@ class okx extends okx$1 {
6288
6298
  const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
6289
6299
  const fundingTime = this.safeInteger(contract, 'fundingTime');
6290
6300
  const fundingTimeString = this.safeString(contract, 'fundingTime');
6291
- const nextFundingTimeString = this.safeString(contract, 'nextFundingRate');
6301
+ const nextFundingTimeString = this.safeString(contract, 'nextFundingTime');
6292
6302
  const millisecondsInterval = Precise["default"].stringSub(nextFundingTimeString, fundingTimeString);
6293
6303
  // https://www.okx.com/support/hc/en-us/articles/360053909272-Ⅸ-Introduction-to-perpetual-swap-funding-fee
6294
6304
  // > The current interest is 0.
@@ -6374,6 +6384,39 @@ class okx extends okx$1 {
6374
6384
  const entry = this.safeDict(data, 0, {});
6375
6385
  return this.parseFundingRate(entry, market);
6376
6386
  }
6387
+ /**
6388
+ * @method
6389
+ * @name okx#fetchFundingRates
6390
+ * @description fetches the current funding rates for multiple symbols
6391
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
6392
+ * @param {string[]} symbols unified market symbols
6393
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6394
+ * @returns {object} a dictionary of [funding rates structure]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}
6395
+ */
6396
+ async fetchFundingRates(symbols = undefined, params = {}) {
6397
+ await this.loadMarkets();
6398
+ symbols = this.marketSymbols(symbols, 'swap', true);
6399
+ const request = { 'instId': 'ANY' };
6400
+ const response = await this.publicGetPublicFundingRate(this.extend(request, params));
6401
+ //
6402
+ // {
6403
+ // "code": "0",
6404
+ // "data": [
6405
+ // {
6406
+ // "fundingRate": "0.00027815",
6407
+ // "fundingTime": "1634256000000",
6408
+ // "instId": "BTC-USD-SWAP",
6409
+ // "instType": "SWAP",
6410
+ // "nextFundingRate": "0.00017",
6411
+ // "nextFundingTime": "1634284800000"
6412
+ // }
6413
+ // ],
6414
+ // "msg": ""
6415
+ // }
6416
+ //
6417
+ const data = this.safeList(response, 'data', []);
6418
+ return this.parseFundingRates(data, symbols);
6419
+ }
6377
6420
  /**
6378
6421
  * @method
6379
6422
  * @name okx#fetchFundingHistory
@@ -7378,6 +7421,65 @@ class okx extends okx$1 {
7378
7421
  const data = this.safeList(response, 'data', []);
7379
7422
  return this.parseOpenInterest(data[0], market);
7380
7423
  }
7424
+ /**
7425
+ * @method
7426
+ * @name okx#fetchOpenInterests
7427
+ * @description Retrieves the open interests of some currencies
7428
+ * @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
7429
+ * @param {string[]} symbols Unified CCXT market symbols
7430
+ * @param {object} [params] exchange specific parameters
7431
+ * @param {string} params.instType Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP'
7432
+ * @param {string} params.uly Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
7433
+ * @param {string} params.instFamily Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
7434
+ * @returns {object} an dictionary of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
7435
+ */
7436
+ async fetchOpenInterests(symbols = undefined, params = {}) {
7437
+ await this.loadMarkets();
7438
+ symbols = this.marketSymbols(symbols, undefined, true, true);
7439
+ let market = undefined;
7440
+ if (symbols !== undefined) {
7441
+ market = this.market(symbols[0]);
7442
+ }
7443
+ let marketType = undefined;
7444
+ [marketType, params] = this.handleSubTypeAndParams('fetchOpenInterests', market, params, 'swap');
7445
+ let instType = 'SWAP';
7446
+ if (marketType === 'future') {
7447
+ instType = 'FUTURES';
7448
+ }
7449
+ else if (instType === 'option') {
7450
+ instType = 'OPTION';
7451
+ }
7452
+ const request = { 'instType': instType };
7453
+ const uly = this.safeString(params, 'uly');
7454
+ if (uly !== undefined) {
7455
+ request['uly'] = uly;
7456
+ }
7457
+ const instFamily = this.safeString(params, 'instFamily');
7458
+ if (instFamily !== undefined) {
7459
+ request['instFamily'] = instFamily;
7460
+ }
7461
+ if (instType === 'OPTION' && uly === undefined && instFamily === undefined) {
7462
+ throw new errors.BadRequest(this.id + ' fetchOpenInterests() requires either uly or instFamily parameter for OPTION markets');
7463
+ }
7464
+ const response = await this.publicGetPublicOpenInterest(this.extend(request, params));
7465
+ //
7466
+ // {
7467
+ // "code": "0",
7468
+ // "data": [
7469
+ // {
7470
+ // "instId": "BTC-USDT-SWAP",
7471
+ // "instType": "SWAP",
7472
+ // "oi": "2125419",
7473
+ // "oiCcy": "21254.19",
7474
+ // "ts": "1664005108969"
7475
+ // }
7476
+ // ],
7477
+ // "msg": ""
7478
+ // }
7479
+ //
7480
+ const data = this.safeList(response, 'data', []);
7481
+ return this.parseOpenInterests(data, symbols);
7482
+ }
7381
7483
  /**
7382
7484
  * @method
7383
7485
  * @name okx#fetchOpenInterestHistory
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var okx = require('./okx.js');
4
+
5
+ // ----------------------------------------------------------------------------
6
+ // ---------------------------------------------------------------------------
7
+ class okxus extends okx {
8
+ describe() {
9
+ return this.deepExtend(super.describe(), {
10
+ 'id': 'okxus',
11
+ 'name': 'OKX (US)',
12
+ 'certified': false,
13
+ 'pro': true,
14
+ 'hostname': 'us.okx.com',
15
+ 'urls': {
16
+ 'logo': 'https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg',
17
+ 'api': {
18
+ 'rest': 'https://{hostname}',
19
+ },
20
+ 'www': 'https://app.okx.com',
21
+ 'doc': 'https://app.okx.com/docs-v5/en/#overview',
22
+ 'fees': 'https://app.okx.com/pages/products/fees.html',
23
+ 'referral': {
24
+ 'url': 'https://www.app.okx.com/join/CCXT2023',
25
+ 'discount': 0.2,
26
+ },
27
+ 'test': {
28
+ 'rest': 'https://{hostname}',
29
+ },
30
+ },
31
+ 'has': {
32
+ 'CORS': undefined,
33
+ 'spot': true,
34
+ 'margin': undefined,
35
+ 'swap': false,
36
+ 'future': false,
37
+ 'option': false,
38
+ },
39
+ 'features': {
40
+ 'swap': {
41
+ 'linear': undefined,
42
+ 'inverse': undefined,
43
+ },
44
+ 'future': {
45
+ 'linear': undefined,
46
+ 'inverse': undefined,
47
+ },
48
+ },
49
+ });
50
+ }
51
+ }
52
+
53
+ module.exports = okxus;
@@ -392,9 +392,12 @@ class onetrading extends onetrading$1 {
392
392
  //
393
393
  // [
394
394
  // {
395
- // "code":"BEST",
396
- // "precision":8
397
- // }
395
+ // "code": "USDT",
396
+ // "precision": 6,
397
+ // "unified_cryptoasset_id": 825,
398
+ // "name": "Tether USDt",
399
+ // "collateral_percentage": 0
400
+ // },
398
401
  // ]
399
402
  //
400
403
  const result = {};
@@ -402,10 +405,10 @@ class onetrading extends onetrading$1 {
402
405
  const currency = response[i];
403
406
  const id = this.safeString(currency, 'code');
404
407
  const code = this.safeCurrencyCode(id);
405
- result[code] = {
408
+ result[code] = this.safeCurrencyStructure({
406
409
  'id': id,
407
410
  'code': code,
408
- 'name': undefined,
411
+ 'name': this.safeString(currency, 'name'),
409
412
  'info': currency,
410
413
  'active': undefined,
411
414
  'fee': undefined,
@@ -417,7 +420,7 @@ class onetrading extends onetrading$1 {
417
420
  'withdraw': { 'min': undefined, 'max': undefined },
418
421
  },
419
422
  'networks': {},
420
- };
423
+ });
421
424
  }
422
425
  return result;
423
426
  }
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var oxfun$1 = require('./abstract/oxfun.js');
4
- var Precise = require('./base/Precise.js');
5
4
  var errors = require('./base/errors.js');
6
5
  var number = require('./base/functions/number.js');
7
6
  var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
@@ -599,66 +598,7 @@ class oxfun extends oxfun$1 {
599
598
  // "minDeposit": "0.00010",
600
599
  // "minWithdrawal": "0.00010"
601
600
  // },
602
- // {
603
- // "network": "Arbitrum",
604
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
605
- // "transactionPrecision": "18",
606
- // "isWithdrawalFeeChargedToUser": true,
607
- // "canDeposit": true,
608
- // "canWithdraw": true,
609
- // "minDeposit": "0.00010",
610
- // "minWithdrawal": "0.00010"
611
- // },
612
- // {
613
- // "network": "Ethereum",
614
- // "tokenId": "0xba0Dda8762C24dA9487f5FA026a9B64b695A07Ea",
615
- // "transactionPrecision": "18",
616
- // "isWithdrawalFeeChargedToUser": true,
617
- // "canDeposit": true,
618
- // "canWithdraw": true,
619
- // "minDeposit": "0.00010",
620
- // "minWithdrawal": "0.00010"
621
- // },
622
- // {
623
- // "network": "Arbitrum",
624
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
625
- // "transactionPrecision": "18",
626
- // "isWithdrawalFeeChargedToUser": true,
627
- // "canDeposit": true,
628
- // "canWithdraw": false,
629
- // "minDeposit": "0.00010",
630
- // "minWithdrawal": "0.00010"
631
- // },
632
- // {
633
- // "network": "Avalanche",
634
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
635
- // "transactionPrecision": "18",
636
- // "isWithdrawalFeeChargedToUser": true,
637
- // "canDeposit": true,
638
- // "canWithdraw": false,
639
- // "minDeposit": "0.00010",
640
- // "minWithdrawal": "0.00010"
641
- // },
642
- // {
643
- // "network": "Solana",
644
- // "tokenId": "DV3845GEAVXfwpyVGGgWbqBVCtzHdCXNCGfcdboSEuZz",
645
- // "transactionPrecision": "8",
646
- // "isWithdrawalFeeChargedToUser": true,
647
- // "canDeposit": true,
648
- // "canWithdraw": true,
649
- // "minDeposit": "0.00010",
650
- // "minWithdrawal": "0.00010"
651
- // },
652
- // {
653
- // "network": "Ethereum",
654
- // "tokenId": "0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f",
655
- // "transactionPrecision": "18",
656
- // "isWithdrawalFeeChargedToUser": true,
657
- // "canDeposit": true,
658
- // "canWithdraw": false,
659
- // "minDeposit": "0.00010",
660
- // "minWithdrawal": "0.00010"
661
- // }
601
+ // ...
662
602
  // ]
663
603
  // },
664
604
  // {
@@ -708,79 +648,67 @@ class oxfun extends oxfun$1 {
708
648
  const parts = fullId.split('.');
709
649
  const id = parts[0];
710
650
  const code = this.safeCurrencyCode(id);
711
- let networks = {};
651
+ if (!(code in result)) {
652
+ result[code] = {
653
+ 'id': id,
654
+ 'code': code,
655
+ 'precision': undefined,
656
+ 'type': undefined,
657
+ 'name': undefined,
658
+ 'active': undefined,
659
+ 'deposit': undefined,
660
+ 'withdraw': undefined,
661
+ 'fee': undefined,
662
+ 'limits': {
663
+ 'withdraw': {
664
+ 'min': undefined,
665
+ 'max': undefined,
666
+ },
667
+ 'deposit': {
668
+ 'min': undefined,
669
+ 'max': undefined,
670
+ },
671
+ },
672
+ 'networks': {},
673
+ 'info': [],
674
+ };
675
+ }
712
676
  const chains = this.safeList(currency, 'networkList', []);
713
- let currencyMaxPrecision = undefined;
714
- let currencyDepositEnabled = undefined;
715
- let currencyWithdrawEnabled = undefined;
716
677
  for (let j = 0; j < chains.length; j++) {
717
678
  const chain = chains[j];
718
679
  const networkId = this.safeString(chain, 'network');
719
680
  const networkCode = this.networkIdToCode(networkId);
720
- const deposit = this.safeBool(chain, 'canDeposit');
721
- const withdraw = this.safeBool(chain, 'canWithdraw');
722
- const active = (deposit && withdraw);
723
- const minDeposit = this.safeString(chain, 'minDeposit');
724
- const minWithdrawal = this.safeString(chain, 'minWithdrawal');
725
- const precision = this.parsePrecision(this.safeString(chain, 'transactionPrecision'));
726
- networks[networkCode] = {
681
+ result[code]['networks'][networkCode] = {
727
682
  'id': networkId,
728
683
  'network': networkCode,
729
684
  'margin': undefined,
730
- 'deposit': deposit,
731
- 'withdraw': withdraw,
732
- 'active': active,
685
+ 'deposit': this.safeBool(chain, 'canDeposit'),
686
+ 'withdraw': this.safeBool(chain, 'canWithdraw'),
687
+ 'active': undefined,
733
688
  'fee': undefined,
734
- 'precision': this.parseNumber(precision),
689
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'transactionPrecision'))),
735
690
  'limits': {
736
691
  'deposit': {
737
- 'min': minDeposit,
692
+ 'min': this.safeNumber(chain, 'minDeposit'),
738
693
  'max': undefined,
739
694
  },
740
695
  'withdraw': {
741
- 'min': minWithdrawal,
696
+ 'min': this.safeNumber(chain, 'minWithdrawal'),
742
697
  'max': undefined,
743
698
  },
744
699
  },
745
700
  'info': chain,
746
701
  };
747
- if ((currencyDepositEnabled === undefined) || deposit) {
748
- currencyDepositEnabled = deposit;
749
- }
750
- if ((currencyWithdrawEnabled === undefined) || withdraw) {
751
- currencyWithdrawEnabled = withdraw;
752
- }
753
- if ((currencyMaxPrecision === undefined) || Precise["default"].stringGt(currencyMaxPrecision, precision)) {
754
- currencyMaxPrecision = precision;
755
- }
756
- }
757
- if (code in result) {
758
- // checking for specific ids as USDC.ARB
759
- networks = this.extend(result[code]['networks'], networks);
760
702
  }
761
- result[code] = {
762
- 'id': id,
763
- 'code': code,
764
- 'name': undefined,
765
- 'type': undefined,
766
- 'active': undefined,
767
- 'deposit': currencyDepositEnabled,
768
- 'withdraw': currencyWithdrawEnabled,
769
- 'fee': undefined,
770
- 'precision': this.parseNumber(currencyMaxPrecision),
771
- 'limits': {
772
- 'amount': {
773
- 'min': undefined,
774
- 'max': undefined,
775
- },
776
- 'withdraw': {
777
- 'min': undefined,
778
- 'max': undefined,
779
- },
780
- },
781
- 'networks': networks,
782
- 'info': currency,
783
- };
703
+ const infos = this.safeList(result[code], 'info', []);
704
+ infos.push(currency);
705
+ result[code]['info'] = infos;
706
+ }
707
+ // only after all entries are formed in currencies, restructure each entry
708
+ const allKeys = Object.keys(result);
709
+ for (let i = 0; i < allKeys.length; i++) {
710
+ const code = allKeys[i];
711
+ result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
784
712
  }
785
713
  return result;
786
714
  }
@@ -1257,7 +1257,16 @@ class paradex extends paradex$1 {
1257
1257
  const price = this.safeString(order, 'price');
1258
1258
  const amount = this.safeString(order, 'size');
1259
1259
  const orderType = this.safeString(order, 'type');
1260
- const status = this.safeString(order, 'status');
1260
+ const cancelReason = this.safeString(order, 'cancel_reason');
1261
+ let status = this.safeString(order, 'status');
1262
+ if (cancelReason !== undefined) {
1263
+ if (cancelReason === 'NOT_ENOUGH_MARGIN') {
1264
+ status = 'rejected';
1265
+ }
1266
+ else {
1267
+ status = 'canceled';
1268
+ }
1269
+ }
1261
1270
  const side = this.safeStringLower(order, 'side');
1262
1271
  const average = this.omitZero(this.safeString(order, 'avg_fill_price'));
1263
1272
  const remaining = this.omitZero(this.safeString(order, 'remaining_size'));