ccxt 4.2.81 → 4.2.82

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.81';
184
+ const version = '4.2.82';
185
185
  Exchange["default"].ccxtVersion = version;
186
186
  const exchanges = {
187
187
  'ace': ace,
@@ -61,6 +61,8 @@ class delta extends delta$1 {
61
61
  'fetchOHLCV': true,
62
62
  'fetchOpenInterest': true,
63
63
  'fetchOpenOrders': true,
64
+ 'fetchOption': true,
65
+ 'fetchOptionChain': false,
64
66
  'fetchOrderBook': true,
65
67
  'fetchPosition': true,
66
68
  'fetchPositionMode': false,
@@ -3312,6 +3314,151 @@ class delta extends delta$1 {
3312
3314
  'marginMode': this.safeString(marginMode, 'margin_mode'),
3313
3315
  };
3314
3316
  }
3317
+ async fetchOption(symbol, params = {}) {
3318
+ /**
3319
+ * @method
3320
+ * @name delta#fetchOption
3321
+ * @description fetches option data that is commonly found in an option chain
3322
+ * @see https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
3323
+ * @param {string} symbol unified market symbol
3324
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3325
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
3326
+ */
3327
+ await this.loadMarkets();
3328
+ const market = this.market(symbol);
3329
+ const request = {
3330
+ 'symbol': market['id'],
3331
+ };
3332
+ const response = await this.publicGetTickersSymbol(this.extend(request, params));
3333
+ //
3334
+ // {
3335
+ // "result": {
3336
+ // "close": 6793.0,
3337
+ // "contract_type": "call_options",
3338
+ // "greeks": {
3339
+ // "delta": "0.94739174",
3340
+ // "gamma": "0.00002206",
3341
+ // "rho": "11.00890725",
3342
+ // "spot": "36839.58124652",
3343
+ // "theta": "-18.18365310",
3344
+ // "vega": "7.85209698"
3345
+ // },
3346
+ // "high": 7556.0,
3347
+ // "low": 6793.0,
3348
+ // "mark_price": "6955.70698909",
3349
+ // "mark_vol": "0.66916863",
3350
+ // "oi": "1.8980",
3351
+ // "oi_change_usd_6h": "110.4600",
3352
+ // "oi_contracts": "1898",
3353
+ // "oi_value": "1.8980",
3354
+ // "oi_value_symbol": "BTC",
3355
+ // "oi_value_usd": "69940.7319",
3356
+ // "open": 7.2e3,
3357
+ // "price_band": {
3358
+ // "lower_limit": "5533.89814767",
3359
+ // "upper_limit": "11691.37688371"
3360
+ // },
3361
+ // "product_id": 129508,
3362
+ // "quotes": {
3363
+ // "ask_iv": "0.90180438",
3364
+ // "ask_size": "1898",
3365
+ // "best_ask": "7210",
3366
+ // "best_bid": "6913",
3367
+ // "bid_iv": "0.60881706",
3368
+ // "bid_size": "3163",
3369
+ // "impact_mid_price": null,
3370
+ // "mark_iv": "0.66973549"
3371
+ // },
3372
+ // "size": 5,
3373
+ // "spot_price": "36839.58153868",
3374
+ // "strike_price": "30000",
3375
+ // "symbol": "C-BTC-30000-241123",
3376
+ // "timestamp": 1699584998504530,
3377
+ // "turnover": 184.41206804,
3378
+ // "turnover_symbol": "USDT",
3379
+ // "turnover_usd": 184.41206804,
3380
+ // "volume": 0.005
3381
+ // },
3382
+ // "success": true
3383
+ // }
3384
+ //
3385
+ const result = this.safeDict(response, 'result', {});
3386
+ return this.parseOption(result, undefined, market);
3387
+ }
3388
+ parseOption(chain, currency = undefined, market = undefined) {
3389
+ //
3390
+ // {
3391
+ // "close": 6793.0,
3392
+ // "contract_type": "call_options",
3393
+ // "greeks": {
3394
+ // "delta": "0.94739174",
3395
+ // "gamma": "0.00002206",
3396
+ // "rho": "11.00890725",
3397
+ // "spot": "36839.58124652",
3398
+ // "theta": "-18.18365310",
3399
+ // "vega": "7.85209698"
3400
+ // },
3401
+ // "high": 7556.0,
3402
+ // "low": 6793.0,
3403
+ // "mark_price": "6955.70698909",
3404
+ // "mark_vol": "0.66916863",
3405
+ // "oi": "1.8980",
3406
+ // "oi_change_usd_6h": "110.4600",
3407
+ // "oi_contracts": "1898",
3408
+ // "oi_value": "1.8980",
3409
+ // "oi_value_symbol": "BTC",
3410
+ // "oi_value_usd": "69940.7319",
3411
+ // "open": 7.2e3,
3412
+ // "price_band": {
3413
+ // "lower_limit": "5533.89814767",
3414
+ // "upper_limit": "11691.37688371"
3415
+ // },
3416
+ // "product_id": 129508,
3417
+ // "quotes": {
3418
+ // "ask_iv": "0.90180438",
3419
+ // "ask_size": "1898",
3420
+ // "best_ask": "7210",
3421
+ // "best_bid": "6913",
3422
+ // "bid_iv": "0.60881706",
3423
+ // "bid_size": "3163",
3424
+ // "impact_mid_price": null,
3425
+ // "mark_iv": "0.66973549"
3426
+ // },
3427
+ // "size": 5,
3428
+ // "spot_price": "36839.58153868",
3429
+ // "strike_price": "30000",
3430
+ // "symbol": "C-BTC-30000-241123",
3431
+ // "timestamp": 1699584998504530,
3432
+ // "turnover": 184.41206804,
3433
+ // "turnover_symbol": "USDT",
3434
+ // "turnover_usd": 184.41206804,
3435
+ // "volume": 0.005
3436
+ // }
3437
+ //
3438
+ const marketId = this.safeString(chain, 'symbol');
3439
+ market = this.safeMarket(marketId, market);
3440
+ const quotes = this.safeDict(chain, 'quotes', {});
3441
+ const timestamp = this.safeIntegerProduct(chain, 'timestamp', 0.001);
3442
+ return {
3443
+ 'info': chain,
3444
+ 'currency': undefined,
3445
+ 'symbol': market['symbol'],
3446
+ 'timestamp': timestamp,
3447
+ 'datetime': this.iso8601(timestamp),
3448
+ 'impliedVolatility': this.safeNumber(quotes, 'mark_iv'),
3449
+ 'openInterest': this.safeNumber(chain, 'oi'),
3450
+ 'bidPrice': this.safeNumber(quotes, 'best_bid'),
3451
+ 'askPrice': this.safeNumber(quotes, 'best_ask'),
3452
+ 'midPrice': this.safeNumber(quotes, 'impact_mid_price'),
3453
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
3454
+ 'lastPrice': undefined,
3455
+ 'underlyingPrice': this.safeNumber(chain, 'spot_price'),
3456
+ 'change': undefined,
3457
+ 'percentage': undefined,
3458
+ 'baseVolume': this.safeNumber(chain, 'volume'),
3459
+ 'quoteVolume': undefined,
3460
+ };
3461
+ }
3315
3462
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3316
3463
  const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
3317
3464
  let url = this.urls['api'][api] + requestPath;
@@ -3593,7 +3593,7 @@ class deribit extends deribit$1 {
3593
3593
  const timestamp = this.safeInteger(chain, 'timestamp');
3594
3594
  return {
3595
3595
  'info': chain,
3596
- 'currency': code['code'],
3596
+ 'currency': code,
3597
3597
  'symbol': market['symbol'],
3598
3598
  'timestamp': timestamp,
3599
3599
  'datetime': this.iso8601(timestamp),
@@ -44,7 +44,7 @@ class hyperliquid extends hyperliquid$1 {
44
44
  'createMarketSellOrderWithCost': false,
45
45
  'createOrder': true,
46
46
  'createOrders': true,
47
- 'createReduceOnlyOrder': false,
47
+ 'createReduceOnlyOrder': true,
48
48
  'editOrder': true,
49
49
  'fetchAccounts': false,
50
50
  'fetchBalance': true,
@@ -881,7 +881,7 @@ class hyperliquid extends hyperliquid$1 {
881
881
  'tif': timeInForce,
882
882
  };
883
883
  }
884
- orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
884
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']);
885
885
  const orderObj = {
886
886
  'a': this.parseToInt(market['baseId']),
887
887
  'b': isBuy,
@@ -2034,10 +2034,10 @@ class hyperliquid extends hyperliquid$1 {
2034
2034
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
2035
2035
  let user = userAux;
2036
2036
  [user, params] = this.handleOptionAndParams(params, methodName, 'address', userAux);
2037
- if (user !== undefined) {
2037
+ if ((user !== undefined) && (user !== '')) {
2038
2038
  return [user, params];
2039
2039
  }
2040
- if (this.walletAddress !== undefined) {
2040
+ if ((this.walletAddress !== undefined) && (this.walletAddress !== '')) {
2041
2041
  return [this.walletAddress, params];
2042
2042
  }
2043
2043
  throw new errors.ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
@@ -94,6 +94,8 @@ class okx extends okx$1 {
94
94
  'fetchOpenInterestHistory': true,
95
95
  'fetchOpenOrder': undefined,
96
96
  'fetchOpenOrders': true,
97
+ 'fetchOption': true,
98
+ 'fetchOptionChain': true,
97
99
  'fetchOrder': true,
98
100
  'fetchOrderBook': true,
99
101
  'fetchOrderBooks': false,
@@ -7410,6 +7412,143 @@ class okx extends okx$1 {
7410
7412
  const order = this.safeValue(data, 0);
7411
7413
  return this.parseOrder(order, market);
7412
7414
  }
7415
+ async fetchOption(symbol, params = {}) {
7416
+ /**
7417
+ * @method
7418
+ * @name okx#fetchOption
7419
+ * @description fetches option data that is commonly found in an option chain
7420
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
7421
+ * @param {string} symbol unified market symbol
7422
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7423
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7424
+ */
7425
+ await this.loadMarkets();
7426
+ const market = this.market(symbol);
7427
+ const request = {
7428
+ 'instId': market['id'],
7429
+ };
7430
+ const response = await this.publicGetMarketTicker(this.extend(request, params));
7431
+ //
7432
+ // {
7433
+ // "code": "0",
7434
+ // "msg": "",
7435
+ // "data": [
7436
+ // {
7437
+ // "instType": "OPTION",
7438
+ // "instId": "BTC-USD-241227-60000-P",
7439
+ // "last": "",
7440
+ // "lastSz": "0",
7441
+ // "askPx": "",
7442
+ // "askSz": "0",
7443
+ // "bidPx": "",
7444
+ // "bidSz": "0",
7445
+ // "open24h": "",
7446
+ // "high24h": "",
7447
+ // "low24h": "",
7448
+ // "volCcy24h": "0",
7449
+ // "vol24h": "0",
7450
+ // "ts": "1711176035035",
7451
+ // "sodUtc0": "",
7452
+ // "sodUtc8": ""
7453
+ // }
7454
+ // ]
7455
+ // }
7456
+ //
7457
+ const result = this.safeList(response, 'data', []);
7458
+ const chain = this.safeDict(result, 0, {});
7459
+ return this.parseOption(chain, undefined, market);
7460
+ }
7461
+ async fetchOptionChain(code, params = {}) {
7462
+ /**
7463
+ * @method
7464
+ * @name okx#fetchOptionChain
7465
+ * @description fetches data for an underlying asset that is commonly found in an option chain
7466
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
7467
+ * @param {string} currency base currency to fetch an option chain for
7468
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7469
+ * @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
7470
+ * @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
7471
+ */
7472
+ await this.loadMarkets();
7473
+ const currency = this.currency(code);
7474
+ const request = {
7475
+ 'uly': currency['code'] + '-USD',
7476
+ 'instType': 'OPTION',
7477
+ };
7478
+ const response = await this.publicGetMarketTickers(this.extend(request, params));
7479
+ //
7480
+ // {
7481
+ // "code": "0",
7482
+ // "msg": "",
7483
+ // "data": [
7484
+ // {
7485
+ // "instType": "OPTION",
7486
+ // "instId": "BTC-USD-240323-52000-C",
7487
+ // "last": "",
7488
+ // "lastSz": "0",
7489
+ // "askPx": "",
7490
+ // "askSz": "0",
7491
+ // "bidPx": "",
7492
+ // "bidSz": "0",
7493
+ // "open24h": "",
7494
+ // "high24h": "",
7495
+ // "low24h": "",
7496
+ // "volCcy24h": "0",
7497
+ // "vol24h": "0",
7498
+ // "ts": "1711176207008",
7499
+ // "sodUtc0": "",
7500
+ // "sodUtc8": ""
7501
+ // },
7502
+ // ]
7503
+ // }
7504
+ //
7505
+ const result = this.safeList(response, 'data', []);
7506
+ return this.parseOptionChain(result, undefined, 'instId');
7507
+ }
7508
+ parseOption(chain, currency = undefined, market = undefined) {
7509
+ //
7510
+ // {
7511
+ // "instType": "OPTION",
7512
+ // "instId": "BTC-USD-241227-60000-P",
7513
+ // "last": "",
7514
+ // "lastSz": "0",
7515
+ // "askPx": "",
7516
+ // "askSz": "0",
7517
+ // "bidPx": "",
7518
+ // "bidSz": "0",
7519
+ // "open24h": "",
7520
+ // "high24h": "",
7521
+ // "low24h": "",
7522
+ // "volCcy24h": "0",
7523
+ // "vol24h": "0",
7524
+ // "ts": "1711176035035",
7525
+ // "sodUtc0": "",
7526
+ // "sodUtc8": ""
7527
+ // }
7528
+ //
7529
+ const marketId = this.safeString(chain, 'instId');
7530
+ market = this.safeMarket(marketId, market);
7531
+ const timestamp = this.safeInteger(chain, 'ts');
7532
+ return {
7533
+ 'info': chain,
7534
+ 'currency': undefined,
7535
+ 'symbol': market['symbol'],
7536
+ 'timestamp': timestamp,
7537
+ 'datetime': this.iso8601(timestamp),
7538
+ 'impliedVolatility': undefined,
7539
+ 'openInterest': undefined,
7540
+ 'bidPrice': this.safeNumber(chain, 'bidPx'),
7541
+ 'askPrice': this.safeNumber(chain, 'askPx'),
7542
+ 'midPrice': undefined,
7543
+ 'markPrice': undefined,
7544
+ 'lastPrice': this.safeNumber(chain, 'last'),
7545
+ 'underlyingPrice': undefined,
7546
+ 'change': undefined,
7547
+ 'percentage': undefined,
7548
+ 'baseVolume': this.safeNumber(chain, 'volCcy24h'),
7549
+ 'quoteVolume': undefined,
7550
+ };
7551
+ }
7413
7552
  handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7414
7553
  if (!response) {
7415
7554
  return undefined; // fallback to default error handler
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.80";
7
+ declare const version = "4.2.81";
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.81';
41
+ const version = '4.2.82';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/delta.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/delta.js';
2
- import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num } from './base/types.js';
2
+ import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option } from './base/types.js';
3
3
  /**
4
4
  * @class delta
5
5
  * @augments Exchange
@@ -191,6 +191,26 @@ export default class delta extends Exchange {
191
191
  closeAllPositions(params?: {}): Promise<Position[]>;
192
192
  fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
193
193
  parseMarginMode(marginMode: any, market?: any): MarginMode;
194
+ fetchOption(symbol: string, params?: {}): Promise<Option>;
195
+ parseOption(chain: any, currency?: Currency, market?: Market): {
196
+ info: any;
197
+ currency: any;
198
+ symbol: string;
199
+ timestamp: number;
200
+ datetime: string;
201
+ impliedVolatility: number;
202
+ openInterest: number;
203
+ bidPrice: number;
204
+ askPrice: number;
205
+ midPrice: number;
206
+ markPrice: number;
207
+ lastPrice: any;
208
+ underlyingPrice: number;
209
+ change: any;
210
+ percentage: any;
211
+ baseVolume: number;
212
+ quoteVolume: any;
213
+ };
194
214
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
195
215
  url: string;
196
216
  method: string;
package/js/src/delta.js CHANGED
@@ -64,6 +64,8 @@ export default class delta extends Exchange {
64
64
  'fetchOHLCV': true,
65
65
  'fetchOpenInterest': true,
66
66
  'fetchOpenOrders': true,
67
+ 'fetchOption': true,
68
+ 'fetchOptionChain': false,
67
69
  'fetchOrderBook': true,
68
70
  'fetchPosition': true,
69
71
  'fetchPositionMode': false,
@@ -3315,6 +3317,151 @@ export default class delta extends Exchange {
3315
3317
  'marginMode': this.safeString(marginMode, 'margin_mode'),
3316
3318
  };
3317
3319
  }
3320
+ async fetchOption(symbol, params = {}) {
3321
+ /**
3322
+ * @method
3323
+ * @name delta#fetchOption
3324
+ * @description fetches option data that is commonly found in an option chain
3325
+ * @see https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
3326
+ * @param {string} symbol unified market symbol
3327
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3328
+ * @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
3329
+ */
3330
+ await this.loadMarkets();
3331
+ const market = this.market(symbol);
3332
+ const request = {
3333
+ 'symbol': market['id'],
3334
+ };
3335
+ const response = await this.publicGetTickersSymbol(this.extend(request, params));
3336
+ //
3337
+ // {
3338
+ // "result": {
3339
+ // "close": 6793.0,
3340
+ // "contract_type": "call_options",
3341
+ // "greeks": {
3342
+ // "delta": "0.94739174",
3343
+ // "gamma": "0.00002206",
3344
+ // "rho": "11.00890725",
3345
+ // "spot": "36839.58124652",
3346
+ // "theta": "-18.18365310",
3347
+ // "vega": "7.85209698"
3348
+ // },
3349
+ // "high": 7556.0,
3350
+ // "low": 6793.0,
3351
+ // "mark_price": "6955.70698909",
3352
+ // "mark_vol": "0.66916863",
3353
+ // "oi": "1.8980",
3354
+ // "oi_change_usd_6h": "110.4600",
3355
+ // "oi_contracts": "1898",
3356
+ // "oi_value": "1.8980",
3357
+ // "oi_value_symbol": "BTC",
3358
+ // "oi_value_usd": "69940.7319",
3359
+ // "open": 7.2e3,
3360
+ // "price_band": {
3361
+ // "lower_limit": "5533.89814767",
3362
+ // "upper_limit": "11691.37688371"
3363
+ // },
3364
+ // "product_id": 129508,
3365
+ // "quotes": {
3366
+ // "ask_iv": "0.90180438",
3367
+ // "ask_size": "1898",
3368
+ // "best_ask": "7210",
3369
+ // "best_bid": "6913",
3370
+ // "bid_iv": "0.60881706",
3371
+ // "bid_size": "3163",
3372
+ // "impact_mid_price": null,
3373
+ // "mark_iv": "0.66973549"
3374
+ // },
3375
+ // "size": 5,
3376
+ // "spot_price": "36839.58153868",
3377
+ // "strike_price": "30000",
3378
+ // "symbol": "C-BTC-30000-241123",
3379
+ // "timestamp": 1699584998504530,
3380
+ // "turnover": 184.41206804,
3381
+ // "turnover_symbol": "USDT",
3382
+ // "turnover_usd": 184.41206804,
3383
+ // "volume": 0.005
3384
+ // },
3385
+ // "success": true
3386
+ // }
3387
+ //
3388
+ const result = this.safeDict(response, 'result', {});
3389
+ return this.parseOption(result, undefined, market);
3390
+ }
3391
+ parseOption(chain, currency = undefined, market = undefined) {
3392
+ //
3393
+ // {
3394
+ // "close": 6793.0,
3395
+ // "contract_type": "call_options",
3396
+ // "greeks": {
3397
+ // "delta": "0.94739174",
3398
+ // "gamma": "0.00002206",
3399
+ // "rho": "11.00890725",
3400
+ // "spot": "36839.58124652",
3401
+ // "theta": "-18.18365310",
3402
+ // "vega": "7.85209698"
3403
+ // },
3404
+ // "high": 7556.0,
3405
+ // "low": 6793.0,
3406
+ // "mark_price": "6955.70698909",
3407
+ // "mark_vol": "0.66916863",
3408
+ // "oi": "1.8980",
3409
+ // "oi_change_usd_6h": "110.4600",
3410
+ // "oi_contracts": "1898",
3411
+ // "oi_value": "1.8980",
3412
+ // "oi_value_symbol": "BTC",
3413
+ // "oi_value_usd": "69940.7319",
3414
+ // "open": 7.2e3,
3415
+ // "price_band": {
3416
+ // "lower_limit": "5533.89814767",
3417
+ // "upper_limit": "11691.37688371"
3418
+ // },
3419
+ // "product_id": 129508,
3420
+ // "quotes": {
3421
+ // "ask_iv": "0.90180438",
3422
+ // "ask_size": "1898",
3423
+ // "best_ask": "7210",
3424
+ // "best_bid": "6913",
3425
+ // "bid_iv": "0.60881706",
3426
+ // "bid_size": "3163",
3427
+ // "impact_mid_price": null,
3428
+ // "mark_iv": "0.66973549"
3429
+ // },
3430
+ // "size": 5,
3431
+ // "spot_price": "36839.58153868",
3432
+ // "strike_price": "30000",
3433
+ // "symbol": "C-BTC-30000-241123",
3434
+ // "timestamp": 1699584998504530,
3435
+ // "turnover": 184.41206804,
3436
+ // "turnover_symbol": "USDT",
3437
+ // "turnover_usd": 184.41206804,
3438
+ // "volume": 0.005
3439
+ // }
3440
+ //
3441
+ const marketId = this.safeString(chain, 'symbol');
3442
+ market = this.safeMarket(marketId, market);
3443
+ const quotes = this.safeDict(chain, 'quotes', {});
3444
+ const timestamp = this.safeIntegerProduct(chain, 'timestamp', 0.001);
3445
+ return {
3446
+ 'info': chain,
3447
+ 'currency': undefined,
3448
+ 'symbol': market['symbol'],
3449
+ 'timestamp': timestamp,
3450
+ 'datetime': this.iso8601(timestamp),
3451
+ 'impliedVolatility': this.safeNumber(quotes, 'mark_iv'),
3452
+ 'openInterest': this.safeNumber(chain, 'oi'),
3453
+ 'bidPrice': this.safeNumber(quotes, 'best_bid'),
3454
+ 'askPrice': this.safeNumber(quotes, 'best_ask'),
3455
+ 'midPrice': this.safeNumber(quotes, 'impact_mid_price'),
3456
+ 'markPrice': this.safeNumber(chain, 'mark_price'),
3457
+ 'lastPrice': undefined,
3458
+ 'underlyingPrice': this.safeNumber(chain, 'spot_price'),
3459
+ 'change': undefined,
3460
+ 'percentage': undefined,
3461
+ 'baseVolume': this.safeNumber(chain, 'volume'),
3462
+ 'quoteVolume': undefined,
3463
+ };
3464
+ }
3318
3465
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3319
3466
  const requestPath = '/' + this.version + '/' + this.implodeParams(path, params);
3320
3467
  let url = this.urls['api'][api] + requestPath;
@@ -171,7 +171,7 @@ export default class deribit extends Exchange {
171
171
  fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
172
172
  parseOption(chain: any, currency?: Currency, market?: Market): {
173
173
  info: any;
174
- currency: any;
174
+ currency: string;
175
175
  symbol: string;
176
176
  timestamp: number;
177
177
  datetime: string;
package/js/src/deribit.js CHANGED
@@ -3596,7 +3596,7 @@ export default class deribit extends Exchange {
3596
3596
  const timestamp = this.safeInteger(chain, 'timestamp');
3597
3597
  return {
3598
3598
  'info': chain,
3599
- 'currency': code['code'],
3599
+ 'currency': code,
3600
3600
  'symbol': market['symbol'],
3601
3601
  'timestamp': timestamp,
3602
3602
  'datetime': this.iso8601(timestamp),
@@ -47,7 +47,7 @@ export default class hyperliquid extends Exchange {
47
47
  'createMarketSellOrderWithCost': false,
48
48
  'createOrder': true,
49
49
  'createOrders': true,
50
- 'createReduceOnlyOrder': false,
50
+ 'createReduceOnlyOrder': true,
51
51
  'editOrder': true,
52
52
  'fetchAccounts': false,
53
53
  'fetchBalance': true,
@@ -884,7 +884,7 @@ export default class hyperliquid extends Exchange {
884
884
  'tif': timeInForce,
885
885
  };
886
886
  }
887
- orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
887
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']);
888
888
  const orderObj = {
889
889
  'a': this.parseToInt(market['baseId']),
890
890
  'b': isBuy,
@@ -2037,10 +2037,10 @@ export default class hyperliquid extends Exchange {
2037
2037
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
2038
2038
  let user = userAux;
2039
2039
  [user, params] = this.handleOptionAndParams(params, methodName, 'address', userAux);
2040
- if (user !== undefined) {
2040
+ if ((user !== undefined) && (user !== '')) {
2041
2041
  return [user, params];
2042
2042
  }
2043
- if (this.walletAddress !== undefined) {
2043
+ if ((this.walletAddress !== undefined) && (this.walletAddress !== '')) {
2044
2044
  return [this.walletAddress, params];
2045
2045
  }
2046
2046
  throw new ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');