ccxt 4.2.79 → 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/README.md +3 -3
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +752 -73
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +35 -3
- package/dist/cjs/src/binance.js +91 -1
- package/dist/cjs/src/bybit.js +178 -1
- package/dist/cjs/src/deribit.js +155 -0
- package/dist/cjs/src/gate.js +200 -5
- package/dist/cjs/src/hyperliquid.js +54 -10
- package/dist/cjs/src/okx.js +19 -42
- package/dist/cjs/src/pro/binance.js +5 -5
- package/dist/cjs/src/pro/bitopro.js +2 -1
- package/dist/cjs/src/pro/gemini.js +3 -2
- package/dist/cjs/src/pro/phemex.js +7 -2
- package/dist/cjs/src/upbit.js +2 -0
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/upbit.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +14 -5
- package/js/src/base/Exchange.js +35 -3
- package/js/src/base/types.d.ts +21 -0
- package/js/src/binance.d.ts +23 -3
- package/js/src/binance.js +91 -1
- package/js/src/bybit.d.ts +22 -1
- package/js/src/bybit.js +178 -1
- package/js/src/deribit.d.ts +22 -1
- package/js/src/deribit.js +155 -0
- package/js/src/gate.d.ts +22 -1
- package/js/src/gate.js +200 -5
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +54 -10
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +19 -42
- package/js/src/pro/binance.js +5 -5
- package/js/src/pro/bitopro.js +2 -1
- package/js/src/pro/gemini.d.ts +2 -2
- package/js/src/pro/gemini.js +3 -2
- package/js/src/pro/phemex.js +7 -2
- package/js/src/upbit.js +2 -0
- package/package.json +1 -1
- package/skip-tests.json +7 -2
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.
|
|
41
|
+
const version = '4.2.81';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -8,6 +8,7 @@ interface Exchange {
|
|
|
8
8
|
publicGetCandlesMinutes1(params?: {}): Promise<implicitReturnType>;
|
|
9
9
|
publicGetCandlesMinutes3(params?: {}): Promise<implicitReturnType>;
|
|
10
10
|
publicGetCandlesMinutes5(params?: {}): Promise<implicitReturnType>;
|
|
11
|
+
publicGetCandlesMinutes10(params?: {}): Promise<implicitReturnType>;
|
|
11
12
|
publicGetCandlesMinutes15(params?: {}): Promise<implicitReturnType>;
|
|
12
13
|
publicGetCandlesMinutes30(params?: {}): Promise<implicitReturnType>;
|
|
13
14
|
publicGetCandlesMinutes60(params?: {}): Promise<implicitReturnType>;
|
|
@@ -3,8 +3,8 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account } from './types.js';
|
|
7
|
-
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks, Leverage, Leverages,
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings } from './types.js';
|
|
7
|
+
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, BorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
10
10
|
/**
|
|
@@ -396,6 +396,8 @@ export default class Exchange {
|
|
|
396
396
|
fetchOpenOrder: any;
|
|
397
397
|
fetchOpenOrders: any;
|
|
398
398
|
fetchOpenOrdersWs: any;
|
|
399
|
+
fetchOption: any;
|
|
400
|
+
fetchOptionChain: any;
|
|
399
401
|
fetchOrder: any;
|
|
400
402
|
fetchOrderBook: boolean;
|
|
401
403
|
fetchOrderBooks: any;
|
|
@@ -621,6 +623,8 @@ export default class Exchange {
|
|
|
621
623
|
ethAbiEncode(types: any, args: any): Uint8Array;
|
|
622
624
|
ethEncodeStructuredData(domain: any, messageTypes: any, messageData: any): Uint8Array;
|
|
623
625
|
intToBase16(elem: any): string;
|
|
626
|
+
extendExchangeOptions(newOptions: any): void;
|
|
627
|
+
createSafeDictionary(): {};
|
|
624
628
|
safeBoolN(dictionaryOrList: any, keys: IndexType[], defaultValue?: boolean): boolean | undefined;
|
|
625
629
|
safeBool2(dictionary: any, key1: IndexType, key2: IndexType, defaultValue?: boolean): boolean | undefined;
|
|
626
630
|
safeBool(dictionary: any, key: IndexType, defaultValue?: boolean): boolean | undefined;
|
|
@@ -768,9 +772,9 @@ export default class Exchange {
|
|
|
768
772
|
convertTradingViewToOHLCV(ohlcvs: number[][], timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): any[];
|
|
769
773
|
convertOHLCVToTradingView(ohlcvs: number[][], timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): {};
|
|
770
774
|
fetchWebEndpoint(method: any, endpointMethod: any, returnAsJson: any, startRegex?: any, endRegex?: any): Promise<any>;
|
|
771
|
-
marketIds(symbols
|
|
772
|
-
marketSymbols(symbols
|
|
773
|
-
marketCodes(codes
|
|
775
|
+
marketIds(symbols?: Strings): any[];
|
|
776
|
+
marketSymbols(symbols?: Strings, type?: Str, allowEmpty?: boolean, sameTypeOnly?: boolean, sameSubTypeOnly?: boolean): any[];
|
|
777
|
+
marketCodes(codes?: Strings): any[];
|
|
774
778
|
parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
|
|
775
779
|
fetchL2OrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
|
|
776
780
|
filterBySymbol(objects: any, symbol?: Str): any;
|
|
@@ -864,6 +868,7 @@ export default class Exchange {
|
|
|
864
868
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
865
869
|
fetchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
866
870
|
fetchOrderBooks(symbols?: string[], limit?: Int, params?: {}): Promise<Dictionary<OrderBook>>;
|
|
871
|
+
watchBidsAsks(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
867
872
|
watchTickers(symbols?: string[], params?: {}): Promise<Tickers>;
|
|
868
873
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
869
874
|
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
@@ -902,6 +907,8 @@ export default class Exchange {
|
|
|
902
907
|
fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
903
908
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
904
909
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
910
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
911
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
905
912
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
906
913
|
fetchDeposits(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
907
914
|
fetchWithdrawals(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
@@ -1000,6 +1007,8 @@ export default class Exchange {
|
|
|
1000
1007
|
parseLiquidation(liquidation: any, market?: Market): Liquidation;
|
|
1001
1008
|
parseLiquidations(liquidations: any, market?: any, since?: Int, limit?: Int): Liquidation[];
|
|
1002
1009
|
parseGreeks(greeks: any, market?: Market): Greeks;
|
|
1010
|
+
parseOption(chain: any, currency?: Currency, market?: Market): Option;
|
|
1011
|
+
parseOptionChain(response: object[], currencyKey?: Str, symbolKey?: Str): OptionChain;
|
|
1003
1012
|
parseMarginModes(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModes;
|
|
1004
1013
|
parseMarginMode(marginMode: any, market?: Market): MarginMode;
|
|
1005
1014
|
parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -453,6 +453,8 @@ export default class Exchange {
|
|
|
453
453
|
'fetchOpenOrder': undefined,
|
|
454
454
|
'fetchOpenOrders': undefined,
|
|
455
455
|
'fetchOpenOrdersWs': undefined,
|
|
456
|
+
'fetchOption': undefined,
|
|
457
|
+
'fetchOptionChain': undefined,
|
|
456
458
|
'fetchOrder': undefined,
|
|
457
459
|
'fetchOrderBook': true,
|
|
458
460
|
'fetchOrderBooks': undefined,
|
|
@@ -1424,6 +1426,12 @@ export default class Exchange {
|
|
|
1424
1426
|
intToBase16(elem) {
|
|
1425
1427
|
return elem.toString(16);
|
|
1426
1428
|
}
|
|
1429
|
+
extendExchangeOptions(newOptions) {
|
|
1430
|
+
this.options = this.extend(this.options, newOptions);
|
|
1431
|
+
}
|
|
1432
|
+
createSafeDictionary() {
|
|
1433
|
+
return {};
|
|
1434
|
+
}
|
|
1427
1435
|
/* eslint-enable */
|
|
1428
1436
|
// ------------------------------------------------------------------------
|
|
1429
1437
|
// ########################################################################
|
|
@@ -3124,7 +3132,7 @@ export default class Exchange {
|
|
|
3124
3132
|
throw new BadResponse(errorMessage);
|
|
3125
3133
|
}
|
|
3126
3134
|
}
|
|
3127
|
-
marketIds(symbols) {
|
|
3135
|
+
marketIds(symbols = undefined) {
|
|
3128
3136
|
if (symbols === undefined) {
|
|
3129
3137
|
return symbols;
|
|
3130
3138
|
}
|
|
@@ -3134,7 +3142,7 @@ export default class Exchange {
|
|
|
3134
3142
|
}
|
|
3135
3143
|
return result;
|
|
3136
3144
|
}
|
|
3137
|
-
marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3145
|
+
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3138
3146
|
if (symbols === undefined) {
|
|
3139
3147
|
if (!allowEmpty) {
|
|
3140
3148
|
throw new ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
@@ -3175,7 +3183,7 @@ export default class Exchange {
|
|
|
3175
3183
|
}
|
|
3176
3184
|
return result;
|
|
3177
3185
|
}
|
|
3178
|
-
marketCodes(codes) {
|
|
3186
|
+
marketCodes(codes = undefined) {
|
|
3179
3187
|
if (codes === undefined) {
|
|
3180
3188
|
return codes;
|
|
3181
3189
|
}
|
|
@@ -4115,6 +4123,9 @@ export default class Exchange {
|
|
|
4115
4123
|
async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
|
|
4116
4124
|
throw new NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
|
|
4117
4125
|
}
|
|
4126
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
4127
|
+
throw new NotSupported(this.id + ' watchBidsAsks() is not supported yet');
|
|
4128
|
+
}
|
|
4118
4129
|
async watchTickers(symbols = undefined, params = {}) {
|
|
4119
4130
|
throw new NotSupported(this.id + ' watchTickers() is not supported yet');
|
|
4120
4131
|
}
|
|
@@ -4467,6 +4478,12 @@ export default class Exchange {
|
|
|
4467
4478
|
async fetchGreeks(symbol, params = {}) {
|
|
4468
4479
|
throw new NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
4469
4480
|
}
|
|
4481
|
+
async fetchOptionChain(code, params = {}) {
|
|
4482
|
+
throw new NotSupported(this.id + ' fetchOptionChain() is not supported yet');
|
|
4483
|
+
}
|
|
4484
|
+
async fetchOption(symbol, params = {}) {
|
|
4485
|
+
throw new NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
4486
|
+
}
|
|
4470
4487
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4471
4488
|
/**
|
|
4472
4489
|
* @method
|
|
@@ -5645,6 +5662,21 @@ export default class Exchange {
|
|
|
5645
5662
|
parseGreeks(greeks, market = undefined) {
|
|
5646
5663
|
throw new NotSupported(this.id + ' parseGreeks () is not supported yet');
|
|
5647
5664
|
}
|
|
5665
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
5666
|
+
throw new NotSupported(this.id + ' parseOption () is not supported yet');
|
|
5667
|
+
}
|
|
5668
|
+
parseOptionChain(response, currencyKey = undefined, symbolKey = undefined) {
|
|
5669
|
+
const optionStructures = {};
|
|
5670
|
+
for (let i = 0; i < response.length; i++) {
|
|
5671
|
+
const info = response[i];
|
|
5672
|
+
const currencyId = this.safeString(info, currencyKey);
|
|
5673
|
+
const currency = this.safeCurrency(currencyId);
|
|
5674
|
+
const marketId = this.safeString(info, symbolKey);
|
|
5675
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'option');
|
|
5676
|
+
optionStructures[market['symbol']] = this.parseOption(info, currency, market);
|
|
5677
|
+
}
|
|
5678
|
+
return optionStructures;
|
|
5679
|
+
}
|
|
5648
5680
|
parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
5649
5681
|
const marginModeStructures = {};
|
|
5650
5682
|
for (let i = 0; i < response.length; i++) {
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -398,6 +398,25 @@ export interface Greeks {
|
|
|
398
398
|
underlyingPrice: number;
|
|
399
399
|
info: any;
|
|
400
400
|
}
|
|
401
|
+
export interface Option {
|
|
402
|
+
info: any;
|
|
403
|
+
currency: string;
|
|
404
|
+
symbol: string;
|
|
405
|
+
timestamp?: number;
|
|
406
|
+
datetime?: Str;
|
|
407
|
+
impliedVolatility: number;
|
|
408
|
+
openInterest: number;
|
|
409
|
+
bidPrice: number;
|
|
410
|
+
askPrice: number;
|
|
411
|
+
midPrice: number;
|
|
412
|
+
markPrice: number;
|
|
413
|
+
lastPrice: number;
|
|
414
|
+
underlyingPrice: number;
|
|
415
|
+
change: number;
|
|
416
|
+
percentage: number;
|
|
417
|
+
baseVolume: number;
|
|
418
|
+
quoteVolume: number;
|
|
419
|
+
}
|
|
401
420
|
export interface LastPrice {
|
|
402
421
|
symbol: string;
|
|
403
422
|
timestamp?: number;
|
|
@@ -419,6 +438,8 @@ export interface LastPrices extends Dictionary<LastPrice> {
|
|
|
419
438
|
}
|
|
420
439
|
export interface MarginModes extends Dictionary<MarginMode> {
|
|
421
440
|
}
|
|
441
|
+
export interface OptionChain extends Dictionary<Option> {
|
|
442
|
+
}
|
|
422
443
|
/** [ timestamp, open, high, low, close, volume ] */
|
|
423
444
|
export declare type OHLCV = [Num, Num, Num, Num, Num, Num];
|
|
424
445
|
/** [ timestamp, open, high, low, close, volume, count ] */
|
package/js/src/binance.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
|
|
6
6
|
*/
|
|
7
7
|
export default class binance extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
-
isInverse(type:
|
|
10
|
-
isLinear(type:
|
|
9
|
+
isInverse(type: string, subType?: Str): boolean;
|
|
10
|
+
isLinear(type: string, subType?: Str): boolean;
|
|
11
11
|
setSandboxMode(enable: boolean): void;
|
|
12
12
|
convertExpireDate(date: any): string;
|
|
13
13
|
createExpiredOptionMarket(symbol: string): MarketInterface;
|
|
@@ -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
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -114,6 +114,8 @@ export default class binance extends Exchange {
|
|
|
114
114
|
'fetchOpenInterestHistory': true,
|
|
115
115
|
'fetchOpenOrder': true,
|
|
116
116
|
'fetchOpenOrders': true,
|
|
117
|
+
'fetchOption': true,
|
|
118
|
+
'fetchOptionChain': false,
|
|
117
119
|
'fetchOrder': true,
|
|
118
120
|
'fetchOrderBook': true,
|
|
119
121
|
'fetchOrderBooks': false,
|
|
@@ -2405,7 +2407,7 @@ export default class binance extends Exchange {
|
|
|
2405
2407
|
}
|
|
2406
2408
|
isInverse(type, subType = undefined) {
|
|
2407
2409
|
if (subType === undefined) {
|
|
2408
|
-
return type === 'delivery';
|
|
2410
|
+
return (type === 'delivery');
|
|
2409
2411
|
}
|
|
2410
2412
|
else {
|
|
2411
2413
|
return subType === 'inverse';
|
|
@@ -12411,4 +12413,92 @@ export default class binance extends Exchange {
|
|
|
12411
12413
|
'marginMode': isIsolated ? 'isolated' : 'cross',
|
|
12412
12414
|
};
|
|
12413
12415
|
}
|
|
12416
|
+
async fetchOption(symbol, params = {}) {
|
|
12417
|
+
/**
|
|
12418
|
+
* @method
|
|
12419
|
+
* @name binance#fetchOption
|
|
12420
|
+
* @description fetches option data that is commonly found in an option chain
|
|
12421
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics
|
|
12422
|
+
* @param {string} symbol unified market symbol
|
|
12423
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12424
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
12425
|
+
*/
|
|
12426
|
+
await this.loadMarkets();
|
|
12427
|
+
const market = this.market(symbol);
|
|
12428
|
+
const request = {
|
|
12429
|
+
'symbol': market['id'],
|
|
12430
|
+
};
|
|
12431
|
+
const response = await this.eapiPublicGetTicker(this.extend(request, params));
|
|
12432
|
+
//
|
|
12433
|
+
// [
|
|
12434
|
+
// {
|
|
12435
|
+
// "symbol": "BTC-241227-80000-C",
|
|
12436
|
+
// "priceChange": "0",
|
|
12437
|
+
// "priceChangePercent": "0",
|
|
12438
|
+
// "lastPrice": "2750",
|
|
12439
|
+
// "lastQty": "0",
|
|
12440
|
+
// "open": "2750",
|
|
12441
|
+
// "high": "2750",
|
|
12442
|
+
// "low": "2750",
|
|
12443
|
+
// "volume": "0",
|
|
12444
|
+
// "amount": "0",
|
|
12445
|
+
// "bidPrice": "4880",
|
|
12446
|
+
// "askPrice": "0",
|
|
12447
|
+
// "openTime": 0,
|
|
12448
|
+
// "closeTime": 0,
|
|
12449
|
+
// "firstTradeId": 0,
|
|
12450
|
+
// "tradeCount": 0,
|
|
12451
|
+
// "strikePrice": "80000",
|
|
12452
|
+
// "exercisePrice": "63944.09893617"
|
|
12453
|
+
// }
|
|
12454
|
+
// ]
|
|
12455
|
+
//
|
|
12456
|
+
const chain = this.safeDict(response, 0, {});
|
|
12457
|
+
return this.parseOption(chain, undefined, market);
|
|
12458
|
+
}
|
|
12459
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
12460
|
+
//
|
|
12461
|
+
// {
|
|
12462
|
+
// "symbol": "BTC-241227-80000-C",
|
|
12463
|
+
// "priceChange": "0",
|
|
12464
|
+
// "priceChangePercent": "0",
|
|
12465
|
+
// "lastPrice": "2750",
|
|
12466
|
+
// "lastQty": "0",
|
|
12467
|
+
// "open": "2750",
|
|
12468
|
+
// "high": "2750",
|
|
12469
|
+
// "low": "2750",
|
|
12470
|
+
// "volume": "0",
|
|
12471
|
+
// "amount": "0",
|
|
12472
|
+
// "bidPrice": "4880",
|
|
12473
|
+
// "askPrice": "0",
|
|
12474
|
+
// "openTime": 0,
|
|
12475
|
+
// "closeTime": 0,
|
|
12476
|
+
// "firstTradeId": 0,
|
|
12477
|
+
// "tradeCount": 0,
|
|
12478
|
+
// "strikePrice": "80000",
|
|
12479
|
+
// "exercisePrice": "63944.09893617"
|
|
12480
|
+
// }
|
|
12481
|
+
//
|
|
12482
|
+
const marketId = this.safeString(chain, 'symbol');
|
|
12483
|
+
market = this.safeMarket(marketId, market);
|
|
12484
|
+
return {
|
|
12485
|
+
'info': chain,
|
|
12486
|
+
'currency': undefined,
|
|
12487
|
+
'symbol': market['symbol'],
|
|
12488
|
+
'timestamp': undefined,
|
|
12489
|
+
'datetime': undefined,
|
|
12490
|
+
'impliedVolatility': undefined,
|
|
12491
|
+
'openInterest': undefined,
|
|
12492
|
+
'bidPrice': this.safeNumber(chain, 'bidPrice'),
|
|
12493
|
+
'askPrice': this.safeNumber(chain, 'askPrice'),
|
|
12494
|
+
'midPrice': undefined,
|
|
12495
|
+
'markPrice': undefined,
|
|
12496
|
+
'lastPrice': this.safeNumber(chain, 'lastPrice'),
|
|
12497
|
+
'underlyingPrice': this.safeNumber(chain, 'exercisePrice'),
|
|
12498
|
+
'change': this.safeNumber(chain, 'priceChange'),
|
|
12499
|
+
'percentage': this.safeNumber(chain, 'priceChangePercent'),
|
|
12500
|
+
'baseVolume': this.safeNumber(chain, 'volume'),
|
|
12501
|
+
'quoteVolume': undefined,
|
|
12502
|
+
};
|
|
12503
|
+
}
|
|
12414
12504
|
}
|
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
|
@@ -73,6 +73,7 @@ export default class bybit extends Exchange {
|
|
|
73
73
|
'fetchDeposits': true,
|
|
74
74
|
'fetchDepositWithdrawFee': 'emulated',
|
|
75
75
|
'fetchDepositWithdrawFees': true,
|
|
76
|
+
'fetchFundingHistory': true,
|
|
76
77
|
'fetchFundingRate': true,
|
|
77
78
|
'fetchFundingRateHistory': true,
|
|
78
79
|
'fetchFundingRates': true,
|
|
@@ -94,6 +95,8 @@ export default class bybit extends Exchange {
|
|
|
94
95
|
'fetchOpenInterestHistory': true,
|
|
95
96
|
'fetchOpenOrder': true,
|
|
96
97
|
'fetchOpenOrders': true,
|
|
98
|
+
'fetchOption': true,
|
|
99
|
+
'fetchOptionChain': true,
|
|
97
100
|
'fetchOrder': false,
|
|
98
101
|
'fetchOrderBook': true,
|
|
99
102
|
'fetchOrders': false,
|
|
@@ -113,7 +116,6 @@ export default class bybit extends Exchange {
|
|
|
113
116
|
'fetchUnderlyingAssets': false,
|
|
114
117
|
'fetchVolatilityHistory': true,
|
|
115
118
|
'fetchWithdrawals': true,
|
|
116
|
-
'fetchFundingHistory': true,
|
|
117
119
|
'repayCrossMargin': true,
|
|
118
120
|
'setLeverage': true,
|
|
119
121
|
'setMarginMode': true,
|
|
@@ -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/deribit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/deribit.js';
|
|
2
|
-
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class deribit
|
|
5
5
|
* @augments Exchange
|
|
@@ -167,6 +167,27 @@ export default class deribit extends Exchange {
|
|
|
167
167
|
underlyingPrice: number;
|
|
168
168
|
info: any;
|
|
169
169
|
};
|
|
170
|
+
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
171
|
+
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
172
|
+
parseOption(chain: any, currency?: Currency, market?: Market): {
|
|
173
|
+
info: any;
|
|
174
|
+
currency: any;
|
|
175
|
+
symbol: string;
|
|
176
|
+
timestamp: number;
|
|
177
|
+
datetime: string;
|
|
178
|
+
impliedVolatility: any;
|
|
179
|
+
openInterest: number;
|
|
180
|
+
bidPrice: number;
|
|
181
|
+
askPrice: number;
|
|
182
|
+
midPrice: number;
|
|
183
|
+
markPrice: number;
|
|
184
|
+
lastPrice: number;
|
|
185
|
+
underlyingPrice: number;
|
|
186
|
+
change: any;
|
|
187
|
+
percentage: number;
|
|
188
|
+
baseVolume: number;
|
|
189
|
+
quoteVolume: number;
|
|
190
|
+
};
|
|
170
191
|
nonce(): number;
|
|
171
192
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
172
193
|
url: string;
|