ccxt 4.4.92 → 4.4.94
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/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +9 -8
- package/dist/cjs/src/base/Exchange.js +118 -33
- package/dist/cjs/src/binance.js +44 -1
- package/dist/cjs/src/bitmex.js +3 -3
- package/dist/cjs/src/bybit.js +85 -10
- package/dist/cjs/src/coinbase.js +3 -1
- package/dist/cjs/src/coinbaseexchange.js +53 -0
- package/dist/cjs/src/coincheck.js +47 -4
- package/dist/cjs/src/coinex.js +19 -14
- package/dist/cjs/src/coinmetro.js +16 -3
- package/dist/cjs/src/cryptomus.js +30 -53
- package/dist/cjs/src/deribit.js +6 -6
- package/dist/cjs/src/exmo.js +66 -61
- package/dist/cjs/src/htx.js +7 -1
- package/dist/cjs/src/hyperliquid.js +134 -33
- package/dist/cjs/src/kucoin.js +13 -15
- package/dist/cjs/src/latoken.js +19 -74
- package/dist/cjs/src/lbank.js +2 -2
- package/dist/cjs/src/okx.js +169 -4
- package/dist/cjs/src/paradex.js +54 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/pro/bitstamp.js +55 -16
- package/dist/cjs/src/pro/bybit.js +2 -1
- package/dist/cjs/src/wavesexchange.js +15 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ascendex.js +9 -8
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +118 -33
- package/js/src/binance.d.ts +10 -0
- package/js/src/binance.js +44 -1
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +3 -3
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +85 -10
- package/js/src/coinbase.js +4 -2
- package/js/src/coinbaseexchange.js +53 -0
- package/js/src/coincheck.js +48 -5
- package/js/src/coinex.js +16 -13
- package/js/src/coinmetro.js +16 -3
- package/js/src/cryptomus.js +30 -53
- package/js/src/deribit.js +6 -6
- package/js/src/exmo.js +66 -61
- package/js/src/htx.js +7 -1
- package/js/src/hyperliquid.d.ts +31 -0
- package/js/src/hyperliquid.js +134 -33
- package/js/src/kucoin.js +13 -15
- package/js/src/latoken.d.ts +0 -1
- package/js/src/latoken.js +19 -74
- package/js/src/lbank.js +2 -2
- package/js/src/okx.d.ts +12 -0
- package/js/src/okx.js +169 -4
- package/js/src/paradex.d.ts +10 -0
- package/js/src/paradex.js +54 -0
- package/js/src/phemex.js +3 -3
- package/js/src/pro/bitstamp.js +55 -16
- package/js/src/pro/bybit.js +2 -1
- package/js/src/wavesexchange.js +15 -2
- package/package.json +1 -1
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.93";
|
|
8
8
|
import alpaca from './src/alpaca.js';
|
|
9
9
|
import apex from './src/apex.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.93';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import alpaca from './src/alpaca.js';
|
package/js/src/ascendex.js
CHANGED
|
@@ -1441,6 +1441,8 @@ export default class ascendex extends Exchange {
|
|
|
1441
1441
|
// "timestamp": 1573576916201
|
|
1442
1442
|
// }
|
|
1443
1443
|
//
|
|
1444
|
+
// & linear (fetchClosedOrders)
|
|
1445
|
+
//
|
|
1444
1446
|
// {
|
|
1445
1447
|
// "ac": "FUTURES",
|
|
1446
1448
|
// "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn",
|
|
@@ -1448,7 +1450,7 @@ export default class ascendex extends Exchange {
|
|
|
1448
1450
|
// "orderId": "a17e0874ecbdU0711043490bbtcpDU5X",
|
|
1449
1451
|
// "seqNum": -1,
|
|
1450
1452
|
// "orderType": "Limit",
|
|
1451
|
-
// "execInst": "NULL_VAL",
|
|
1453
|
+
// "execInst": "NULL_VAL", // NULL_VAL, ReduceOnly , ...
|
|
1452
1454
|
// "side": "Buy",
|
|
1453
1455
|
// "symbol": "BTC-PERP",
|
|
1454
1456
|
// "price": "30000",
|
|
@@ -1537,14 +1539,14 @@ export default class ascendex extends Exchange {
|
|
|
1537
1539
|
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
1538
1540
|
const marketId = this.safeString(order, 'symbol');
|
|
1539
1541
|
const symbol = this.safeSymbol(marketId, market, '/');
|
|
1540
|
-
let timestamp = this.
|
|
1542
|
+
let timestamp = this.safeIntegerN(order, ['timestamp', 'sendingTime', 'time']);
|
|
1541
1543
|
const lastTradeTimestamp = this.safeInteger(order, 'lastExecTime');
|
|
1542
1544
|
if (timestamp === undefined) {
|
|
1543
1545
|
timestamp = lastTradeTimestamp;
|
|
1544
1546
|
}
|
|
1545
1547
|
const price = this.safeString(order, 'price');
|
|
1546
1548
|
const amount = this.safeString(order, 'orderQty');
|
|
1547
|
-
const average = this.
|
|
1549
|
+
const average = this.safeString2(order, 'avgPx', 'avgFilledPx');
|
|
1548
1550
|
const filled = this.safeStringN(order, ['cumFilledQty', 'cumQty', 'fillQty']);
|
|
1549
1551
|
const id = this.safeString(order, 'orderId');
|
|
1550
1552
|
let clientOrderId = this.safeString(order, 'id');
|
|
@@ -1576,12 +1578,12 @@ export default class ascendex extends Exchange {
|
|
|
1576
1578
|
}
|
|
1577
1579
|
const triggerPrice = this.omitZero(this.safeString(order, 'stopPrice'));
|
|
1578
1580
|
let reduceOnly = undefined;
|
|
1579
|
-
const execInst = this.
|
|
1580
|
-
if (execInst === '
|
|
1581
|
+
const execInst = this.safeStringLower(order, 'execInst');
|
|
1582
|
+
if (execInst === 'reduceonly') {
|
|
1581
1583
|
reduceOnly = true;
|
|
1582
1584
|
}
|
|
1583
1585
|
let postOnly = undefined;
|
|
1584
|
-
if (execInst === '
|
|
1586
|
+
if (execInst === 'post') {
|
|
1585
1587
|
postOnly = true;
|
|
1586
1588
|
}
|
|
1587
1589
|
return this.safeOrder({
|
|
@@ -2345,8 +2347,7 @@ export default class ascendex extends Exchange {
|
|
|
2345
2347
|
// }
|
|
2346
2348
|
//
|
|
2347
2349
|
let data = this.safeList(response, 'data', []);
|
|
2348
|
-
|
|
2349
|
-
if (!isArray) {
|
|
2350
|
+
if (!Array.isArray(data)) {
|
|
2350
2351
|
data = this.safeList(data, 'data', []);
|
|
2351
2352
|
}
|
|
2352
2353
|
return this.parseOrders(data, market, since, limit);
|
|
@@ -764,6 +764,7 @@ export default class Exchange {
|
|
|
764
764
|
fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
765
765
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
766
766
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
767
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
767
768
|
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
768
769
|
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
769
770
|
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
@@ -889,6 +890,7 @@ export default class Exchange {
|
|
|
889
890
|
parseLiquidation(liquidation: any, market?: Market): Liquidation;
|
|
890
891
|
parseLiquidations(liquidations: Dict[], market?: Market, since?: Int, limit?: Int): Liquidation[];
|
|
891
892
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
893
|
+
parseAllGreeks(greeks: any, symbols?: Strings, params?: {}): Greeks[];
|
|
892
894
|
parseOption(chain: Dict, currency?: Currency, market?: Market): Option;
|
|
893
895
|
parseOptionChain(response: object[], currencyKey?: Str, symbolKey?: Str): OptionChain;
|
|
894
896
|
parseMarginModes(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModes;
|
|
@@ -906,7 +908,7 @@ export default class Exchange {
|
|
|
906
908
|
parseMarginModifications(response: object[], symbols?: Strings, symbolKey?: Str, marketType?: MarketType): MarginModification[];
|
|
907
909
|
fetchTransfer(id: string, code?: Str, params?: {}): Promise<TransferEntry>;
|
|
908
910
|
fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
|
|
909
|
-
cleanUnsubscription(client: any, subHash: string, unsubHash: string): void;
|
|
911
|
+
cleanUnsubscription(client: any, subHash: string, unsubHash: string, subHashIsPrefix?: boolean): void;
|
|
910
912
|
cleanCache(subscription: Dict): void;
|
|
911
913
|
}
|
|
912
914
|
export { Exchange, };
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -3498,8 +3498,7 @@ export default class Exchange {
|
|
|
3498
3498
|
}
|
|
3499
3499
|
safeTicker(ticker, market = undefined) {
|
|
3500
3500
|
let open = this.omitZero(this.safeString(ticker, 'open'));
|
|
3501
|
-
let close = this.omitZero(this.
|
|
3502
|
-
let last = this.omitZero(this.safeString(ticker, 'last'));
|
|
3501
|
+
let close = this.omitZero(this.safeString2(ticker, 'close', 'last'));
|
|
3503
3502
|
let change = this.omitZero(this.safeString(ticker, 'change'));
|
|
3504
3503
|
let percentage = this.omitZero(this.safeString(ticker, 'percentage'));
|
|
3505
3504
|
let average = this.omitZero(this.safeString(ticker, 'average'));
|
|
@@ -3509,17 +3508,55 @@ export default class Exchange {
|
|
|
3509
3508
|
if (vwap === undefined) {
|
|
3510
3509
|
vwap = Precise.stringDiv(this.omitZero(quoteVolume), baseVolume);
|
|
3511
3510
|
}
|
|
3512
|
-
|
|
3513
|
-
|
|
3511
|
+
// calculate open
|
|
3512
|
+
if (change !== undefined) {
|
|
3513
|
+
if (close === undefined && average !== undefined) {
|
|
3514
|
+
close = Precise.stringAdd(average, Precise.stringDiv(change, '2'));
|
|
3515
|
+
}
|
|
3516
|
+
if (open === undefined && close !== undefined) {
|
|
3517
|
+
open = Precise.stringSub(close, change);
|
|
3518
|
+
}
|
|
3514
3519
|
}
|
|
3515
|
-
else if (
|
|
3516
|
-
|
|
3520
|
+
else if (percentage !== undefined) {
|
|
3521
|
+
if (close === undefined && average !== undefined) {
|
|
3522
|
+
const openAddClose = Precise.stringMul(average, '2');
|
|
3523
|
+
// openAddClose = open * (1 + (100 + percentage)/100)
|
|
3524
|
+
const denominator = Precise.stringAdd('2', Precise.stringDiv(percentage, '100'));
|
|
3525
|
+
const calcOpen = (open !== undefined) ? open : Precise.stringDiv(openAddClose, denominator);
|
|
3526
|
+
close = Precise.stringMul(calcOpen, Precise.stringAdd('1', Precise.stringDiv(percentage, '100')));
|
|
3527
|
+
}
|
|
3528
|
+
if (open === undefined && close !== undefined) {
|
|
3529
|
+
open = Precise.stringDiv(close, Precise.stringAdd('1', Precise.stringDiv(percentage, '100')));
|
|
3530
|
+
}
|
|
3517
3531
|
}
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3532
|
+
// change
|
|
3533
|
+
if (change === undefined) {
|
|
3534
|
+
if (close !== undefined && open !== undefined) {
|
|
3535
|
+
change = Precise.stringSub(close, open);
|
|
3521
3536
|
}
|
|
3522
|
-
if (
|
|
3537
|
+
else if (close !== undefined && percentage !== undefined) {
|
|
3538
|
+
change = Precise.stringMul(Precise.stringDiv(percentage, '100'), Precise.stringDiv(close, '100'));
|
|
3539
|
+
}
|
|
3540
|
+
else if (open !== undefined && percentage !== undefined) {
|
|
3541
|
+
change = Precise.stringMul(open, Precise.stringDiv(percentage, '100'));
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
// calculate things according to "open" (similar can be done with "close")
|
|
3545
|
+
if (open !== undefined) {
|
|
3546
|
+
// percentage (using change)
|
|
3547
|
+
if (percentage === undefined && change !== undefined) {
|
|
3548
|
+
percentage = Precise.stringMul(Precise.stringDiv(change, open), '100');
|
|
3549
|
+
}
|
|
3550
|
+
// close (using change)
|
|
3551
|
+
if (close === undefined && change !== undefined) {
|
|
3552
|
+
close = Precise.stringAdd(open, change);
|
|
3553
|
+
}
|
|
3554
|
+
// close (using average)
|
|
3555
|
+
if (close === undefined && average !== undefined) {
|
|
3556
|
+
close = Precise.stringMul(average, '2');
|
|
3557
|
+
}
|
|
3558
|
+
// average
|
|
3559
|
+
if (average === undefined && close !== undefined) {
|
|
3523
3560
|
let precision = 18;
|
|
3524
3561
|
if (market !== undefined && this.isTickPrecision()) {
|
|
3525
3562
|
const marketPrecision = this.safeDict(market, 'precision');
|
|
@@ -3528,20 +3565,12 @@ export default class Exchange {
|
|
|
3528
3565
|
precision = this.precisionFromString(precisionPrice);
|
|
3529
3566
|
}
|
|
3530
3567
|
}
|
|
3531
|
-
average = Precise.stringDiv(Precise.stringAdd(
|
|
3568
|
+
average = Precise.stringDiv(Precise.stringAdd(open, close), '2', precision);
|
|
3532
3569
|
}
|
|
3533
3570
|
}
|
|
3534
|
-
if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && Precise.stringGt(open, '0')) {
|
|
3535
|
-
percentage = Precise.stringMul(Precise.stringDiv(change, open), '100');
|
|
3536
|
-
}
|
|
3537
|
-
if ((change === undefined) && (percentage !== undefined) && (open !== undefined)) {
|
|
3538
|
-
change = Precise.stringDiv(Precise.stringMul(percentage, open), '100');
|
|
3539
|
-
}
|
|
3540
|
-
if ((open === undefined) && (last !== undefined) && (change !== undefined)) {
|
|
3541
|
-
open = Precise.stringSub(last, change);
|
|
3542
|
-
}
|
|
3543
3571
|
// timestamp and symbol operations don't belong in safeTicker
|
|
3544
3572
|
// they should be done in the derived classes
|
|
3573
|
+
const closeParsed = this.parseNumber(this.omitZero(close));
|
|
3545
3574
|
return this.extend(ticker, {
|
|
3546
3575
|
'bid': this.parseNumber(this.omitZero(this.safeString(ticker, 'bid'))),
|
|
3547
3576
|
'bidVolume': this.safeNumber(ticker, 'bidVolume'),
|
|
@@ -3550,8 +3579,8 @@ export default class Exchange {
|
|
|
3550
3579
|
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high'))),
|
|
3551
3580
|
'low': this.parseNumber(this.omitZero(this.safeString(ticker, 'low'))),
|
|
3552
3581
|
'open': this.parseNumber(this.omitZero(open)),
|
|
3553
|
-
'close':
|
|
3554
|
-
'last':
|
|
3582
|
+
'close': closeParsed,
|
|
3583
|
+
'last': closeParsed,
|
|
3555
3584
|
'change': this.parseNumber(change),
|
|
3556
3585
|
'percentage': this.parseNumber(percentage),
|
|
3557
3586
|
'average': this.parseNumber(average),
|
|
@@ -4006,7 +4035,7 @@ export default class Exchange {
|
|
|
4006
4035
|
return this.filterBySinceLimit(sorted, since, limit, 0, tail);
|
|
4007
4036
|
}
|
|
4008
4037
|
parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
|
|
4009
|
-
// marketIdKey should only be undefined when response is a dictionary
|
|
4038
|
+
// marketIdKey should only be undefined when response is a dictionary.
|
|
4010
4039
|
symbols = this.marketSymbols(symbols);
|
|
4011
4040
|
const tiers = {};
|
|
4012
4041
|
let symbolsLength = 0;
|
|
@@ -5444,6 +5473,9 @@ export default class Exchange {
|
|
|
5444
5473
|
async fetchGreeks(symbol, params = {}) {
|
|
5445
5474
|
throw new NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
5446
5475
|
}
|
|
5476
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
5477
|
+
throw new NotSupported(this.id + ' fetchAllGreeks() is not supported yet');
|
|
5478
|
+
}
|
|
5447
5479
|
async fetchOptionChain(code, params = {}) {
|
|
5448
5480
|
throw new NotSupported(this.id + ' fetchOptionChain() is not supported yet');
|
|
5449
5481
|
}
|
|
@@ -5738,11 +5770,20 @@ export default class Exchange {
|
|
|
5738
5770
|
if (precisionNumber === 0) {
|
|
5739
5771
|
return '1';
|
|
5740
5772
|
}
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5773
|
+
if (precisionNumber > 0) {
|
|
5774
|
+
let parsedPrecision = '0.';
|
|
5775
|
+
for (let i = 0; i < precisionNumber - 1; i++) {
|
|
5776
|
+
parsedPrecision = parsedPrecision + '0';
|
|
5777
|
+
}
|
|
5778
|
+
return parsedPrecision + '1';
|
|
5779
|
+
}
|
|
5780
|
+
else {
|
|
5781
|
+
let parsedPrecision = '1';
|
|
5782
|
+
for (let i = 0; i < precisionNumber * -1 - 1; i++) {
|
|
5783
|
+
parsedPrecision = parsedPrecision + '0';
|
|
5784
|
+
}
|
|
5785
|
+
return parsedPrecision + '0';
|
|
5744
5786
|
}
|
|
5745
|
-
return parsedPrecision + '1';
|
|
5746
5787
|
}
|
|
5747
5788
|
integerPrecisionToAmount(precision) {
|
|
5748
5789
|
/**
|
|
@@ -6899,6 +6940,31 @@ export default class Exchange {
|
|
|
6899
6940
|
parseGreeks(greeks, market = undefined) {
|
|
6900
6941
|
throw new NotSupported(this.id + ' parseGreeks () is not supported yet');
|
|
6901
6942
|
}
|
|
6943
|
+
parseAllGreeks(greeks, symbols = undefined, params = {}) {
|
|
6944
|
+
//
|
|
6945
|
+
// the value of greeks is either a dict or a list
|
|
6946
|
+
//
|
|
6947
|
+
const results = [];
|
|
6948
|
+
if (Array.isArray(greeks)) {
|
|
6949
|
+
for (let i = 0; i < greeks.length; i++) {
|
|
6950
|
+
const parsedTicker = this.parseGreeks(greeks[i]);
|
|
6951
|
+
const greek = this.extend(parsedTicker, params);
|
|
6952
|
+
results.push(greek);
|
|
6953
|
+
}
|
|
6954
|
+
}
|
|
6955
|
+
else {
|
|
6956
|
+
const marketIds = Object.keys(greeks);
|
|
6957
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
6958
|
+
const marketId = marketIds[i];
|
|
6959
|
+
const market = this.safeMarket(marketId);
|
|
6960
|
+
const parsed = this.parseGreeks(greeks[marketId], market);
|
|
6961
|
+
const greek = this.extend(parsed, params);
|
|
6962
|
+
results.push(greek);
|
|
6963
|
+
}
|
|
6964
|
+
}
|
|
6965
|
+
symbols = this.marketSymbols(symbols);
|
|
6966
|
+
return this.filterByArray(results, 'symbol', symbols);
|
|
6967
|
+
}
|
|
6902
6968
|
parseOption(chain, currency = undefined, market = undefined) {
|
|
6903
6969
|
throw new NotSupported(this.id + ' parseOption () is not supported yet');
|
|
6904
6970
|
}
|
|
@@ -7137,16 +7203,35 @@ export default class Exchange {
|
|
|
7137
7203
|
*/
|
|
7138
7204
|
throw new NotSupported(this.id + ' fetchTransfers () is not supported yet');
|
|
7139
7205
|
}
|
|
7140
|
-
cleanUnsubscription(client, subHash, unsubHash) {
|
|
7206
|
+
cleanUnsubscription(client, subHash, unsubHash, subHashIsPrefix = false) {
|
|
7141
7207
|
if (unsubHash in client.subscriptions) {
|
|
7142
7208
|
delete client.subscriptions[unsubHash];
|
|
7143
7209
|
}
|
|
7144
|
-
if (
|
|
7145
|
-
|
|
7210
|
+
if (!subHashIsPrefix) {
|
|
7211
|
+
if (subHash in client.subscriptions) {
|
|
7212
|
+
delete client.subscriptions[subHash];
|
|
7213
|
+
}
|
|
7214
|
+
if (subHash in client.futures) {
|
|
7215
|
+
const error = new UnsubscribeError(this.id + ' ' + subHash);
|
|
7216
|
+
client.reject(error, subHash);
|
|
7217
|
+
}
|
|
7146
7218
|
}
|
|
7147
|
-
|
|
7148
|
-
const
|
|
7149
|
-
|
|
7219
|
+
else {
|
|
7220
|
+
const clientSubscriptions = Object.keys(client.subscriptions);
|
|
7221
|
+
for (let i = 0; i < clientSubscriptions.length; i++) {
|
|
7222
|
+
const sub = clientSubscriptions[i];
|
|
7223
|
+
if (sub.startsWith(subHash)) {
|
|
7224
|
+
delete client.subscriptions[sub];
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
7227
|
+
const clientFutures = Object.keys(client.futures);
|
|
7228
|
+
for (let i = 0; i < clientFutures.length; i++) {
|
|
7229
|
+
const future = clientFutures[i];
|
|
7230
|
+
if (future.startsWith(subHash)) {
|
|
7231
|
+
const error = new UnsubscribeError(this.id + ' ' + future);
|
|
7232
|
+
client.reject(error, future);
|
|
7233
|
+
}
|
|
7234
|
+
}
|
|
7150
7235
|
}
|
|
7151
7236
|
client.resolve(true, unsubHash);
|
|
7152
7237
|
}
|
package/js/src/binance.d.ts
CHANGED
|
@@ -1496,6 +1496,16 @@ export default class binance extends Exchange {
|
|
|
1496
1496
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
1497
1497
|
*/
|
|
1498
1498
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
1499
|
+
/**
|
|
1500
|
+
* @method
|
|
1501
|
+
* @name binance#fetchAllGreeks
|
|
1502
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
1503
|
+
* @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
|
|
1504
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
1505
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1506
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
1507
|
+
*/
|
|
1508
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
1499
1509
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
1500
1510
|
fetchTradingLimits(symbols?: Strings, params?: {}): Promise<Dict>;
|
|
1501
1511
|
/**
|
package/js/src/binance.js
CHANGED
|
@@ -67,6 +67,7 @@ export default class binance extends Exchange {
|
|
|
67
67
|
'editOrder': true,
|
|
68
68
|
'editOrders': true,
|
|
69
69
|
'fetchAccounts': undefined,
|
|
70
|
+
'fetchAllGreeks': true,
|
|
70
71
|
'fetchBalance': true,
|
|
71
72
|
'fetchBidsAsks': true,
|
|
72
73
|
'fetchBorrowInterest': true,
|
|
@@ -11540,6 +11541,7 @@ export default class binance extends Exchange {
|
|
|
11540
11541
|
const request = {};
|
|
11541
11542
|
if (symbol !== undefined) {
|
|
11542
11543
|
request['symbol'] = market['id'];
|
|
11544
|
+
symbol = market['symbol'];
|
|
11543
11545
|
}
|
|
11544
11546
|
if (since !== undefined) {
|
|
11545
11547
|
request['startTime'] = since;
|
|
@@ -11570,7 +11572,7 @@ export default class binance extends Exchange {
|
|
|
11570
11572
|
//
|
|
11571
11573
|
const settlements = this.parseSettlements(response, market);
|
|
11572
11574
|
const sorted = this.sortBy(settlements, 'timestamp');
|
|
11573
|
-
return this.filterBySymbolSinceLimit(sorted,
|
|
11575
|
+
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
11574
11576
|
}
|
|
11575
11577
|
parseSettlement(settlement, market) {
|
|
11576
11578
|
//
|
|
@@ -13335,6 +13337,47 @@ export default class binance extends Exchange {
|
|
|
13335
13337
|
//
|
|
13336
13338
|
return this.parseGreeks(response[0], market);
|
|
13337
13339
|
}
|
|
13340
|
+
/**
|
|
13341
|
+
* @method
|
|
13342
|
+
* @name binance#fetchAllGreeks
|
|
13343
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
13344
|
+
* @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
|
|
13345
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
13346
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
13347
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
13348
|
+
*/
|
|
13349
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
13350
|
+
await this.loadMarkets();
|
|
13351
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
13352
|
+
const request = {};
|
|
13353
|
+
let market = undefined;
|
|
13354
|
+
if (symbols !== undefined) {
|
|
13355
|
+
const symbolsLength = symbols.length;
|
|
13356
|
+
if (symbolsLength === 1) {
|
|
13357
|
+
market = this.market(symbols[0]);
|
|
13358
|
+
request['symbol'] = market['id'];
|
|
13359
|
+
}
|
|
13360
|
+
}
|
|
13361
|
+
const response = await this.eapiPublicGetMark(this.extend(request, params));
|
|
13362
|
+
//
|
|
13363
|
+
// [
|
|
13364
|
+
// {
|
|
13365
|
+
// "symbol": "BTC-231229-40000-C",
|
|
13366
|
+
// "markPrice": "2012",
|
|
13367
|
+
// "bidIV": "0.60236275",
|
|
13368
|
+
// "askIV": "0.62267244",
|
|
13369
|
+
// "markIV": "0.6125176",
|
|
13370
|
+
// "delta": "0.39111646",
|
|
13371
|
+
// "theta": "-32.13948531",
|
|
13372
|
+
// "gamma": "0.00004656",
|
|
13373
|
+
// "vega": "51.70062218",
|
|
13374
|
+
// "highPriceLimit": "6474",
|
|
13375
|
+
// "lowPriceLimit": "5"
|
|
13376
|
+
// }
|
|
13377
|
+
// ]
|
|
13378
|
+
//
|
|
13379
|
+
return this.parseAllGreeks(response, symbols);
|
|
13380
|
+
}
|
|
13338
13381
|
parseGreeks(greeks, market = undefined) {
|
|
13339
13382
|
//
|
|
13340
13383
|
// {
|
package/js/src/bitmex.d.ts
CHANGED
|
@@ -206,7 +206,7 @@ export default class bitmex extends Exchange {
|
|
|
206
206
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
207
207
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208
208
|
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
209
|
-
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - '
|
|
209
|
+
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
|
|
210
210
|
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
211
211
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
212
212
|
*/
|
package/js/src/bitmex.js
CHANGED
|
@@ -1990,7 +1990,7 @@ export default class bitmex extends Exchange {
|
|
|
1990
1990
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1991
1991
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1992
1992
|
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1993
|
-
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - '
|
|
1993
|
+
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
|
|
1994
1994
|
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
1995
1995
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1996
1996
|
*/
|
|
@@ -2020,7 +2020,7 @@ export default class bitmex extends Exchange {
|
|
|
2020
2020
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
2021
2021
|
if (isTriggerOrder || isTrailingAmountOrder) {
|
|
2022
2022
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
2023
|
-
const triggerAbove = (triggerDirection === 'above');
|
|
2023
|
+
const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
|
|
2024
2024
|
if ((type === 'limit') || (type === 'market')) {
|
|
2025
2025
|
this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
|
|
2026
2026
|
}
|
|
@@ -2077,7 +2077,7 @@ export default class bitmex extends Exchange {
|
|
|
2077
2077
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
2078
2078
|
if (isTrailingAmountOrder) {
|
|
2079
2079
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
2080
|
-
const triggerAbove = (triggerDirection === 'above');
|
|
2080
|
+
const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
|
|
2081
2081
|
if ((type === 'limit') || (type === 'market')) {
|
|
2082
2082
|
this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
|
|
2083
2083
|
}
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export default class bybit extends Exchange {
|
|
|
227
227
|
* @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
228
228
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
229
229
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
230
|
-
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, '
|
|
230
|
+
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
|
|
231
231
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
232
232
|
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
233
233
|
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
@@ -919,6 +919,17 @@ export default class bybit extends Exchange {
|
|
|
919
919
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
920
920
|
*/
|
|
921
921
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
922
|
+
/**
|
|
923
|
+
* @method
|
|
924
|
+
* @name bybit#fetchAllGreeks
|
|
925
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
926
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers
|
|
927
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
928
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
929
|
+
* @param {string} [params.baseCoin] the baseCoin of the symbol, default is BTC
|
|
930
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
931
|
+
*/
|
|
932
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
922
933
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
923
934
|
/**
|
|
924
935
|
* @method
|