ccxt 4.2.79 → 4.2.80
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 +280 -31
- 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 +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/deribit.js +155 -0
- package/dist/cjs/src/gate.js +14 -5
- package/dist/cjs/src/hyperliquid.js +54 -10
- 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 +2 -2
- package/js/src/binance.js +1 -1
- package/js/src/bybit.js +1 -1
- package/js/src/deribit.d.ts +22 -1
- package/js/src/deribit.js +155 -0
- package/js/src/gate.js +14 -5
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +54 -10
- 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.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Exchange } from './src/base/Exchange.js';
|
|
|
2
2
|
import { Precise } from './src/base/Precise.js';
|
|
3
3
|
import * as functions from './src/base/functions.js';
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
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 } from './src/base/types.js';
|
|
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.
|
|
7
|
+
declare const version = "4.2.79";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -516,5 +516,5 @@ declare const ccxt: {
|
|
|
516
516
|
zaif: typeof zaif;
|
|
517
517
|
zonda: typeof zonda;
|
|
518
518
|
} & typeof functions & typeof errors;
|
|
519
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
519
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
520
520
|
export default ccxt;
|
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.80';
|
|
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
|
@@ -6,8 +6,8 @@ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV,
|
|
|
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;
|
package/js/src/binance.js
CHANGED
|
@@ -2405,7 +2405,7 @@ export default class binance extends Exchange {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
isInverse(type, subType = undefined) {
|
|
2407
2407
|
if (subType === undefined) {
|
|
2408
|
-
return type === 'delivery';
|
|
2408
|
+
return (type === 'delivery');
|
|
2409
2409
|
}
|
|
2410
2410
|
else {
|
|
2411
2411
|
return subType === 'inverse';
|
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,
|
|
@@ -113,7 +114,6 @@ export default class bybit extends Exchange {
|
|
|
113
114
|
'fetchUnderlyingAssets': false,
|
|
114
115
|
'fetchVolatilityHistory': true,
|
|
115
116
|
'fetchWithdrawals': true,
|
|
116
|
-
'fetchFundingHistory': true,
|
|
117
117
|
'repayCrossMargin': true,
|
|
118
118
|
'setLeverage': true,
|
|
119
119
|
'setMarginMode': true,
|
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;
|
package/js/src/deribit.js
CHANGED
|
@@ -73,6 +73,8 @@ export default class deribit extends Exchange {
|
|
|
73
73
|
'fetchMyTrades': true,
|
|
74
74
|
'fetchOHLCV': true,
|
|
75
75
|
'fetchOpenOrders': true,
|
|
76
|
+
'fetchOption': true,
|
|
77
|
+
'fetchOptionChain': true,
|
|
76
78
|
'fetchOrder': true,
|
|
77
79
|
'fetchOrderBook': true,
|
|
78
80
|
'fetchOrders': false,
|
|
@@ -3459,6 +3461,159 @@ export default class deribit extends Exchange {
|
|
|
3459
3461
|
'info': greeks,
|
|
3460
3462
|
};
|
|
3461
3463
|
}
|
|
3464
|
+
async fetchOption(symbol, params = {}) {
|
|
3465
|
+
/**
|
|
3466
|
+
* @method
|
|
3467
|
+
* @name deribit#fetchOption
|
|
3468
|
+
* @description fetches option data that is commonly found in an option chain
|
|
3469
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_instrument
|
|
3470
|
+
* @param {string} symbol unified market symbol
|
|
3471
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3472
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
3473
|
+
*/
|
|
3474
|
+
await this.loadMarkets();
|
|
3475
|
+
const market = this.market(symbol);
|
|
3476
|
+
const request = {
|
|
3477
|
+
'instrument_name': market['id'],
|
|
3478
|
+
};
|
|
3479
|
+
const response = await this.publicGetGetBookSummaryByInstrument(this.extend(request, params));
|
|
3480
|
+
//
|
|
3481
|
+
// {
|
|
3482
|
+
// "jsonrpc": "2.0",
|
|
3483
|
+
// "result": [
|
|
3484
|
+
// {
|
|
3485
|
+
// "mid_price": 0.04025,
|
|
3486
|
+
// "volume_usd": 11045.12,
|
|
3487
|
+
// "quote_currency": "BTC",
|
|
3488
|
+
// "estimated_delivery_price": 65444.72,
|
|
3489
|
+
// "creation_timestamp": 1711100949273,
|
|
3490
|
+
// "base_currency": "BTC",
|
|
3491
|
+
// "underlying_index": "BTC-27DEC24",
|
|
3492
|
+
// "underlying_price": 73742.14,
|
|
3493
|
+
// "volume": 4.0,
|
|
3494
|
+
// "interest_rate": 0.0,
|
|
3495
|
+
// "price_change": -6.9767,
|
|
3496
|
+
// "open_interest": 274.2,
|
|
3497
|
+
// "ask_price": 0.042,
|
|
3498
|
+
// "bid_price": 0.0385,
|
|
3499
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
3500
|
+
// "mark_price": 0.04007735,
|
|
3501
|
+
// "last": 0.04,
|
|
3502
|
+
// "low": 0.04,
|
|
3503
|
+
// "high": 0.043
|
|
3504
|
+
// }
|
|
3505
|
+
// ],
|
|
3506
|
+
// "usIn": 1711100949273223,
|
|
3507
|
+
// "usOut": 1711100949273580,
|
|
3508
|
+
// "usDiff": 357,
|
|
3509
|
+
// "testnet": false
|
|
3510
|
+
// }
|
|
3511
|
+
//
|
|
3512
|
+
const result = this.safeList(response, 'result', []);
|
|
3513
|
+
const chain = this.safeDict(result, 0, {});
|
|
3514
|
+
return this.parseOption(chain, undefined, market);
|
|
3515
|
+
}
|
|
3516
|
+
async fetchOptionChain(code, params = {}) {
|
|
3517
|
+
/**
|
|
3518
|
+
* @method
|
|
3519
|
+
* @name deribit#fetchOptionChain
|
|
3520
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
3521
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_currency
|
|
3522
|
+
* @param {string} currency base currency to fetch an option chain for
|
|
3523
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3524
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
3525
|
+
*/
|
|
3526
|
+
await this.loadMarkets();
|
|
3527
|
+
const currency = this.currency(code);
|
|
3528
|
+
const request = {
|
|
3529
|
+
'currency': currency['id'],
|
|
3530
|
+
'kind': 'option',
|
|
3531
|
+
};
|
|
3532
|
+
const response = await this.publicGetGetBookSummaryByCurrency(this.extend(request, params));
|
|
3533
|
+
//
|
|
3534
|
+
// {
|
|
3535
|
+
// "jsonrpc": "2.0",
|
|
3536
|
+
// "result": [
|
|
3537
|
+
// {
|
|
3538
|
+
// "mid_price": 0.4075,
|
|
3539
|
+
// "volume_usd": 2836.83,
|
|
3540
|
+
// "quote_currency": "BTC",
|
|
3541
|
+
// "estimated_delivery_price": 65479.26,
|
|
3542
|
+
// "creation_timestamp": 1711101594477,
|
|
3543
|
+
// "base_currency": "BTC",
|
|
3544
|
+
// "underlying_index": "BTC-28JUN24",
|
|
3545
|
+
// "underlying_price": 68827.27,
|
|
3546
|
+
// "volume": 0.1,
|
|
3547
|
+
// "interest_rate": 0.0,
|
|
3548
|
+
// "price_change": 0.0,
|
|
3549
|
+
// "open_interest": 364.1,
|
|
3550
|
+
// "ask_price": 0.411,
|
|
3551
|
+
// "bid_price": 0.404,
|
|
3552
|
+
// "instrument_name": "BTC-28JUN24-42000-C",
|
|
3553
|
+
// "mark_price": 0.40752052,
|
|
3554
|
+
// "last": 0.423,
|
|
3555
|
+
// "low": 0.423,
|
|
3556
|
+
// "high": 0.423
|
|
3557
|
+
// }
|
|
3558
|
+
// ],
|
|
3559
|
+
// "usIn": 1711101594456388,
|
|
3560
|
+
// "usOut": 1711101594484065,
|
|
3561
|
+
// "usDiff": 27677,
|
|
3562
|
+
// "testnet": false
|
|
3563
|
+
// }
|
|
3564
|
+
//
|
|
3565
|
+
const result = this.safeList(response, 'result', []);
|
|
3566
|
+
return this.parseOptionChain(result, 'base_currency', 'instrument_name');
|
|
3567
|
+
}
|
|
3568
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
3569
|
+
//
|
|
3570
|
+
// {
|
|
3571
|
+
// "mid_price": 0.04025,
|
|
3572
|
+
// "volume_usd": 11045.12,
|
|
3573
|
+
// "quote_currency": "BTC",
|
|
3574
|
+
// "estimated_delivery_price": 65444.72,
|
|
3575
|
+
// "creation_timestamp": 1711100949273,
|
|
3576
|
+
// "base_currency": "BTC",
|
|
3577
|
+
// "underlying_index": "BTC-27DEC24",
|
|
3578
|
+
// "underlying_price": 73742.14,
|
|
3579
|
+
// "volume": 4.0,
|
|
3580
|
+
// "interest_rate": 0.0,
|
|
3581
|
+
// "price_change": -6.9767,
|
|
3582
|
+
// "open_interest": 274.2,
|
|
3583
|
+
// "ask_price": 0.042,
|
|
3584
|
+
// "bid_price": 0.0385,
|
|
3585
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
3586
|
+
// "mark_price": 0.04007735,
|
|
3587
|
+
// "last": 0.04,
|
|
3588
|
+
// "low": 0.04,
|
|
3589
|
+
// "high": 0.043
|
|
3590
|
+
// }
|
|
3591
|
+
//
|
|
3592
|
+
const marketId = this.safeString(chain, 'instrument_name');
|
|
3593
|
+
market = this.safeMarket(marketId, market);
|
|
3594
|
+
const currencyId = this.safeString(chain, 'base_currency');
|
|
3595
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
3596
|
+
const timestamp = this.safeInteger(chain, 'timestamp');
|
|
3597
|
+
return {
|
|
3598
|
+
'info': chain,
|
|
3599
|
+
'currency': code['code'],
|
|
3600
|
+
'symbol': market['symbol'],
|
|
3601
|
+
'timestamp': timestamp,
|
|
3602
|
+
'datetime': this.iso8601(timestamp),
|
|
3603
|
+
'impliedVolatility': undefined,
|
|
3604
|
+
'openInterest': this.safeNumber(chain, 'open_interest'),
|
|
3605
|
+
'bidPrice': this.safeNumber(chain, 'bid_price'),
|
|
3606
|
+
'askPrice': this.safeNumber(chain, 'ask_price'),
|
|
3607
|
+
'midPrice': this.safeNumber(chain, 'mid_price'),
|
|
3608
|
+
'markPrice': this.safeNumber(chain, 'mark_price'),
|
|
3609
|
+
'lastPrice': this.safeNumber(chain, 'last'),
|
|
3610
|
+
'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
|
|
3611
|
+
'change': undefined,
|
|
3612
|
+
'percentage': this.safeNumber(chain, 'price_change'),
|
|
3613
|
+
'baseVolume': this.safeNumber(chain, 'volume'),
|
|
3614
|
+
'quoteVolume': this.safeNumber(chain, 'volume_usd'),
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3462
3617
|
nonce() {
|
|
3463
3618
|
return this.milliseconds();
|
|
3464
3619
|
}
|
package/js/src/gate.js
CHANGED
|
@@ -4234,8 +4234,17 @@ export default class gate extends Exchange {
|
|
|
4234
4234
|
'account': account,
|
|
4235
4235
|
};
|
|
4236
4236
|
if (amount !== undefined) {
|
|
4237
|
-
|
|
4238
|
-
|
|
4237
|
+
if (market['spot']) {
|
|
4238
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
4239
|
+
}
|
|
4240
|
+
else {
|
|
4241
|
+
if (side === 'sell') {
|
|
4242
|
+
request['size'] = Precise.stringNeg(this.amountToPrecision(symbol, amount));
|
|
4243
|
+
}
|
|
4244
|
+
else {
|
|
4245
|
+
request['size'] = this.amountToPrecision(symbol, amount);
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4239
4248
|
}
|
|
4240
4249
|
if (price !== undefined) {
|
|
4241
4250
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -5033,8 +5042,8 @@ export default class gate extends Exchange {
|
|
|
5033
5042
|
*/
|
|
5034
5043
|
await this.loadMarkets();
|
|
5035
5044
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
5036
|
-
const stop = this.
|
|
5037
|
-
params = this.omit(params, 'stop');
|
|
5045
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
5046
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
5038
5047
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
5039
5048
|
const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
5040
5049
|
let response = undefined;
|
|
@@ -5362,7 +5371,7 @@ export default class gate extends Exchange {
|
|
|
5362
5371
|
'unrealizedPnl': this.parseNumber(unrealisedPnl),
|
|
5363
5372
|
'realizedPnl': this.safeNumber(position, 'realised_pnl'),
|
|
5364
5373
|
'contracts': this.parseNumber(Precise.stringAbs(size)),
|
|
5365
|
-
'contractSize': this.
|
|
5374
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
5366
5375
|
// 'realisedPnl': position['realised_pnl'],
|
|
5367
5376
|
'marginRatio': undefined,
|
|
5368
5377
|
'liquidationPrice': this.safeNumber(position, 'liq_price'),
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export default class hyperliquid extends Exchange {
|
|
|
73
73
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<any>;
|
|
74
74
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
75
75
|
withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<any>;
|
|
76
|
+
formatVaultAddress(address?: Str): string;
|
|
76
77
|
handlePublicAddress(methodName: string, params: Dict): any[];
|
|
77
78
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
78
79
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|