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/dist/cjs/ccxt.js
CHANGED
|
@@ -181,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
181
181
|
|
|
182
182
|
//-----------------------------------------------------------------------------
|
|
183
183
|
// this is updated by vss.js when building
|
|
184
|
-
const version = '4.2.
|
|
184
|
+
const version = '4.2.80';
|
|
185
185
|
Exchange["default"].ccxtVersion = version;
|
|
186
186
|
const exchanges = {
|
|
187
187
|
'ace': ace,
|
|
@@ -468,6 +468,8 @@ class Exchange {
|
|
|
468
468
|
'fetchOpenOrder': undefined,
|
|
469
469
|
'fetchOpenOrders': undefined,
|
|
470
470
|
'fetchOpenOrdersWs': undefined,
|
|
471
|
+
'fetchOption': undefined,
|
|
472
|
+
'fetchOptionChain': undefined,
|
|
471
473
|
'fetchOrder': undefined,
|
|
472
474
|
'fetchOrderBook': true,
|
|
473
475
|
'fetchOrderBooks': undefined,
|
|
@@ -1437,6 +1439,12 @@ class Exchange {
|
|
|
1437
1439
|
intToBase16(elem) {
|
|
1438
1440
|
return elem.toString(16);
|
|
1439
1441
|
}
|
|
1442
|
+
extendExchangeOptions(newOptions) {
|
|
1443
|
+
this.options = this.extend(this.options, newOptions);
|
|
1444
|
+
}
|
|
1445
|
+
createSafeDictionary() {
|
|
1446
|
+
return {};
|
|
1447
|
+
}
|
|
1440
1448
|
/* eslint-enable */
|
|
1441
1449
|
// ------------------------------------------------------------------------
|
|
1442
1450
|
// ########################################################################
|
|
@@ -3137,7 +3145,7 @@ class Exchange {
|
|
|
3137
3145
|
throw new errors.BadResponse(errorMessage);
|
|
3138
3146
|
}
|
|
3139
3147
|
}
|
|
3140
|
-
marketIds(symbols) {
|
|
3148
|
+
marketIds(symbols = undefined) {
|
|
3141
3149
|
if (symbols === undefined) {
|
|
3142
3150
|
return symbols;
|
|
3143
3151
|
}
|
|
@@ -3147,7 +3155,7 @@ class Exchange {
|
|
|
3147
3155
|
}
|
|
3148
3156
|
return result;
|
|
3149
3157
|
}
|
|
3150
|
-
marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3158
|
+
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3151
3159
|
if (symbols === undefined) {
|
|
3152
3160
|
if (!allowEmpty) {
|
|
3153
3161
|
throw new errors.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
@@ -3188,7 +3196,7 @@ class Exchange {
|
|
|
3188
3196
|
}
|
|
3189
3197
|
return result;
|
|
3190
3198
|
}
|
|
3191
|
-
marketCodes(codes) {
|
|
3199
|
+
marketCodes(codes = undefined) {
|
|
3192
3200
|
if (codes === undefined) {
|
|
3193
3201
|
return codes;
|
|
3194
3202
|
}
|
|
@@ -4128,6 +4136,9 @@ class Exchange {
|
|
|
4128
4136
|
async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
|
|
4129
4137
|
throw new errors.NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
|
|
4130
4138
|
}
|
|
4139
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
4140
|
+
throw new errors.NotSupported(this.id + ' watchBidsAsks() is not supported yet');
|
|
4141
|
+
}
|
|
4131
4142
|
async watchTickers(symbols = undefined, params = {}) {
|
|
4132
4143
|
throw new errors.NotSupported(this.id + ' watchTickers() is not supported yet');
|
|
4133
4144
|
}
|
|
@@ -4480,6 +4491,12 @@ class Exchange {
|
|
|
4480
4491
|
async fetchGreeks(symbol, params = {}) {
|
|
4481
4492
|
throw new errors.NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
4482
4493
|
}
|
|
4494
|
+
async fetchOptionChain(code, params = {}) {
|
|
4495
|
+
throw new errors.NotSupported(this.id + ' fetchOptionChain() is not supported yet');
|
|
4496
|
+
}
|
|
4497
|
+
async fetchOption(symbol, params = {}) {
|
|
4498
|
+
throw new errors.NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
4499
|
+
}
|
|
4483
4500
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4484
4501
|
/**
|
|
4485
4502
|
* @method
|
|
@@ -5658,6 +5675,21 @@ class Exchange {
|
|
|
5658
5675
|
parseGreeks(greeks, market = undefined) {
|
|
5659
5676
|
throw new errors.NotSupported(this.id + ' parseGreeks () is not supported yet');
|
|
5660
5677
|
}
|
|
5678
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
5679
|
+
throw new errors.NotSupported(this.id + ' parseOption () is not supported yet');
|
|
5680
|
+
}
|
|
5681
|
+
parseOptionChain(response, currencyKey = undefined, symbolKey = undefined) {
|
|
5682
|
+
const optionStructures = {};
|
|
5683
|
+
for (let i = 0; i < response.length; i++) {
|
|
5684
|
+
const info = response[i];
|
|
5685
|
+
const currencyId = this.safeString(info, currencyKey);
|
|
5686
|
+
const currency = this.safeCurrency(currencyId);
|
|
5687
|
+
const marketId = this.safeString(info, symbolKey);
|
|
5688
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'option');
|
|
5689
|
+
optionStructures[market['symbol']] = this.parseOption(info, currency, market);
|
|
5690
|
+
}
|
|
5691
|
+
return optionStructures;
|
|
5692
|
+
}
|
|
5661
5693
|
parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
5662
5694
|
const marginModeStructures = {};
|
|
5663
5695
|
for (let i = 0; i < response.length; i++) {
|
package/dist/cjs/src/binance.js
CHANGED
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -70,6 +70,7 @@ class bybit extends bybit$1 {
|
|
|
70
70
|
'fetchDeposits': true,
|
|
71
71
|
'fetchDepositWithdrawFee': 'emulated',
|
|
72
72
|
'fetchDepositWithdrawFees': true,
|
|
73
|
+
'fetchFundingHistory': true,
|
|
73
74
|
'fetchFundingRate': true,
|
|
74
75
|
'fetchFundingRateHistory': true,
|
|
75
76
|
'fetchFundingRates': true,
|
|
@@ -110,7 +111,6 @@ class bybit extends bybit$1 {
|
|
|
110
111
|
'fetchUnderlyingAssets': false,
|
|
111
112
|
'fetchVolatilityHistory': true,
|
|
112
113
|
'fetchWithdrawals': true,
|
|
113
|
-
'fetchFundingHistory': true,
|
|
114
114
|
'repayCrossMargin': true,
|
|
115
115
|
'setLeverage': true,
|
|
116
116
|
'setMarginMode': true,
|
package/dist/cjs/src/deribit.js
CHANGED
|
@@ -70,6 +70,8 @@ class deribit extends deribit$1 {
|
|
|
70
70
|
'fetchMyTrades': true,
|
|
71
71
|
'fetchOHLCV': true,
|
|
72
72
|
'fetchOpenOrders': true,
|
|
73
|
+
'fetchOption': true,
|
|
74
|
+
'fetchOptionChain': true,
|
|
73
75
|
'fetchOrder': true,
|
|
74
76
|
'fetchOrderBook': true,
|
|
75
77
|
'fetchOrders': false,
|
|
@@ -3456,6 +3458,159 @@ class deribit extends deribit$1 {
|
|
|
3456
3458
|
'info': greeks,
|
|
3457
3459
|
};
|
|
3458
3460
|
}
|
|
3461
|
+
async fetchOption(symbol, params = {}) {
|
|
3462
|
+
/**
|
|
3463
|
+
* @method
|
|
3464
|
+
* @name deribit#fetchOption
|
|
3465
|
+
* @description fetches option data that is commonly found in an option chain
|
|
3466
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_instrument
|
|
3467
|
+
* @param {string} symbol unified market symbol
|
|
3468
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3469
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
3470
|
+
*/
|
|
3471
|
+
await this.loadMarkets();
|
|
3472
|
+
const market = this.market(symbol);
|
|
3473
|
+
const request = {
|
|
3474
|
+
'instrument_name': market['id'],
|
|
3475
|
+
};
|
|
3476
|
+
const response = await this.publicGetGetBookSummaryByInstrument(this.extend(request, params));
|
|
3477
|
+
//
|
|
3478
|
+
// {
|
|
3479
|
+
// "jsonrpc": "2.0",
|
|
3480
|
+
// "result": [
|
|
3481
|
+
// {
|
|
3482
|
+
// "mid_price": 0.04025,
|
|
3483
|
+
// "volume_usd": 11045.12,
|
|
3484
|
+
// "quote_currency": "BTC",
|
|
3485
|
+
// "estimated_delivery_price": 65444.72,
|
|
3486
|
+
// "creation_timestamp": 1711100949273,
|
|
3487
|
+
// "base_currency": "BTC",
|
|
3488
|
+
// "underlying_index": "BTC-27DEC24",
|
|
3489
|
+
// "underlying_price": 73742.14,
|
|
3490
|
+
// "volume": 4.0,
|
|
3491
|
+
// "interest_rate": 0.0,
|
|
3492
|
+
// "price_change": -6.9767,
|
|
3493
|
+
// "open_interest": 274.2,
|
|
3494
|
+
// "ask_price": 0.042,
|
|
3495
|
+
// "bid_price": 0.0385,
|
|
3496
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
3497
|
+
// "mark_price": 0.04007735,
|
|
3498
|
+
// "last": 0.04,
|
|
3499
|
+
// "low": 0.04,
|
|
3500
|
+
// "high": 0.043
|
|
3501
|
+
// }
|
|
3502
|
+
// ],
|
|
3503
|
+
// "usIn": 1711100949273223,
|
|
3504
|
+
// "usOut": 1711100949273580,
|
|
3505
|
+
// "usDiff": 357,
|
|
3506
|
+
// "testnet": false
|
|
3507
|
+
// }
|
|
3508
|
+
//
|
|
3509
|
+
const result = this.safeList(response, 'result', []);
|
|
3510
|
+
const chain = this.safeDict(result, 0, {});
|
|
3511
|
+
return this.parseOption(chain, undefined, market);
|
|
3512
|
+
}
|
|
3513
|
+
async fetchOptionChain(code, params = {}) {
|
|
3514
|
+
/**
|
|
3515
|
+
* @method
|
|
3516
|
+
* @name deribit#fetchOptionChain
|
|
3517
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
3518
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_currency
|
|
3519
|
+
* @param {string} currency base currency to fetch an option chain for
|
|
3520
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3521
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
3522
|
+
*/
|
|
3523
|
+
await this.loadMarkets();
|
|
3524
|
+
const currency = this.currency(code);
|
|
3525
|
+
const request = {
|
|
3526
|
+
'currency': currency['id'],
|
|
3527
|
+
'kind': 'option',
|
|
3528
|
+
};
|
|
3529
|
+
const response = await this.publicGetGetBookSummaryByCurrency(this.extend(request, params));
|
|
3530
|
+
//
|
|
3531
|
+
// {
|
|
3532
|
+
// "jsonrpc": "2.0",
|
|
3533
|
+
// "result": [
|
|
3534
|
+
// {
|
|
3535
|
+
// "mid_price": 0.4075,
|
|
3536
|
+
// "volume_usd": 2836.83,
|
|
3537
|
+
// "quote_currency": "BTC",
|
|
3538
|
+
// "estimated_delivery_price": 65479.26,
|
|
3539
|
+
// "creation_timestamp": 1711101594477,
|
|
3540
|
+
// "base_currency": "BTC",
|
|
3541
|
+
// "underlying_index": "BTC-28JUN24",
|
|
3542
|
+
// "underlying_price": 68827.27,
|
|
3543
|
+
// "volume": 0.1,
|
|
3544
|
+
// "interest_rate": 0.0,
|
|
3545
|
+
// "price_change": 0.0,
|
|
3546
|
+
// "open_interest": 364.1,
|
|
3547
|
+
// "ask_price": 0.411,
|
|
3548
|
+
// "bid_price": 0.404,
|
|
3549
|
+
// "instrument_name": "BTC-28JUN24-42000-C",
|
|
3550
|
+
// "mark_price": 0.40752052,
|
|
3551
|
+
// "last": 0.423,
|
|
3552
|
+
// "low": 0.423,
|
|
3553
|
+
// "high": 0.423
|
|
3554
|
+
// }
|
|
3555
|
+
// ],
|
|
3556
|
+
// "usIn": 1711101594456388,
|
|
3557
|
+
// "usOut": 1711101594484065,
|
|
3558
|
+
// "usDiff": 27677,
|
|
3559
|
+
// "testnet": false
|
|
3560
|
+
// }
|
|
3561
|
+
//
|
|
3562
|
+
const result = this.safeList(response, 'result', []);
|
|
3563
|
+
return this.parseOptionChain(result, 'base_currency', 'instrument_name');
|
|
3564
|
+
}
|
|
3565
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
3566
|
+
//
|
|
3567
|
+
// {
|
|
3568
|
+
// "mid_price": 0.04025,
|
|
3569
|
+
// "volume_usd": 11045.12,
|
|
3570
|
+
// "quote_currency": "BTC",
|
|
3571
|
+
// "estimated_delivery_price": 65444.72,
|
|
3572
|
+
// "creation_timestamp": 1711100949273,
|
|
3573
|
+
// "base_currency": "BTC",
|
|
3574
|
+
// "underlying_index": "BTC-27DEC24",
|
|
3575
|
+
// "underlying_price": 73742.14,
|
|
3576
|
+
// "volume": 4.0,
|
|
3577
|
+
// "interest_rate": 0.0,
|
|
3578
|
+
// "price_change": -6.9767,
|
|
3579
|
+
// "open_interest": 274.2,
|
|
3580
|
+
// "ask_price": 0.042,
|
|
3581
|
+
// "bid_price": 0.0385,
|
|
3582
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
3583
|
+
// "mark_price": 0.04007735,
|
|
3584
|
+
// "last": 0.04,
|
|
3585
|
+
// "low": 0.04,
|
|
3586
|
+
// "high": 0.043
|
|
3587
|
+
// }
|
|
3588
|
+
//
|
|
3589
|
+
const marketId = this.safeString(chain, 'instrument_name');
|
|
3590
|
+
market = this.safeMarket(marketId, market);
|
|
3591
|
+
const currencyId = this.safeString(chain, 'base_currency');
|
|
3592
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
3593
|
+
const timestamp = this.safeInteger(chain, 'timestamp');
|
|
3594
|
+
return {
|
|
3595
|
+
'info': chain,
|
|
3596
|
+
'currency': code['code'],
|
|
3597
|
+
'symbol': market['symbol'],
|
|
3598
|
+
'timestamp': timestamp,
|
|
3599
|
+
'datetime': this.iso8601(timestamp),
|
|
3600
|
+
'impliedVolatility': undefined,
|
|
3601
|
+
'openInterest': this.safeNumber(chain, 'open_interest'),
|
|
3602
|
+
'bidPrice': this.safeNumber(chain, 'bid_price'),
|
|
3603
|
+
'askPrice': this.safeNumber(chain, 'ask_price'),
|
|
3604
|
+
'midPrice': this.safeNumber(chain, 'mid_price'),
|
|
3605
|
+
'markPrice': this.safeNumber(chain, 'mark_price'),
|
|
3606
|
+
'lastPrice': this.safeNumber(chain, 'last'),
|
|
3607
|
+
'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
|
|
3608
|
+
'change': undefined,
|
|
3609
|
+
'percentage': this.safeNumber(chain, 'price_change'),
|
|
3610
|
+
'baseVolume': this.safeNumber(chain, 'volume'),
|
|
3611
|
+
'quoteVolume': this.safeNumber(chain, 'volume_usd'),
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3459
3614
|
nonce() {
|
|
3460
3615
|
return this.milliseconds();
|
|
3461
3616
|
}
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -4231,8 +4231,17 @@ class gate extends gate$1 {
|
|
|
4231
4231
|
'account': account,
|
|
4232
4232
|
};
|
|
4233
4233
|
if (amount !== undefined) {
|
|
4234
|
-
|
|
4235
|
-
|
|
4234
|
+
if (market['spot']) {
|
|
4235
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
4236
|
+
}
|
|
4237
|
+
else {
|
|
4238
|
+
if (side === 'sell') {
|
|
4239
|
+
request['size'] = Precise["default"].stringNeg(this.amountToPrecision(symbol, amount));
|
|
4240
|
+
}
|
|
4241
|
+
else {
|
|
4242
|
+
request['size'] = this.amountToPrecision(symbol, amount);
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4236
4245
|
}
|
|
4237
4246
|
if (price !== undefined) {
|
|
4238
4247
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -5030,8 +5039,8 @@ class gate extends gate$1 {
|
|
|
5030
5039
|
*/
|
|
5031
5040
|
await this.loadMarkets();
|
|
5032
5041
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
5033
|
-
const stop = this.
|
|
5034
|
-
params = this.omit(params, 'stop');
|
|
5042
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
5043
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
5035
5044
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
5036
5045
|
const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
5037
5046
|
let response = undefined;
|
|
@@ -5359,7 +5368,7 @@ class gate extends gate$1 {
|
|
|
5359
5368
|
'unrealizedPnl': this.parseNumber(unrealisedPnl),
|
|
5360
5369
|
'realizedPnl': this.safeNumber(position, 'realised_pnl'),
|
|
5361
5370
|
'contracts': this.parseNumber(Precise["default"].stringAbs(size)),
|
|
5362
|
-
'contractSize': this.
|
|
5371
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
5363
5372
|
// 'realisedPnl': position['realised_pnl'],
|
|
5364
5373
|
'marginRatio': undefined,
|
|
5365
5374
|
'liquidationPrice': this.safeNumber(position, 'liq_price'),
|
|
@@ -768,6 +768,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
768
768
|
*/
|
|
769
769
|
await this.loadMarkets();
|
|
770
770
|
const market = this.market(symbol);
|
|
771
|
+
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
772
|
+
params = this.omit(params, 'vaultAddress');
|
|
771
773
|
symbol = market['symbol'];
|
|
772
774
|
const order = {
|
|
773
775
|
'symbol': symbol,
|
|
@@ -777,7 +779,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
777
779
|
'price': price,
|
|
778
780
|
'params': params,
|
|
779
781
|
};
|
|
780
|
-
const
|
|
782
|
+
const globalParams = {};
|
|
783
|
+
if (vaultAddress !== undefined) {
|
|
784
|
+
globalParams['vaultAddress'] = vaultAddress;
|
|
785
|
+
}
|
|
786
|
+
const response = await this.createOrders([order], globalParams);
|
|
781
787
|
const first = this.safeDict(response, 0);
|
|
782
788
|
return first;
|
|
783
789
|
}
|
|
@@ -828,7 +834,6 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
828
834
|
const amount = this.safeString(rawOrder, 'amount');
|
|
829
835
|
const price = this.safeString(rawOrder, 'price');
|
|
830
836
|
let orderParams = this.safeDict(rawOrder, 'params', {});
|
|
831
|
-
orderParams = this.extend(params, orderParams);
|
|
832
837
|
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
833
838
|
const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
|
|
834
839
|
let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
|
|
@@ -876,6 +881,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
876
881
|
'tif': timeInForce,
|
|
877
882
|
};
|
|
878
883
|
}
|
|
884
|
+
orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
|
|
879
885
|
const orderObj = {
|
|
880
886
|
'a': this.parseToInt(market['baseId']),
|
|
881
887
|
'b': isBuy,
|
|
@@ -888,9 +894,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
888
894
|
if (clientOrderId !== undefined) {
|
|
889
895
|
orderObj['c'] = clientOrderId;
|
|
890
896
|
}
|
|
891
|
-
orderReq.push(orderObj);
|
|
897
|
+
orderReq.push(this.extend(orderObj, orderParams));
|
|
892
898
|
}
|
|
893
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
899
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
894
900
|
const orderAction = {
|
|
895
901
|
'type': 'order',
|
|
896
902
|
'orders': orderReq,
|
|
@@ -907,6 +913,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
907
913
|
'signature': signature,
|
|
908
914
|
// 'vaultAddress': vaultAddress,
|
|
909
915
|
};
|
|
916
|
+
if (vaultAddress !== undefined) {
|
|
917
|
+
params = this.omit(params, 'vaultAddress');
|
|
918
|
+
request['vaultAddress'] = vaultAddress;
|
|
919
|
+
}
|
|
910
920
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
911
921
|
//
|
|
912
922
|
// {
|
|
@@ -999,10 +1009,14 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
999
1009
|
}
|
|
1000
1010
|
}
|
|
1001
1011
|
cancelAction['cancels'] = cancelReq;
|
|
1002
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
1012
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1003
1013
|
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
1004
1014
|
request['action'] = cancelAction;
|
|
1005
1015
|
request['signature'] = signature;
|
|
1016
|
+
if (vaultAddress !== undefined) {
|
|
1017
|
+
params = this.omit(params, 'vaultAddress');
|
|
1018
|
+
request['vaultAddress'] = vaultAddress;
|
|
1019
|
+
}
|
|
1006
1020
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1007
1021
|
//
|
|
1008
1022
|
// {
|
|
@@ -1120,7 +1134,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1120
1134
|
'type': 'batchModify',
|
|
1121
1135
|
'modifies': [modifyReq],
|
|
1122
1136
|
};
|
|
1123
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
1137
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1124
1138
|
const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
|
|
1125
1139
|
const request = {
|
|
1126
1140
|
'action': modifyAction,
|
|
@@ -1128,6 +1142,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1128
1142
|
'signature': signature,
|
|
1129
1143
|
// 'vaultAddress': vaultAddress,
|
|
1130
1144
|
};
|
|
1145
|
+
if (vaultAddress !== undefined) {
|
|
1146
|
+
params = this.omit(params, 'vaultAddress');
|
|
1147
|
+
request['vaultAddress'] = vaultAddress;
|
|
1148
|
+
}
|
|
1131
1149
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1132
1150
|
//
|
|
1133
1151
|
// {
|
|
@@ -1726,7 +1744,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1726
1744
|
'isolated': isIsolated,
|
|
1727
1745
|
'hedged': undefined,
|
|
1728
1746
|
'side': side,
|
|
1729
|
-
'contracts': this.
|
|
1747
|
+
'contracts': this.safeNumber(entry, 'szi'),
|
|
1730
1748
|
'contractSize': undefined,
|
|
1731
1749
|
'entryPrice': this.safeNumber(entry, 'entryPx'),
|
|
1732
1750
|
'markPrice': undefined,
|
|
@@ -1773,7 +1791,13 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1773
1791
|
'isCross': isCross,
|
|
1774
1792
|
'leverage': leverage,
|
|
1775
1793
|
};
|
|
1776
|
-
|
|
1794
|
+
let vaultAddress = this.safeString(params, 'vaultAddress');
|
|
1795
|
+
if (vaultAddress !== undefined) {
|
|
1796
|
+
params = this.omit(params, 'vaultAddress');
|
|
1797
|
+
if (vaultAddress.startsWith('0x')) {
|
|
1798
|
+
vaultAddress = vaultAddress.replace('0x', '');
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1777
1801
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
1778
1802
|
const request = {
|
|
1779
1803
|
'action': updateAction,
|
|
@@ -1781,6 +1805,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1781
1805
|
'signature': signature,
|
|
1782
1806
|
// 'vaultAddress': vaultAddress,
|
|
1783
1807
|
};
|
|
1808
|
+
if (vaultAddress !== undefined) {
|
|
1809
|
+
request['vaultAddress'] = vaultAddress;
|
|
1810
|
+
}
|
|
1784
1811
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1785
1812
|
//
|
|
1786
1813
|
// {
|
|
@@ -1819,7 +1846,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1819
1846
|
'isCross': isCross,
|
|
1820
1847
|
'leverage': leverage,
|
|
1821
1848
|
};
|
|
1822
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
1849
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1823
1850
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
1824
1851
|
const request = {
|
|
1825
1852
|
'action': updateAction,
|
|
@@ -1827,6 +1854,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1827
1854
|
'signature': signature,
|
|
1828
1855
|
// 'vaultAddress': vaultAddress,
|
|
1829
1856
|
};
|
|
1857
|
+
if (vaultAddress !== undefined) {
|
|
1858
|
+
params = this.omit(params, 'vaultAddress');
|
|
1859
|
+
request['vaultAddress'] = vaultAddress;
|
|
1860
|
+
}
|
|
1830
1861
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1831
1862
|
//
|
|
1832
1863
|
// {
|
|
@@ -1879,7 +1910,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1879
1910
|
'isBuy': true,
|
|
1880
1911
|
'ntli': sz,
|
|
1881
1912
|
};
|
|
1882
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
1913
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1883
1914
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
1884
1915
|
const request = {
|
|
1885
1916
|
'action': updateAction,
|
|
@@ -1887,6 +1918,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1887
1918
|
'signature': signature,
|
|
1888
1919
|
// 'vaultAddress': vaultAddress,
|
|
1889
1920
|
};
|
|
1921
|
+
if (vaultAddress !== undefined) {
|
|
1922
|
+
params = this.omit(params, 'vaultAddress');
|
|
1923
|
+
request['vaultAddress'] = vaultAddress;
|
|
1924
|
+
}
|
|
1890
1925
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1891
1926
|
//
|
|
1892
1927
|
// {
|
|
@@ -1985,6 +2020,15 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1985
2020
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1986
2021
|
return response;
|
|
1987
2022
|
}
|
|
2023
|
+
formatVaultAddress(address = undefined) {
|
|
2024
|
+
if (address === undefined) {
|
|
2025
|
+
return undefined;
|
|
2026
|
+
}
|
|
2027
|
+
if (address.startsWith('0x')) {
|
|
2028
|
+
return address.replace('0x', '');
|
|
2029
|
+
}
|
|
2030
|
+
return address;
|
|
2031
|
+
}
|
|
1988
2032
|
handlePublicAddress(methodName, params) {
|
|
1989
2033
|
let userAux = undefined;
|
|
1990
2034
|
[userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
|
|
@@ -84,7 +84,7 @@ class binance extends binance$1 {
|
|
|
84
84
|
'future': 200,
|
|
85
85
|
'delivery': 200,
|
|
86
86
|
},
|
|
87
|
-
'streamBySubscriptionsHash':
|
|
87
|
+
'streamBySubscriptionsHash': this.createSafeDictionary(),
|
|
88
88
|
'streamIndex': -1,
|
|
89
89
|
// get updates every 1000ms or 100ms
|
|
90
90
|
// or every 0ms in real-time for futures
|
|
@@ -92,7 +92,7 @@ class binance extends binance$1 {
|
|
|
92
92
|
'tradesLimit': 1000,
|
|
93
93
|
'ordersLimit': 1000,
|
|
94
94
|
'OHLCVLimit': 1000,
|
|
95
|
-
'requestId':
|
|
95
|
+
'requestId': this.createSafeDictionary(),
|
|
96
96
|
'watchOrderBookLimit': 1000,
|
|
97
97
|
'watchTrades': {
|
|
98
98
|
'name': 'trade', // 'trade' or 'aggTrade'
|
|
@@ -126,14 +126,14 @@ class binance extends binance$1 {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
requestId(url) {
|
|
129
|
-
const options = this.
|
|
129
|
+
const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
|
|
130
130
|
const previousValue = this.safeInteger(options, url, 0);
|
|
131
131
|
const newValue = this.sum(previousValue, 1);
|
|
132
132
|
this.options['requestId'][url] = newValue;
|
|
133
133
|
return newValue;
|
|
134
134
|
}
|
|
135
135
|
stream(type, subscriptionHash, numSubscriptions = 1) {
|
|
136
|
-
const streamBySubscriptionsHash = this.
|
|
136
|
+
const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
|
|
137
137
|
let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
|
|
138
138
|
if (stream === undefined) {
|
|
139
139
|
let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
|
|
@@ -146,7 +146,7 @@ class binance extends binance$1 {
|
|
|
146
146
|
this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
|
|
147
147
|
const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
|
|
148
148
|
if (subscriptionsByStreams === undefined) {
|
|
149
|
-
this.options['numSubscriptionsByStream'] =
|
|
149
|
+
this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
|
|
150
150
|
}
|
|
151
151
|
const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
|
|
152
152
|
const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
|
|
@@ -385,7 +385,8 @@ class bitopro extends bitopro$1 {
|
|
|
385
385
|
},
|
|
386
386
|
},
|
|
387
387
|
};
|
|
388
|
-
this.options = this.extend(defaultOptions, this.options);
|
|
388
|
+
// this.options = this.extend (defaultOptions, this.options);
|
|
389
|
+
this.extendExchangeOptions(defaultOptions);
|
|
389
390
|
const originalHeaders = this.options['ws']['options']['headers'];
|
|
390
391
|
const headers = {
|
|
391
392
|
'X-BITOPRO-API': 'ccxt',
|
|
@@ -415,7 +415,7 @@ class gemini extends gemini$1 {
|
|
|
415
415
|
const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
|
|
416
416
|
return orderbook.limit();
|
|
417
417
|
}
|
|
418
|
-
async watchBidsAsks(symbols
|
|
418
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
419
419
|
/**
|
|
420
420
|
* @method
|
|
421
421
|
* @name gemini#watchBidsAsks
|
|
@@ -911,7 +911,8 @@ class gemini extends gemini$1 {
|
|
|
911
911
|
},
|
|
912
912
|
},
|
|
913
913
|
};
|
|
914
|
-
this.options = this.extend(defaultOptions, this.options);
|
|
914
|
+
// this.options = this.extend (defaultOptions, this.options);
|
|
915
|
+
this.extendExchangeOptions(defaultOptions);
|
|
915
916
|
const originalHeaders = this.options['ws']['options']['headers'];
|
|
916
917
|
const headers = {
|
|
917
918
|
'X-GEMINI-APIKEY': this.apiKey,
|
|
@@ -20,7 +20,11 @@ class phemex extends phemex$1 {
|
|
|
20
20
|
'watchOrders': true,
|
|
21
21
|
'watchOrderBook': true,
|
|
22
22
|
'watchOHLCV': true,
|
|
23
|
-
'watchPositions': undefined,
|
|
23
|
+
'watchPositions': undefined,
|
|
24
|
+
// mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
|
|
25
|
+
'watchOrderBookForSymbols': false,
|
|
26
|
+
'watchTradesForSymbols': false,
|
|
27
|
+
'watchOHLCVForSymbols': false,
|
|
24
28
|
},
|
|
25
29
|
'urls': {
|
|
26
30
|
'test': {
|
|
@@ -560,9 +564,10 @@ class phemex extends phemex$1 {
|
|
|
560
564
|
/**
|
|
561
565
|
* @method
|
|
562
566
|
* @name phemex#watchOrderBook
|
|
567
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
|
|
563
568
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
|
|
564
569
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
|
|
565
|
-
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-
|
|
570
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
|
|
566
571
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
567
572
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
568
573
|
* @param {int} [limit] the maximum amount of order book entries to return
|
package/dist/cjs/src/upbit.js
CHANGED
|
@@ -78,6 +78,7 @@ class upbit extends upbit$1 {
|
|
|
78
78
|
'1m': 'minutes',
|
|
79
79
|
'3m': 'minutes',
|
|
80
80
|
'5m': 'minutes',
|
|
81
|
+
'10m': 'minutes',
|
|
81
82
|
'15m': 'minutes',
|
|
82
83
|
'30m': 'minutes',
|
|
83
84
|
'1h': 'minutes',
|
|
@@ -107,6 +108,7 @@ class upbit extends upbit$1 {
|
|
|
107
108
|
'candles/minutes/1',
|
|
108
109
|
'candles/minutes/3',
|
|
109
110
|
'candles/minutes/5',
|
|
111
|
+
'candles/minutes/10',
|
|
110
112
|
'candles/minutes/15',
|
|
111
113
|
'candles/minutes/30',
|
|
112
114
|
'candles/minutes/60',
|