ccxt 4.2.80 → 4.2.81

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/dist/cjs/ccxt.js CHANGED
@@ -181,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
181
181
 
182
182
  //-----------------------------------------------------------------------------
183
183
  // this is updated by vss.js when building
184
- const version = '4.2.80';
184
+ const version = '4.2.81';
185
185
  Exchange["default"].ccxtVersion = version;
186
186
  const exchanges = {
187
187
  'ace': ace,
@@ -111,6 +111,8 @@ class binance extends binance$1 {
111
111
  'fetchOpenInterestHistory': true,
112
112
  'fetchOpenOrder': true,
113
113
  'fetchOpenOrders': true,
114
+ 'fetchOption': true,
115
+ 'fetchOptionChain': false,
114
116
  'fetchOrder': true,
115
117
  'fetchOrderBook': true,
116
118
  'fetchOrderBooks': false,
@@ -12408,6 +12410,94 @@ class binance extends binance$1 {
12408
12410
  'marginMode': isIsolated ? 'isolated' : 'cross',
12409
12411
  };
12410
12412
  }
12413
+ async fetchOption(symbol, params = {}) {
12414
+ /**
12415
+ * @method
12416
+ * @name binance#fetchOption
12417
+ * @description fetches option data that is commonly found in an option chain
12418
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics
12419
+ * @param {string} symbol unified market symbol
12420
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
12421
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
12422
+ */
12423
+ await this.loadMarkets();
12424
+ const market = this.market(symbol);
12425
+ const request = {
12426
+ 'symbol': market['id'],
12427
+ };
12428
+ const response = await this.eapiPublicGetTicker(this.extend(request, params));
12429
+ //
12430
+ // [
12431
+ // {
12432
+ // "symbol": "BTC-241227-80000-C",
12433
+ // "priceChange": "0",
12434
+ // "priceChangePercent": "0",
12435
+ // "lastPrice": "2750",
12436
+ // "lastQty": "0",
12437
+ // "open": "2750",
12438
+ // "high": "2750",
12439
+ // "low": "2750",
12440
+ // "volume": "0",
12441
+ // "amount": "0",
12442
+ // "bidPrice": "4880",
12443
+ // "askPrice": "0",
12444
+ // "openTime": 0,
12445
+ // "closeTime": 0,
12446
+ // "firstTradeId": 0,
12447
+ // "tradeCount": 0,
12448
+ // "strikePrice": "80000",
12449
+ // "exercisePrice": "63944.09893617"
12450
+ // }
12451
+ // ]
12452
+ //
12453
+ const chain = this.safeDict(response, 0, {});
12454
+ return this.parseOption(chain, undefined, market);
12455
+ }
12456
+ parseOption(chain, currency = undefined, market = undefined) {
12457
+ //
12458
+ // {
12459
+ // "symbol": "BTC-241227-80000-C",
12460
+ // "priceChange": "0",
12461
+ // "priceChangePercent": "0",
12462
+ // "lastPrice": "2750",
12463
+ // "lastQty": "0",
12464
+ // "open": "2750",
12465
+ // "high": "2750",
12466
+ // "low": "2750",
12467
+ // "volume": "0",
12468
+ // "amount": "0",
12469
+ // "bidPrice": "4880",
12470
+ // "askPrice": "0",
12471
+ // "openTime": 0,
12472
+ // "closeTime": 0,
12473
+ // "firstTradeId": 0,
12474
+ // "tradeCount": 0,
12475
+ // "strikePrice": "80000",
12476
+ // "exercisePrice": "63944.09893617"
12477
+ // }
12478
+ //
12479
+ const marketId = this.safeString(chain, 'symbol');
12480
+ market = this.safeMarket(marketId, market);
12481
+ return {
12482
+ 'info': chain,
12483
+ 'currency': undefined,
12484
+ 'symbol': market['symbol'],
12485
+ 'timestamp': undefined,
12486
+ 'datetime': undefined,
12487
+ 'impliedVolatility': undefined,
12488
+ 'openInterest': undefined,
12489
+ 'bidPrice': this.safeNumber(chain, 'bidPrice'),
12490
+ 'askPrice': this.safeNumber(chain, 'askPrice'),
12491
+ 'midPrice': undefined,
12492
+ 'markPrice': undefined,
12493
+ 'lastPrice': this.safeNumber(chain, 'lastPrice'),
12494
+ 'underlyingPrice': this.safeNumber(chain, 'exercisePrice'),
12495
+ 'change': this.safeNumber(chain, 'priceChange'),
12496
+ 'percentage': this.safeNumber(chain, 'priceChangePercent'),
12497
+ 'baseVolume': this.safeNumber(chain, 'volume'),
12498
+ 'quoteVolume': undefined,
12499
+ };
12500
+ }
12411
12501
  }
