ccxt 4.0.87 → 4.0.89

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.
package/js/src/okx.js CHANGED
@@ -110,6 +110,7 @@ export default class okx extends Exchange {
110
110
  'fetchTransactions': false,
111
111
  'fetchTransfer': true,
112
112
  'fetchTransfers': true,
113
+ 'fetchUnderlyingAssets': true,
113
114
  'fetchVolatilityHistory': false,
114
115
  'fetchWithdrawal': true,
115
116
  'fetchWithdrawals': true,
@@ -6703,6 +6704,44 @@ export default class okx extends Exchange {
6703
6704
  }
6704
6705
  return result;
6705
6706
  }
6707
+ async fetchUnderlyingAssets(params = {}) {
6708
+ /**
6709
+ * @method
6710
+ * @name okx#fetchUnderlyingAssets
6711
+ * @description fetches the market ids of underlying assets for a specific contract market type
6712
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
6713
+ * @param {object} [params] exchange specific params
6714
+ * @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
6715
+ * @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
6716
+ */
6717
+ await this.loadMarkets();
6718
+ let marketType = undefined;
6719
+ [marketType, params] = this.handleMarketTypeAndParams('fetchUnderlyingAssets', undefined, params);
6720
+ if ((marketType === undefined) || (marketType === 'spot')) {
6721
+ marketType = 'option';
6722
+ }
6723
+ if ((marketType !== 'option') && (marketType !== 'swap') && (marketType !== 'future')) {
6724
+ throw new NotSupported(this.id + ' fetchUnderlyingAssets() supports contract markets only');
6725
+ }
6726
+ const request = {
6727
+ 'instType': this.convertToInstrumentType(marketType),
6728
+ };
6729
+ const response = await this.publicGetPublicUnderlying(this.extend(request, params));
6730
+ //
6731
+ // {
6732
+ // "code": "0",
6733
+ // "data": [
6734
+ // [
6735
+ // "BTC-USD",
6736
+ // "ETH-USD"
6737
+ // ]
6738
+ // ],
6739
+ // "msg": ""
6740
+ // }
6741
+ //
6742
+ const underlyings = this.safeValue(response, 'data', []);
6743
+ return underlyings[0];
6744
+ }
6706
6745
  handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
6707
6746
  if (!response) {
6708
6747
  return undefined; // fallback to default error handler
@@ -707,7 +707,7 @@ export default class bybit extends bybitRest {
707
707
  if (this.newUpdates) {
708
708
  limit = trades.getLimit(symbol, limit);
709
709
  }
710
- return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
710
+ return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
711
711
  }
712
712
  handleMyTrades(client, message) {
713
713
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.0.87",
3
+ "version": "4.0.89",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",