ccxt 4.2.80 → 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/CHANGELOG.md +90 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +764 -48
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +90 -0
- package/dist/cjs/src/bybit.js +177 -0
- package/dist/cjs/src/delta.js +147 -0
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/gate.js +186 -0
- package/dist/cjs/src/hyperliquid.js +4 -4
- package/dist/cjs/src/okx.js +158 -42
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.d.ts +21 -1
- package/js/src/binance.js +90 -0
- package/js/src/bybit.d.ts +22 -1
- package/js/src/bybit.js +177 -0
- package/js/src/delta.d.ts +21 -1
- package/js/src/delta.js +147 -0
- package/js/src/deribit.d.ts +1 -1
- package/js/src/deribit.js +1 -1
- package/js/src/gate.d.ts +22 -1
- package/js/src/gate.js +186 -0
- package/js/src/hyperliquid.js +4 -4
- package/js/src/okx.d.ts +22 -2
- package/js/src/okx.js +158 -42
- package/package.json +1 -1
package/js/src/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bybit.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bybit
|
|
5
5
|
* @augments Exchange
|
|
@@ -267,6 +267,27 @@ export default class bybit extends Exchange {
|
|
|
267
267
|
amount: number;
|
|
268
268
|
rate: number;
|
|
269
269
|
};
|
|
270
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
271
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
272
|
+
parseOption(chain: any, currency?: Currency, market?: Market): {
|
|
273
|
+
info: any;
|
|
274
|
+
currency: any;
|
|
275
|
+
symbol: string;
|
|
276
|
+
timestamp: any;
|
|
277
|
+
datetime: any;
|
|
278
|
+
impliedVolatility: number;
|
|
279
|
+
openInterest: number;
|
|
280
|
+
bidPrice: number;
|
|
281
|
+
askPrice: number;
|
|
282
|
+
midPrice: any;
|
|
283
|
+
markPrice: number;
|
|
284
|
+
lastPrice: number;
|
|
285
|
+
underlyingPrice: number;
|
|
286
|
+
change: number;
|
|
287
|
+
percentage: any;
|
|
288
|
+
baseVolume: number;
|
|
289
|
+
quoteVolume: any;
|
|
290
|
+
};
|
|
270
291
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
271
292
|
url: string;
|
|
272
293
|
method: string;
|
package/js/src/bybit.js
CHANGED
|
@@ -95,6 +95,8 @@ export default class bybit extends Exchange {
|
|
|
95
95
|
'fetchOpenInterestHistory': true,
|
|
96
96
|
'fetchOpenOrder': true,
|
|
97
97
|
'fetchOpenOrders': true,
|
|
98
|
+
'fetchOption': true,
|
|
99
|
+
'fetchOptionChain': true,
|
|
98
100
|
'fetchOrder': false,
|
|
99
101
|
'fetchOrderBook': true,
|
|
100
102
|
'fetchOrders': false,
|
|
@@ -8214,6 +8216,181 @@ export default class bybit extends Exchange {
|
|
|
8214
8216
|
'rate': this.safeNumber(income, 'feeRate'),
|
|
8215
8217
|
};
|
|
8216
8218
|
}
|
|
8219
|
+
async fetchOption(symbol, params = {}) {
|
|
8220
|
+
/**
|
|
8221
|
+
* @method
|
|
8222
|
+
* @name bybit#fetchOption
|
|
8223
|
+
* @description fetches option data that is commonly found in an option chain
|
|
8224
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/tickers
|
|
8225
|
+
* @param {string} symbol unified market symbol
|
|
8226
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8227
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
8228
|
+
*/
|
|
8229
|
+
await this.loadMarkets();
|
|
8230
|
+
const market = this.market(symbol);
|
|
8231
|
+
const request = {
|
|
8232
|
+
'category': 'option',
|
|
8233
|
+
'symbol': market['id'],
|
|
8234
|
+
};
|
|
8235
|
+
const response = await this.publicGetV5MarketTickers(this.extend(request, params));
|
|
8236
|
+
//
|
|
8237
|
+
// {
|
|
8238
|
+
// "retCode": 0,
|
|
8239
|
+
// "retMsg": "SUCCESS",
|
|
8240
|
+
// "result": {
|
|
8241
|
+
// "category": "option",
|
|
8242
|
+
// "list": [
|
|
8243
|
+
// {
|
|
8244
|
+
// "symbol": "BTC-27DEC24-55000-P",
|
|
8245
|
+
// "bid1Price": "0",
|
|
8246
|
+
// "bid1Size": "0",
|
|
8247
|
+
// "bid1Iv": "0",
|
|
8248
|
+
// "ask1Price": "0",
|
|
8249
|
+
// "ask1Size": "0",
|
|
8250
|
+
// "ask1Iv": "0",
|
|
8251
|
+
// "lastPrice": "10980",
|
|
8252
|
+
// "highPrice24h": "0",
|
|
8253
|
+
// "lowPrice24h": "0",
|
|
8254
|
+
// "markPrice": "11814.66756236",
|
|
8255
|
+
// "indexPrice": "63838.92",
|
|
8256
|
+
// "markIv": "0.8866",
|
|
8257
|
+
// "underlyingPrice": "71690.55303594",
|
|
8258
|
+
// "openInterest": "0.01",
|
|
8259
|
+
// "turnover24h": "0",
|
|
8260
|
+
// "volume24h": "0",
|
|
8261
|
+
// "totalVolume": "2",
|
|
8262
|
+
// "totalTurnover": "78719",
|
|
8263
|
+
// "delta": "-0.23284954",
|
|
8264
|
+
// "gamma": "0.0000055",
|
|
8265
|
+
// "vega": "191.70757975",
|
|
8266
|
+
// "theta": "-30.43617927",
|
|
8267
|
+
// "predictedDeliveryPrice": "0",
|
|
8268
|
+
// "change24h": "0"
|
|
8269
|
+
// }
|
|
8270
|
+
// ]
|
|
8271
|
+
// },
|
|
8272
|
+
// "retExtInfo": {},
|
|
8273
|
+
// "time": 1711162003672
|
|
8274
|
+
// }
|
|
8275
|
+
//
|
|
8276
|
+
const result = this.safeDict(response, 'result', {});
|
|
8277
|
+
const resultList = this.safeList(result, 'list', []);
|
|
8278
|
+
const chain = this.safeDict(resultList, 0, {});
|
|
8279
|
+
return this.parseOption(chain, undefined, market);
|
|
8280
|
+
}
|
|
8281
|
+
async fetchOptionChain(code, params = {}) {
|
|
8282
|
+
/**
|
|
8283
|
+
* @method
|
|
8284
|
+
* @name bybit#fetchOptionChain
|
|
8285
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
8286
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/tickers
|
|
8287
|
+
* @param {string} currency base currency to fetch an option chain for
|
|
8288
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8289
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
8290
|
+
*/
|
|
8291
|
+
await this.loadMarkets();
|
|
8292
|
+
const currency = this.currency(code);
|
|
8293
|
+
const request = {
|
|
8294
|
+
'category': 'option',
|
|
8295
|
+
'baseCoin': currency['id'],
|
|
8296
|
+
};
|
|
8297
|
+
const response = await this.publicGetV5MarketTickers(this.extend(request, params));
|
|
8298
|
+
//
|
|
8299
|
+
// {
|
|
8300
|
+
// "retCode": 0,
|
|
8301
|
+
// "retMsg": "SUCCESS",
|
|
8302
|
+
// "result": {
|
|
8303
|
+
// "category": "option",
|
|
8304
|
+
// "list": [
|
|
8305
|
+
// {
|
|
8306
|
+
// "symbol": "BTC-27DEC24-55000-P",
|
|
8307
|
+
// "bid1Price": "0",
|
|
8308
|
+
// "bid1Size": "0",
|
|
8309
|
+
// "bid1Iv": "0",
|
|
8310
|
+
// "ask1Price": "0",
|
|
8311
|
+
// "ask1Size": "0",
|
|
8312
|
+
// "ask1Iv": "0",
|
|
8313
|
+
// "lastPrice": "10980",
|
|
8314
|
+
// "highPrice24h": "0",
|
|
8315
|
+
// "lowPrice24h": "0",
|
|
8316
|
+
// "markPrice": "11814.66756236",
|
|
8317
|
+
// "indexPrice": "63838.92",
|
|
8318
|
+
// "markIv": "0.8866",
|
|
8319
|
+
// "underlyingPrice": "71690.55303594",
|
|
8320
|
+
// "openInterest": "0.01",
|
|
8321
|
+
// "turnover24h": "0",
|
|
8322
|
+
// "volume24h": "0",
|
|
8323
|
+
// "totalVolume": "2",
|
|
8324
|
+
// "totalTurnover": "78719",
|
|
8325
|
+
// "delta": "-0.23284954",
|
|
8326
|
+
// "gamma": "0.0000055",
|
|
8327
|
+
// "vega": "191.70757975",
|
|
8328
|
+
// "theta": "-30.43617927",
|
|
8329
|
+
// "predictedDeliveryPrice": "0",
|
|
8330
|
+
// "change24h": "0"
|
|
8331
|
+
// },
|
|
8332
|
+
// ]
|
|
8333
|
+
// },
|
|
8334
|
+
// "retExtInfo": {},
|
|
8335
|
+
// "time": 1711162003672
|
|
8336
|
+
// }
|
|
8337
|
+
//
|
|
8338
|
+
const result = this.safeDict(response, 'result', {});
|
|
8339
|
+
const resultList = this.safeList(result, 'list', []);
|
|
8340
|
+
return this.parseOptionChain(resultList, undefined, 'symbol');
|
|
8341
|
+
}
|
|
8342
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
8343
|
+
//
|
|
8344
|
+
// {
|
|
8345
|
+
// "symbol": "BTC-27DEC24-55000-P",
|
|
8346
|
+
// "bid1Price": "0",
|
|
8347
|
+
// "bid1Size": "0",
|
|
8348
|
+
// "bid1Iv": "0",
|
|
8349
|
+
// "ask1Price": "0",
|
|
8350
|
+
// "ask1Size": "0",
|
|
8351
|
+
// "ask1Iv": "0",
|
|
8352
|
+
// "lastPrice": "10980",
|
|
8353
|
+
// "highPrice24h": "0",
|
|
8354
|
+
// "lowPrice24h": "0",
|
|
8355
|
+
// "markPrice": "11814.66756236",
|
|
8356
|
+
// "indexPrice": "63838.92",
|
|
8357
|
+
// "markIv": "0.8866",
|
|
8358
|
+
// "underlyingPrice": "71690.55303594",
|
|
8359
|
+
// "openInterest": "0.01",
|
|
8360
|
+
// "turnover24h": "0",
|
|
8361
|
+
// "volume24h": "0",
|
|
8362
|
+
// "totalVolume": "2",
|
|
8363
|
+
// "totalTurnover": "78719",
|
|
8364
|
+
// "delta": "-0.23284954",
|
|
8365
|
+
// "gamma": "0.0000055",
|
|
8366
|
+
// "vega": "191.70757975",
|
|
8367
|
+
// "theta": "-30.43617927",
|
|
8368
|
+
// "predictedDeliveryPrice": "0",
|
|
8369
|
+
// "change24h": "0"
|
|
8370
|
+
// }
|
|
8371
|
+
//
|
|
8372
|
+
const marketId = this.safeString(chain, 'symbol');
|
|
8373
|
+
market = this.safeMarket(marketId, market);
|
|
8374
|
+
return {
|
|
8375
|
+
'info': chain,
|
|
8376
|
+
'currency': undefined,
|
|
8377
|
+
'symbol': market['symbol'],
|
|
8378
|
+
'timestamp': undefined,
|
|
8379
|
+
'datetime': undefined,
|
|
8380
|
+
'impliedVolatility': this.safeNumber(chain, 'markIv'),
|
|
8381
|
+
'openInterest': this.safeNumber(chain, 'openInterest'),
|
|
8382
|
+
'bidPrice': this.safeNumber(chain, 'bid1Price'),
|
|
8383
|
+
'askPrice': this.safeNumber(chain, 'ask1Price'),
|
|
8384
|
+
'midPrice': undefined,
|
|
8385
|
+
'markPrice': this.safeNumber(chain, 'markPrice'),
|
|
8386
|
+
'lastPrice': this.safeNumber(chain, 'lastPrice'),
|
|
8387
|
+
'underlyingPrice': this.safeNumber(chain, 'underlyingPrice'),
|
|
8388
|
+
'change': this.safeNumber(chain, 'change24h'),
|
|
8389
|
+
'percentage': undefined,
|
|
8390
|
+
'baseVolume': this.safeNumber(chain, 'totalVolume'),
|
|
8391
|
+
'quoteVolume': undefined,
|
|
8392
|
+
};
|
|
8393
|
+
}
|
|
8217
8394
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8218
8395
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8219
8396
|
if (api === 'public') {
|
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;
|
package/js/src/deribit.d.ts
CHANGED
|
@@ -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:
|
|
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
|
|
3599
|
+
'currency': code,
|
|
3600
3600
|
'symbol': market['symbol'],
|
|
3601
3601
|
'timestamp': timestamp,
|
|
3602
3602
|
'datetime': this.iso8601(timestamp),
|
package/js/src/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/gate.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class gate
|
|
5
5
|
* @augments Exchange
|
|
@@ -364,5 +364,26 @@ export default class gate extends Exchange {
|
|
|
364
364
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
365
365
|
fetchLeverages(symbols?: string[], params?: {}): Promise<Leverages>;
|
|
366
366
|
parseLeverage(leverage: any, market?: any): Leverage;
|
|
367
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
368
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
369
|
+
parseOption(chain: any, currency?: Currency, market?: Market): {
|
|
370
|
+
info: any;
|
|
371
|
+
currency: any;
|
|
372
|
+
symbol: string;
|
|
373
|
+
timestamp: number;
|
|
374
|
+
datetime: string;
|
|
375
|
+
impliedVolatility: any;
|
|
376
|
+
openInterest: any;
|
|
377
|
+
bidPrice: number;
|
|
378
|
+
askPrice: number;
|
|
379
|
+
midPrice: any;
|
|
380
|
+
markPrice: number;
|
|
381
|
+
lastPrice: number;
|
|
382
|
+
underlyingPrice: number;
|
|
383
|
+
change: any;
|
|
384
|
+
percentage: any;
|
|
385
|
+
baseVolume: any;
|
|
386
|
+
quoteVolume: any;
|
|
387
|
+
};
|
|
367
388
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
368
389
|
}
|