12412
12502
 
12413
12503
  module.exports = binance;
@@ -92,6 +92,8 @@ class bybit extends bybit$1 {
92
92
  'fetchOpenInterestHistory': true,
93
93
  'fetchOpenOrder': true,
94
94
  'fetchOpenOrders': true,
95
+ 'fetchOption': true,
96
+ 'fetchOptionChain': true,
95
97
  'fetchOrder': false,
96
98
  'fetchOrderBook': true,
97
99
  'fetchOrders': false,
@@ -8207,6 +8209,181 @@ class bybit extends bybit$1 {
8207
8209
  'rate': this.safeNumber(income, 'feeRate'),
8208
8210
  };
8209
8211
  }
8212
+ async fetchOption(symbol, params = {}) {
8213
+ /**
8214
+ * @method
8215
+ * @name bybit#fetchOption
8216
+ * @description fetches option data that is commonly found in an option chain
8217
+ * @see https://bybit-exchange.github.io/docs/v5/market/tickers
8218
+ * @param {string} symbol unified market symbol
8219
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8220
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
8221
+ */
8222
+ await this.loadMarkets();
8223
+ const market = this.market(symbol);
8224
+ const request = {
8225
+ 'category': 'option',
8226
+ 'symbol': market['id'],
8227
+ };
8228
+ const response = await this.publicGetV5MarketTickers(this.extend(request, params));
8229
+ //
8230
+ // {
8231
+ // "retCode": 0,
8232
+ // "retMsg": "SUCCESS",
8233
+ // "result": {
8234
+ // "category": "option",
8235
+ // "list": [
8236
+ // {
8237
+ // "symbol": "BTC-27DEC24-55000-P",
8238
+ // "bid1Price": "0",
8239
+ // "bid1Size": "0",
8240
+ // "bid1Iv": "0",
8241
+ // "ask1Price": "0",
8242
+ // "ask1Size": "0",
8243
+ // "ask1Iv": "0",
8244
+ // "lastPrice": "10980",
8245
+ // "highPrice24h": "0",
8246
+ // "lowPrice24h": "0",
8247
+ // "markPrice": "11814.66756236",
8248
+ // "indexPrice": "63838.92",
8249
+ // "markIv": "0.8866",
8250
+ // "underlyingPrice": "71690.55303594",
8251
+ // "openInterest": "0.01",
8252
+ // "turnover24h": "0",
8253
+ // "volume24h": "0",
8254
+ // "totalVolume": "2",
8255
+ // "totalTurnover": "78719",
8256
+ // "delta": "-0.23284954",
8257
+ // "gamma": "0.0000055",
8258
+ // "vega": "191.70757975",
8259
+ // "theta": "-30.43617927",
8260
+ // "predictedDeliveryPrice": "0",
8261
+ // "change24h": "0"
8262
+ // }
8263
+ // ]
8264
+ // },
8265
+ // "retExtInfo": {},
8266
+ // "time": 1711162003672
8267
+ // }
8268
+ //
8269
+ const result = this.safeDict(response, 'result', {});
8270
+ const resultList = this.safeList(result, 'list', []);
8271
+ const chain = this.safeDict(resultList, 0, {});
8272
+ return this.parseOption(chain, undefined, market);
8273
+ }
8274
+ async fetchOptionChain(code, params = {}) {
8275
+ /**
8276
+ * @method
8277
+ * @name bybit#fetchOptionChain
8278
+ * @description fetches data for an underlying asset that is commonly found in an option chain
8279
+ * @see https://bybit-exchange.github.io/docs/v5/market/tickers
8280
+ * @param {string} currency base currency to fetch an option chain for
8281
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8282
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
8283
+ */
8284
+ await this.loadMarkets();
8285
+ const currency = this.currency(code);
8286
+ const request = {
8287
+ 'category': 'option',
8288
+ 'baseCoin': currency['id'],
8289
+ };
8290
+ const response = await this.publicGetV5MarketTickers(this.extend(request, params));
8291
+ //
8292
+ // {
8293
+ // "retCode": 0,
8294
+ // "retMsg": "SUCCESS",
8295
+ // "result": {
8296
+ // "category": "option",
8297
+ // "list": [
8298
+ // {
8299
+ // "symbol": "BTC-27DEC24-55000-P",
8300
+ // "bid1Price": "0",
8301
+ // "bid1Size": "0",
8302
+ // "bid1Iv": "0",
8303
+ // "ask1Price": "0",
8304
+ // "ask1Size": "0",
8305
+ // "ask1Iv": "0",
8306
+ // "lastPrice": "10980",
8307
+ // "highPrice24h": "0",
8308
+ // "lowPrice24h": "0",
8309
+ // "markPrice": "11814.66756236",
8310
+ // "indexPrice": "63838.92",
8311
+ // "markIv": "0.8866",
8312
+ // "underlyingPrice": "71690.55303594",
8313
+ // "openInterest": "0.01",
8314
+ // "turnover24h": "0",
8315
+ // "volume24h": "0",
8316
+ // "totalVolume": "2",
8317
+ // "totalTurnover": "78719",
8318
+ // "delta": "-0.23284954",
8319
+ // "gamma": "0.0000055",
8320
+ // "vega": "191.70757975",
8321
+ // "theta": "-30.43617927",
8322
+ // "predictedDeliveryPrice": "0",
8323
+ // "change24h": "0"
8324
+ // },
8325
+ // ]
8326
+ // },
8327
+ // "retExtInfo": {},
8328
+ // "time": 1711162003672
8329
+ // }
8330
+ //
8331
+ const result = this.safeDict(response, 'result', {});
8332
+ const resultList = this.safeList(result, 'list', []);
8333
+ return this.parseOptionChain(resultList, undefined, 'symbol');
8334
+ }
8335
+ parseOption(chain, currency = undefined, market = undefined) {
8336
+ //
8337
+ // {
8338
+ // "symbol": "BTC-27DEC24-55000-P",
8339
+ // "bid1Price": "0",
8340
+ // "bid1Size": "0",
8341
+ // "bid1Iv": "0",
8342
+ // "ask1Price": "0",
8343
+ // "ask1Size": "0",
8344
+ // "ask1Iv": "0",
8345
+ // "lastPrice": "10980",
8346
+ // "highPrice24h": "0",
8347
+ // "lowPrice24h": "0",
8348
+ // "markPrice": "11814.66756236",
8349
+ // "indexPrice": "63838.92",
8350
+ // "markIv": "0.8866",
8351
+ // "underlyingPrice": "71690.55303594",
8352
+ // "openInterest": "0.01",
8353
+ // "turnover24h": "0",
8354
+ // "volume24h": "0",
8355
+ // "totalVolume": "2",
8356
+ // "totalTurnover": "78719",
8357
+ // "delta": "-0.23284954",
8358
+ // "gamma": "0.0000055",
8359
+ // "vega": "191.70757975",
8360
+ // "theta": "-30.43617927",
8361
+ // "predictedDeliveryPrice": "0",
8362
+ // "change24h": "0"
8363
+ // }
8364
+ //
8365
+ const marketId = this.safeString(chain, 'symbol');
8366
+ market = this.safeMarket(marketId, market);
8367
+ return {
8368
+ 'info': chain,
8369
+ 'currency': undefined,
8370
+ 'symbol': market['symbol'],
8371
+ 'timestamp': undefined,
8372
+ 'datetime': undefined,
8373
+ 'impliedVolatility': this.safeNumber(chain, 'markIv'),
8374
+ 'openInterest': this.safeNumber(chain, 'openInterest'),
8375
+ 'bidPrice': this.safeNumber(chain, 'bid1Price'),
8376
+ 'askPrice': this.safeNumber(chain, 'ask1Price'),
8377
+ 'midPrice': undefined,
8378
+ 'markPrice': this.safeNumber(chain, 'markPrice'),
8379
+ 'lastPrice': this.safeNumber(chain, 'lastPrice'),
8380
+ 'underlyingPrice': this.safeNumber(chain, 'underlyingPrice'),
8381
+ 'change': this.safeNumber(chain, 'change24h'),
8382
+ 'percentage': undefined,
8383
+ 'baseVolume': this.safeNumber(chain, 'totalVolume'),
8384
+ 'quoteVolume': undefined,
8385
+ };
8386
+ }
8210
8387
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8211
8388
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8212
8389
  if (api === 'public') {
@@ -132,6 +132,8 @@ class gate extends gate$1 {
132
132
  'fetchOpenInterest': false,
133
133
  'fetchOpenInterestHistory': true,
134
134
  'fetchOpenOrders': true,
135
+ 'fetchOption': true,
136
+ 'fetchOptionChain': true,
135
137
  'fetchOrder': true,
136
138
  'fetchOrderBook': true,
137
139
  'fetchPosition': true,
@@ -7202,6 +7204,190 @@ class gate extends gate$1 {
7202
7204
  'shortLeverage': leverageValue,
7203
7205
  };
7204
7206
  }
7207
+ async fetchOption(symbol, params = {}) {
7208
+ /**
7209
+ * @method
7210
+ * @name gate#fetchOption
7211
+ * @description fetches option data that is commonly found in an option chain
7212
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-specified-contract-detail
7213
+ * @param {string} symbol unified market symbol
7214
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7215
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7216
+ */
7217
+ await this.loadMarkets();
7218
+ const market = this.market(symbol);
7219
+ const request = {
7220
+ 'contract': market['id'],
7221
+ };
7222
+ const response = await this.publicOptionsGetContractsContract(this.extend(request, params));
7223
+ //
7224
+ // {
7225
+ // "is_active": true,
7226
+ // "mark_price_round": "0.01",
7227
+ // "settle_fee_rate": "0.00015",
7228
+ // "bid1_size": 30,
7229
+ // "taker_fee_rate": "0.0003",
7230
+ // "price_limit_fee_rate": "0.1",
7231
+ // "order_price_round": "0.1",
7232
+ // "tag": "month",
7233
+ // "ref_rebate_rate": "0",
7234
+ // "name": "ETH_USDT-20240628-4500-C",
7235
+ // "strike_price": "4500",
7236
+ // "ask1_price": "280.5",
7237
+ // "ref_discount_rate": "0",
7238
+ // "order_price_deviate": "0.2",
7239
+ // "ask1_size": -19,
7240
+ // "mark_price_down": "155.45",
7241
+ // "orderbook_id": 11724695,
7242
+ // "is_call": true,
7243
+ // "last_price": "188.7",
7244
+ // "mark_price": "274.26",
7245
+ // "underlying": "ETH_USDT",
7246
+ // "create_time": 1688024882,
7247
+ // "settle_limit_fee_rate": "0.1",
7248
+ // "orders_limit": 10,
7249
+ // "mark_price_up": "403.83",
7250
+ // "position_size": 80,
7251
+ // "order_size_max": 10000,
7252
+ // "position_limit": 100000,
7253
+ // "multiplier": "0.01",
7254
+ // "order_size_min": 1,
7255
+ // "trade_size": 229,
7256
+ // "underlying_price": "3326.6",
7257
+ // "maker_fee_rate": "0.0003",
7258
+ // "expiration_time": 1719561600,
7259
+ // "trade_id": 15,
7260
+ // "bid1_price": "269.3"
7261
+ // }
7262
+ //
7263
+ return this.parseOption(response, undefined, market);
7264
+ }
7265
+ async fetchOptionChain(code, params = {}) {
7266
+ /**
7267
+ * @method
7268
+ * @name gate#fetchOptionChain
7269
+ * @description fetches data for an underlying asset that is commonly found in an option chain
7270
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
7271
+ * @param {string} currency base currency to fetch an option chain for
7272
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7273
+ * @param {string} [params.underlying] the underlying asset, can be obtained from fetchUnderlyingAssets ()
7274
+ * @param {int} [params.expiration] unix timestamp of the expiration time
7275
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7276
+ */
7277
+ await this.loadMarkets();
7278
+ const currency = this.currency(code);
7279
+ const request = {
7280
+ 'underlying': currency['code'] + '_USDT',
7281
+ };
7282
+ const response = await this.publicOptionsGetContracts(this.extend(request, params));
7283
+ //
7284
+ // [
7285
+ // {
7286
+ // "is_active": true,
7287
+ // "mark_price_round": "0.1",
7288
+ // "settle_fee_rate": "0.00015",
7289
+ // "bid1_size": 434,
7290
+ // "taker_fee_rate": "0.0003",
7291
+ // "price_limit_fee_rate": "0.1",
7292
+ // "order_price_round": "1",
7293
+ // "tag": "day",
7294
+ // "ref_rebate_rate": "0",
7295
+ // "name": "BTC_USDT-20240324-63500-P",
7296
+ // "strike_price": "63500",
7297
+ // "ask1_price": "387",
7298
+ // "ref_discount_rate": "0",
7299
+ // "order_price_deviate": "0.15",
7300
+ // "ask1_size": -454,
7301
+ // "mark_price_down": "124.3",
7302
+ // "orderbook_id": 29600,
7303
+ // "is_call": false,
7304
+ // "last_price": "0",
7305
+ // "mark_price": "366.6",
7306
+ // "underlying": "BTC_USDT",
7307
+ // "create_time": 1711118829,
7308
+ // "settle_limit_fee_rate": "0.1",
7309
+ // "orders_limit": 10,
7310
+ // "mark_price_up": "630",
7311
+ // "position_size": 0,
7312
+ // "order_size_max": 10000,
7313
+ // "position_limit": 10000,
7314
+ // "multiplier": "0.01",
7315
+ // "order_size_min": 1,
7316
+ // "trade_size": 0,
7317
+ // "underlying_price": "64084.65",
7318
+ // "maker_fee_rate": "0.0003",
7319
+ // "expiration_time": 1711267200,
7320
+ // "trade_id": 0,
7321
+ // "bid1_price": "307"
7322
+ // },
7323
+ // ]
7324
+ //
7325
+ return this.parseOptionChain(response, undefined, 'name');
7326
+ }
7327
+ parseOption(chain, currency = undefined, market = undefined) {
7328
+ //
7329
+ // {
7330
+ // "is_active": true,
7331
+ // "mark_price_round": "0.1",
7332
+ // "settle_fee_rate": "0.00015",
7333
+ // "bid1_size": 434,
7334
+ // "taker_fee_rate": "0.0003",
7335
+ // "price_limit_fee_rate": "0.1",
7336
+ // "order_price_round": "1",
7337
+ // "tag": "day",
7338
+ // "ref_rebate_rate": "0",
7339
+ // "name": "BTC_USDT-20240324-63500-P",
7340
+ // "strike_price": "63500",
7341
+ // "ask1_price": "387",
7342
+ // "ref_discount_rate": "0",
7343
+ // "order_price_deviate": "0.15",
7344
+ // "ask1_size": -454,
7345
+ // "mark_price_down": "124.3",
7346
+ // "orderbook_id": 29600,
7347
+ // "is_call": false,
7348
+ // "last_price": "0",
7349
+ // "mark_price": "366.6",
7350
+ // "underlying": "BTC_USDT",
7351
+ // "create_time": 1711118829,
7352
+ // "settle_limit_fee_rate": "0.1",
7353
+ // "orders_limit": 10,
7354
+ // "mark_price_up": "630",
7355
+ // "position_size": 0,
7356
+ // "order_size_max": 10000,
7357
+ // "position_limit": 10000,
7358
+ // "multiplier": "0.01",
7359
+ // "order_size_min": 1,
7360
+ // "trade_size": 0,
7361
+ // "underlying_price": "64084.65",
7362
+ // "maker_fee_rate": "0.0003",
7363
+ // "expiration_time": 1711267200,
7364
+ // "trade_id": 0,
7365
+ // "bid1_price": "307"
7366
+ // }
7367
+ //
7368
+ const marketId = this.safeString(chain, 'name');
7369
+ market = this.safeMarket(marketId, market);
7370
+ const timestamp = this.safeTimestamp(chain, 'create_time');
7371
+ return {
7372
+ 'info': chain,
7373
+ 'currency': undefined,
7374
+ 'symbol': market['symbol'],
7375
+ 'timestamp': timestamp,
7376
+ 'datetime': this.iso8601(timestamp),
7377
+ 'impliedVolatility': undefined,
7378
+ 'openInterest': undefined,
7379
+ 'bidPrice': this.safeNumber(chain, 'bid1_price'),
7380
+ 'askPrice': this.safeNumber(chain, 'ask1_price'),
7381
+ 'midPrice': undefined,
7382
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
7383
+ 'lastPrice': this.safeNumber(chain, 'last_price'),
7384
+ 'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
7385
+ 'change': undefined,
7386
+ 'percentage': undefined,
7387
+ 'baseVolume': undefined,
7388
+ 'quoteVolume': undefined,
7389
+ };
7390
+ }
7205
7391
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7206
7392
  if (response === undefined) {
7207
7393
  return undefined;
@@ -1855,16 +1855,29 @@ class okx extends okx$1 {
1855
1855
  const first = this.safeValue(data, 0, {});
1856
1856
  return this.parseTicker(first, market);
1857
1857
  }
1858
- async fetchTickersByType(type, symbols = undefined, params = {}) {
1858
+ async fetchTickers(symbols = undefined, params = {}) {
1859
+ /**
1860
+ * @method
1861
+ * @name okx#fetchTickers
1862
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1863
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1864
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1865
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1866
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1867
+ */
1859
1868
  await this.loadMarkets();
1869
+ symbols = this.marketSymbols(symbols);
1870
+ const market = this.getMarketFromSymbols(symbols);
1871
+ let marketType = undefined;
1872
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1860
1873
  const request = {
1861
- 'instType': this.convertToInstrumentType(type),
1874
+ 'instType': this.convertToInstrumentType(marketType),
1862
1875
  };
1863
- if (type === 'option') {
1876
+ if (marketType === 'option') {
1864
1877
  const defaultUnderlying = this.safeValue(this.options, 'defaultUnderlying', 'BTC-USD');
1865
1878
  const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
1866
1879
  if (currencyId === undefined) {
1867
- throw new errors.ArgumentsRequired(this.id + ' fetchTickersByType() requires an underlying uly or marketId parameter for options markets');
1880
+ throw new errors.ArgumentsRequired(this.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets');
1868
1881
  }
1869
1882
  else {
1870
1883
  request['uly'] = currencyId;
@@ -1897,29 +1910,9 @@ class okx extends okx$1 {
1897
1910
  // ]
1898
1911
  // }
1899
1912
  //
1900
- const tickers = this.safeValue(response, 'data', []);
1913
+ const tickers = this.safeList(response, 'data', []);
1901
1914
  return this.parseTickers(tickers, symbols);
1902
1915
  }
1903
- async fetchTickers(symbols = undefined, params = {}) {
1904
- /**
1905
- * @method
1906
- * @name okx#fetchTickers
1907
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1908
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1909
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1910
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1911
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1912
- */
1913
- await this.loadMarkets();
1914
- symbols = this.marketSymbols(symbols);
1915
- const first = this.safeString(symbols, 0);
1916
- let market = undefined;
1917
- if (first !== undefined) {
1918
- market = this.market(first);
1919
- }
1920
- const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1921
- return await this.fetchTickersByType(type, symbols, query);
1922
- }
1923
1916
  parseTrade(trade, market = undefined) {
1924
1917
  //
1925
1918
  // public fetchTrades
@@ -4737,23 +4730,7 @@ class okx extends okx$1 {
4737
4730
  }
4738
4731
  }
4739
4732
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
4740
- if ('password' in params) {
4741
- request['pwd'] = params['password'];
4742
- }
4743
- else if ('pwd' in params) {
4744
- request['pwd'] = params['pwd'];
4745
- }
4746
- else {
4747
- const options = this.safeValue(this.options, 'withdraw', {});
4748
- const password = this.safeString2(options, 'password', 'pwd');
4749
- if (password !== undefined) {
4750
- request['pwd'] = password;
4751
- }
4752
- }
4753
- const query = this.omit(params, ['fee', 'password', 'pwd']);
4754
- if (!('pwd' in request)) {
4755
- throw new errors.ExchangeError(this.id + ' withdraw() requires a password parameter or a pwd parameter, it must be the funding password, not the API passphrase');
4756
- }
4733
+ const query = this.omit(params, ['fee']);
4757
4734
  const response = await this.privatePostAssetWithdrawal(this.extend(request, query));
4758
4735
  //
4759
4736
  // {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.79";
7
+ declare const version = "4.2.80";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.80';
41
+ const version = '4.2.81';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -436,4 +436,24 @@ export default class binance extends Exchange {
436
436
  }>;
437
437
  fetchMarginModes(symbols?: string[], params?: {}): Promise<MarginModes>;
438
438
  parseMarginMode(marginMode: any, market?: any): MarginMode;
439
+ fetchOption(symbol: string, params?: {}): Promise<Option>;
440
+ parseOption(chain: any, currency?: Currency, market?: Market): {
441
+ info: any;
442
+ currency: any;
443
+ symbol: string;
444
+ timestamp: any;
445
+ datetime: any;
446
+ impliedVolatility: any;
447
+ openInterest: any;
448
+ bidPrice: number;
449
+ askPrice: number;
450
+ midPrice: any;
451
+ markPrice: any;
452
+ lastPrice: number;
453
+ underlyingPrice: number;
454
+ change: number;
455
+ percentage: number;
456
+ baseVolume: number;
457
+ quoteVolume: any;
458
+ };
439
459
  }