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
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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/okx.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry, FundingRate, DepositAddress, LongShortRatio, BorrowInterest } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest, OpenInterests } from './base/types.js';
3
3
  /**
4
4
  * @class okx
5
5
  * @augments Exchange
@@ -644,6 +644,16 @@ export default class okx extends Exchange {
644
644
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
645
645
  */
646
646
  fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
647
+ /**
648
+ * @method
649
+ * @name okx#fetchFundingRates
650
+ * @description fetches the current funding rates for multiple symbols
651
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
652
+ * @param {string[]} symbols unified market symbols
653
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
654
+ * @returns {object} a dictionary of [funding rates structure]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}
655
+ */
656
+ fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
647
657
  /**
648
658
  * @method
649
659
  * @name okx#fetchFundingHistory
@@ -868,6 +878,19 @@ export default class okx extends Exchange {
868
878
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
869
879
  */
870
880
  fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
881
+ /**
882
+ * @method
883
+ * @name okx#fetchOpenInterests
884
+ * @description Retrieves the open interests of some currencies
885
+ * @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
886
+ * @param {string[]} symbols Unified CCXT market symbols
887
+ * @param {object} [params] exchange specific parameters
888
+ * @param {string} params.instType Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP'
889
+ * @param {string} params.uly Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
890
+ * @param {string} params.instFamily Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
891
+ * @returns {object} an dictionary of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
892
+ */
893
+ fetchOpenInterests(symbols?: Strings, params?: {}): Promise<OpenInterests>;
871
894
  /**
872
895
  * @method
873
896
  * @name okx#fetchOpenInterestHistory
package/js/src/okx.js CHANGED
@@ -86,7 +86,7 @@ export default class okx extends Exchange {
86
86
  'fetchFundingIntervals': false,
87
87
  'fetchFundingRate': true,
88
88
  'fetchFundingRateHistory': true,
89
- 'fetchFundingRates': false,
89
+ 'fetchFundingRates': true,
90
90
  'fetchGreeks': true,
91
91
  'fetchIndexOHLCV': true,
92
92
  'fetchIsolatedBorrowRate': false,
@@ -109,6 +109,7 @@ export default class okx extends Exchange {
109
109
  'fetchOHLCV': true,
110
110
  'fetchOpenInterest': true,
111
111
  'fetchOpenInterestHistory': true,
112
+ 'fetchOpenInterests': true,
112
113
  'fetchOpenOrder': undefined,
113
114
  'fetchOpenOrders': true,
114
115
  'fetchOption': true,
@@ -366,6 +367,7 @@ export default class okx extends Exchange {
366
367
  'account/spot-manual-borrow-repay': 10,
367
368
  'account/set-auto-repay': 4,
368
369
  'account/spot-borrow-repay-history': 4,
370
+ 'account/move-positions-history': 10,
369
371
  // subaccount
370
372
  'users/subaccount/list': 10,
371
373
  'account/subaccount/balances': 10 / 3,
@@ -503,6 +505,7 @@ export default class okx extends Exchange {
503
505
  'account/fixed-loan/manual-reborrow': 5,
504
506
  'account/fixed-loan/repay-borrowing-order': 5,
505
507
  'account/bills-history-archive': 72000,
508
+ 'account/move-positions': 10,
506
509
  // subaccount
507
510
  'users/subaccount/modify-apikey': 10,
508
511
  'asset/subaccount/transfer': 10,
@@ -969,6 +972,13 @@ export default class okx extends Exchange {
969
972
  '70010': BadRequest,
970
973
  '70013': BadRequest,
971
974
  '70016': BadRequest,
975
+ '70060': BadRequest,
976
+ '70061': BadRequest,
977
+ '70062': BadRequest,
978
+ '70064': BadRequest,
979
+ '70065': BadRequest,
980
+ '70066': BadRequest,
981
+ '70067': BadRequest,
972
982
  '1009': BadRequest,
973
983
  '4001': AuthenticationError,
974
984
  '4002': BadRequest,
@@ -6291,7 +6301,7 @@ export default class okx extends Exchange {
6291
6301
  const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
6292
6302
  const fundingTime = this.safeInteger(contract, 'fundingTime');
6293
6303
  const fundingTimeString = this.safeString(contract, 'fundingTime');
6294
- const nextFundingTimeString = this.safeString(contract, 'nextFundingRate');
6304
+ const nextFundingTimeString = this.safeString(contract, 'nextFundingTime');
6295
6305
  const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
6296
6306
  // https://www.okx.com/support/hc/en-us/articles/360053909272-Ⅸ-Introduction-to-perpetual-swap-funding-fee
6297
6307
  // > The current interest is 0.
@@ -6377,6 +6387,39 @@ export default class okx extends Exchange {
6377
6387
  const entry = this.safeDict(data, 0, {});
6378
6388
  return this.parseFundingRate(entry, market);
6379
6389
  }
6390
+ /**
6391
+ * @method
6392
+ * @name okx#fetchFundingRates
6393
+ * @description fetches the current funding rates for multiple symbols
6394
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
6395
+ * @param {string[]} symbols unified market symbols
6396
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6397
+ * @returns {object} a dictionary of [funding rates structure]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}
6398
+ */
6399
+ async fetchFundingRates(symbols = undefined, params = {}) {
6400
+ await this.loadMarkets();
6401
+ symbols = this.marketSymbols(symbols, 'swap', true);
6402
+ const request = { 'instId': 'ANY' };
6403
+ const response = await this.publicGetPublicFundingRate(this.extend(request, params));
6404
+ //
6405
+ // {
6406
+ // "code": "0",
6407
+ // "data": [
6408
+ // {
6409
+ // "fundingRate": "0.00027815",
6410
+ // "fundingTime": "1634256000000",
6411
+ // "instId": "BTC-USD-SWAP",
6412
+ // "instType": "SWAP",
6413
+ // "nextFundingRate": "0.00017",
6414
+ // "nextFundingTime": "1634284800000"
6415
+ // }
6416
+ // ],
6417
+ // "msg": ""
6418
+ // }
6419
+ //
6420
+ const data = this.safeList(response, 'data', []);
6421
+ return this.parseFundingRates(data, symbols);
6422
+ }
6380
6423
  /**
6381
6424
  * @method
6382
6425
  * @name okx#fetchFundingHistory
@@ -7381,6 +7424,65 @@ export default class okx extends Exchange {
7381
7424
  const data = this.safeList(response, 'data', []);
7382
7425
  return this.parseOpenInterest(data[0], market);
7383
7426
  }
7427
+ /**
7428
+ * @method
7429
+ * @name okx#fetchOpenInterests
7430
+ * @description Retrieves the open interests of some currencies
7431
+ * @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
7432
+ * @param {string[]} symbols Unified CCXT market symbols
7433
+ * @param {object} [params] exchange specific parameters
7434
+ * @param {string} params.instType Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP'
7435
+ * @param {string} params.uly Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
7436
+ * @param {string} params.instFamily Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required
7437
+ * @returns {object} an dictionary of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
7438
+ */
7439
+ async fetchOpenInterests(symbols = undefined, params = {}) {
7440
+ await this.loadMarkets();
7441
+ symbols = this.marketSymbols(symbols, undefined, true, true);
7442
+ let market = undefined;
7443
+ if (symbols !== undefined) {
7444
+ market = this.market(symbols[0]);
7445
+ }
7446
+ let marketType = undefined;
7447
+ [marketType, params] = this.handleSubTypeAndParams('fetchOpenInterests', market, params, 'swap');
7448
+ let instType = 'SWAP';
7449
+ if (marketType === 'future') {
7450
+ instType = 'FUTURES';
7451
+ }
7452
+ else if (instType === 'option') {
7453
+ instType = 'OPTION';
7454
+ }
7455
+ const request = { 'instType': instType };
7456
+ const uly = this.safeString(params, 'uly');
7457
+ if (uly !== undefined) {
7458
+ request['uly'] = uly;
7459
+ }
7460
+ const instFamily = this.safeString(params, 'instFamily');
7461
+ if (instFamily !== undefined) {
7462
+ request['instFamily'] = instFamily;
7463
+ }
7464
+ if (instType === 'OPTION' && uly === undefined && instFamily === undefined) {
7465
+ throw new BadRequest(this.id + ' fetchOpenInterests() requires either uly or instFamily parameter for OPTION markets');
7466
+ }
7467
+ const response = await this.publicGetPublicOpenInterest(this.extend(request, params));
7468
+ //
7469
+ // {
7470
+ // "code": "0",
7471
+ // "data": [
7472
+ // {
7473
+ // "instId": "BTC-USDT-SWAP",
7474
+ // "instType": "SWAP",
7475
+ // "oi": "2125419",
7476
+ // "oiCcy": "21254.19",
7477
+ // "ts": "1664005108969"
7478
+ // }
7479
+ // ],
7480
+ // "msg": ""
7481
+ // }
7482
+ //
7483
+ const data = this.safeList(response, 'data', []);
7484
+ return this.parseOpenInterests(data, symbols);
7485
+ }
7384
7486
  /**
7385
7487
  * @method
7386
7488
  * @name okx#fetchOpenInterestHistory
@@ -0,0 +1,4 @@
1
+ import okx from './okx.js';
2
+ export default class okxus extends okx {
3
+ describe(): any;
4
+ }
@@ -0,0 +1,54 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // ---------------------------------------------------------------------------
8
+ import okx from './okx.js';
9
+ // ---------------------------------------------------------------------------
10
+ export default class okxus extends okx {
11
+ describe() {
12
+ return this.deepExtend(super.describe(), {
13
+ 'id': 'okxus',
14
+ 'name': 'OKX (US)',
15
+ 'certified': false,
16
+ 'pro': true,
17
+ 'hostname': 'us.okx.com',
18
+ 'urls': {
19
+ 'logo': 'https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg',
20
+ 'api': {
21
+ 'rest': 'https://{hostname}',
22
+ },
23
+ 'www': 'https://app.okx.com',
24
+ 'doc': 'https://app.okx.com/docs-v5/en/#overview',
25
+ 'fees': 'https://app.okx.com/pages/products/fees.html',
26
+ 'referral': {
27
+ 'url': 'https://www.app.okx.com/join/CCXT2023',
28
+ 'discount': 0.2,
29
+ },
30
+ 'test': {
31
+ 'rest': 'https://{hostname}',
32
+ },
33
+ },
34
+ 'has': {
35
+ 'CORS': undefined,
36
+ 'spot': true,
37
+ 'margin': undefined,
38
+ 'swap': false,
39
+ 'future': false,
40
+ 'option': false,
41
+ },
42
+ 'features': {
43
+ 'swap': {
44
+ 'linear': undefined,
45
+ 'inverse': undefined,
46
+ },
47
+ 'future': {
48
+ 'linear': undefined,
49
+ 'inverse': undefined,
50
+ },
51
+ },
52
+ });
53
+ }
54
+ }
@@ -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
  }