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/README.md
CHANGED
|
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
213
213
|
|
|
214
214
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
215
215
|
|
|
216
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
217
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
216
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.80/dist/ccxt.browser.js
|
|
217
|
+
* unpkg: https://unpkg.com/ccxt@4.2.80/dist/ccxt.browser.js
|
|
218
218
|
|
|
219
219
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
220
220
|
|
|
221
221
|
```HTML
|
|
222
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
222
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.80/dist/ccxt.browser.js"></script>
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
Creates a global `ccxt` object:
|
package/build.sh
CHANGED
package/dist/ccxt.browser.js
CHANGED
|
@@ -7672,6 +7672,8 @@ class Exchange {
|
|
|
7672
7672
|
'fetchOpenOrder': undefined,
|
|
7673
7673
|
'fetchOpenOrders': undefined,
|
|
7674
7674
|
'fetchOpenOrdersWs': undefined,
|
|
7675
|
+
'fetchOption': undefined,
|
|
7676
|
+
'fetchOptionChain': undefined,
|
|
7675
7677
|
'fetchOrder': undefined,
|
|
7676
7678
|
'fetchOrderBook': true,
|
|
7677
7679
|
'fetchOrderBooks': undefined,
|
|
@@ -8643,6 +8645,12 @@ class Exchange {
|
|
|
8643
8645
|
intToBase16(elem) {
|
|
8644
8646
|
return elem.toString(16);
|
|
8645
8647
|
}
|
|
8648
|
+
extendExchangeOptions(newOptions) {
|
|
8649
|
+
this.options = this.extend(this.options, newOptions);
|
|
8650
|
+
}
|
|
8651
|
+
createSafeDictionary() {
|
|
8652
|
+
return {};
|
|
8653
|
+
}
|
|
8646
8654
|
/* eslint-enable */
|
|
8647
8655
|
// ------------------------------------------------------------------------
|
|
8648
8656
|
// ########################################################################
|
|
@@ -10343,7 +10351,7 @@ class Exchange {
|
|
|
10343
10351
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadResponse(errorMessage);
|
|
10344
10352
|
}
|
|
10345
10353
|
}
|
|
10346
|
-
marketIds(symbols) {
|
|
10354
|
+
marketIds(symbols = undefined) {
|
|
10347
10355
|
if (symbols === undefined) {
|
|
10348
10356
|
return symbols;
|
|
10349
10357
|
}
|
|
@@ -10353,7 +10361,7 @@ class Exchange {
|
|
|
10353
10361
|
}
|
|
10354
10362
|
return result;
|
|
10355
10363
|
}
|
|
10356
|
-
marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
10364
|
+
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
10357
10365
|
if (symbols === undefined) {
|
|
10358
10366
|
if (!allowEmpty) {
|
|
10359
10367
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
@@ -10394,7 +10402,7 @@ class Exchange {
|
|
|
10394
10402
|
}
|
|
10395
10403
|
return result;
|
|
10396
10404
|
}
|
|
10397
|
-
marketCodes(codes) {
|
|
10405
|
+
marketCodes(codes = undefined) {
|
|
10398
10406
|
if (codes === undefined) {
|
|
10399
10407
|
return codes;
|
|
10400
10408
|
}
|
|
@@ -11334,6 +11342,9 @@ class Exchange {
|
|
|
11334
11342
|
async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
|
|
11335
11343
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
|
|
11336
11344
|
}
|
|
11345
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
11346
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchBidsAsks() is not supported yet');
|
|
11347
|
+
}
|
|
11337
11348
|
async watchTickers(symbols = undefined, params = {}) {
|
|
11338
11349
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTickers() is not supported yet');
|
|
11339
11350
|
}
|
|
@@ -11686,6 +11697,12 @@ class Exchange {
|
|
|
11686
11697
|
async fetchGreeks(symbol, params = {}) {
|
|
11687
11698
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
11688
11699
|
}
|
|
11700
|
+
async fetchOptionChain(code, params = {}) {
|
|
11701
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOptionChain() is not supported yet');
|
|
11702
|
+
}
|
|
11703
|
+
async fetchOption(symbol, params = {}) {
|
|
11704
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
11705
|
+
}
|
|
11689
11706
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11690
11707
|
/**
|
|
11691
11708
|
* @method
|
|
@@ -12864,6 +12881,21 @@ class Exchange {
|
|
|
12864
12881
|
parseGreeks(greeks, market = undefined) {
|
|
12865
12882
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseGreeks () is not supported yet');
|
|
12866
12883
|
}
|
|
12884
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
12885
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOption () is not supported yet');
|
|
12886
|
+
}
|
|
12887
|
+
parseOptionChain(response, currencyKey = undefined, symbolKey = undefined) {
|
|
12888
|
+
const optionStructures = {};
|
|
12889
|
+
for (let i = 0; i < response.length; i++) {
|
|
12890
|
+
const info = response[i];
|
|
12891
|
+
const currencyId = this.safeString(info, currencyKey);
|
|
12892
|
+
const currency = this.safeCurrency(currencyId);
|
|
12893
|
+
const marketId = this.safeString(info, symbolKey);
|
|
12894
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'option');
|
|
12895
|
+
optionStructures[market['symbol']] = this.parseOption(info, currency, market);
|
|
12896
|
+
}
|
|
12897
|
+
return optionStructures;
|
|
12898
|
+
}
|
|
12867
12899
|
parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
12868
12900
|
const marginModeStructures = {};
|
|
12869
12901
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -20818,7 +20850,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20818
20850
|
}
|
|
20819
20851
|
isInverse(type, subType = undefined) {
|
|
20820
20852
|
if (subType === undefined) {
|
|
20821
|
-
return type === 'delivery';
|
|
20853
|
+
return (type === 'delivery');
|
|
20822
20854
|
}
|
|
20823
20855
|
else {
|
|
20824
20856
|
return subType === 'inverse';
|
|
@@ -83575,6 +83607,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
83575
83607
|
'fetchDeposits': true,
|
|
83576
83608
|
'fetchDepositWithdrawFee': 'emulated',
|
|
83577
83609
|
'fetchDepositWithdrawFees': true,
|
|
83610
|
+
'fetchFundingHistory': true,
|
|
83578
83611
|
'fetchFundingRate': true,
|
|
83579
83612
|
'fetchFundingRateHistory': true,
|
|
83580
83613
|
'fetchFundingRates': true,
|
|
@@ -83615,7 +83648,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
83615
83648
|
'fetchUnderlyingAssets': false,
|
|
83616
83649
|
'fetchVolatilityHistory': true,
|
|
83617
83650
|
'fetchWithdrawals': true,
|
|
83618
|
-
'fetchFundingHistory': true,
|
|
83619
83651
|
'repayCrossMargin': true,
|
|
83620
83652
|
'setLeverage': true,
|
|
83621
83653
|
'setMarginMode': true,
|
|
@@ -125438,6 +125470,8 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
125438
125470
|
'fetchMyTrades': true,
|
|
125439
125471
|
'fetchOHLCV': true,
|
|
125440
125472
|
'fetchOpenOrders': true,
|
|
125473
|
+
'fetchOption': true,
|
|
125474
|
+
'fetchOptionChain': true,
|
|
125441
125475
|
'fetchOrder': true,
|
|
125442
125476
|
'fetchOrderBook': true,
|
|
125443
125477
|
'fetchOrders': false,
|
|
@@ -128824,6 +128858,159 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
128824
128858
|
'info': greeks,
|
|
128825
128859
|
};
|
|
128826
128860
|
}
|
|
128861
|
+
async fetchOption(symbol, params = {}) {
|
|
128862
|
+
/**
|
|
128863
|
+
* @method
|
|
128864
|
+
* @name deribit#fetchOption
|
|
128865
|
+
* @description fetches option data that is commonly found in an option chain
|
|
128866
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_instrument
|
|
128867
|
+
* @param {string} symbol unified market symbol
|
|
128868
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
128869
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
128870
|
+
*/
|
|
128871
|
+
await this.loadMarkets();
|
|
128872
|
+
const market = this.market(symbol);
|
|
128873
|
+
const request = {
|
|
128874
|
+
'instrument_name': market['id'],
|
|
128875
|
+
};
|
|
128876
|
+
const response = await this.publicGetGetBookSummaryByInstrument(this.extend(request, params));
|
|
128877
|
+
//
|
|
128878
|
+
// {
|
|
128879
|
+
// "jsonrpc": "2.0",
|
|
128880
|
+
// "result": [
|
|
128881
|
+
// {
|
|
128882
|
+
// "mid_price": 0.04025,
|
|
128883
|
+
// "volume_usd": 11045.12,
|
|
128884
|
+
// "quote_currency": "BTC",
|
|
128885
|
+
// "estimated_delivery_price": 65444.72,
|
|
128886
|
+
// "creation_timestamp": 1711100949273,
|
|
128887
|
+
// "base_currency": "BTC",
|
|
128888
|
+
// "underlying_index": "BTC-27DEC24",
|
|
128889
|
+
// "underlying_price": 73742.14,
|
|
128890
|
+
// "volume": 4.0,
|
|
128891
|
+
// "interest_rate": 0.0,
|
|
128892
|
+
// "price_change": -6.9767,
|
|
128893
|
+
// "open_interest": 274.2,
|
|
128894
|
+
// "ask_price": 0.042,
|
|
128895
|
+
// "bid_price": 0.0385,
|
|
128896
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
128897
|
+
// "mark_price": 0.04007735,
|
|
128898
|
+
// "last": 0.04,
|
|
128899
|
+
// "low": 0.04,
|
|
128900
|
+
// "high": 0.043
|
|
128901
|
+
// }
|
|
128902
|
+
// ],
|
|
128903
|
+
// "usIn": 1711100949273223,
|
|
128904
|
+
// "usOut": 1711100949273580,
|
|
128905
|
+
// "usDiff": 357,
|
|
128906
|
+
// "testnet": false
|
|
128907
|
+
// }
|
|
128908
|
+
//
|
|
128909
|
+
const result = this.safeList(response, 'result', []);
|
|
128910
|
+
const chain = this.safeDict(result, 0, {});
|
|
128911
|
+
return this.parseOption(chain, undefined, market);
|
|
128912
|
+
}
|
|
128913
|
+
async fetchOptionChain(code, params = {}) {
|
|
128914
|
+
/**
|
|
128915
|
+
* @method
|
|
128916
|
+
* @name deribit#fetchOptionChain
|
|
128917
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
128918
|
+
* @see https://docs.deribit.com/#public-get_book_summary_by_currency
|
|
128919
|
+
* @param {string} currency base currency to fetch an option chain for
|
|
128920
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
128921
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
128922
|
+
*/
|
|
128923
|
+
await this.loadMarkets();
|
|
128924
|
+
const currency = this.currency(code);
|
|
128925
|
+
const request = {
|
|
128926
|
+
'currency': currency['id'],
|
|
128927
|
+
'kind': 'option',
|
|
128928
|
+
};
|
|
128929
|
+
const response = await this.publicGetGetBookSummaryByCurrency(this.extend(request, params));
|
|
128930
|
+
//
|
|
128931
|
+
// {
|
|
128932
|
+
// "jsonrpc": "2.0",
|
|
128933
|
+
// "result": [
|
|
128934
|
+
// {
|
|
128935
|
+
// "mid_price": 0.4075,
|
|
128936
|
+
// "volume_usd": 2836.83,
|
|
128937
|
+
// "quote_currency": "BTC",
|
|
128938
|
+
// "estimated_delivery_price": 65479.26,
|
|
128939
|
+
// "creation_timestamp": 1711101594477,
|
|
128940
|
+
// "base_currency": "BTC",
|
|
128941
|
+
// "underlying_index": "BTC-28JUN24",
|
|
128942
|
+
// "underlying_price": 68827.27,
|
|
128943
|
+
// "volume": 0.1,
|
|
128944
|
+
// "interest_rate": 0.0,
|
|
128945
|
+
// "price_change": 0.0,
|
|
128946
|
+
// "open_interest": 364.1,
|
|
128947
|
+
// "ask_price": 0.411,
|
|
128948
|
+
// "bid_price": 0.404,
|
|
128949
|
+
// "instrument_name": "BTC-28JUN24-42000-C",
|
|
128950
|
+
// "mark_price": 0.40752052,
|
|
128951
|
+
// "last": 0.423,
|
|
128952
|
+
// "low": 0.423,
|
|
128953
|
+
// "high": 0.423
|
|
128954
|
+
// }
|
|
128955
|
+
// ],
|
|
128956
|
+
// "usIn": 1711101594456388,
|
|
128957
|
+
// "usOut": 1711101594484065,
|
|
128958
|
+
// "usDiff": 27677,
|
|
128959
|
+
// "testnet": false
|
|
128960
|
+
// }
|
|
128961
|
+
//
|
|
128962
|
+
const result = this.safeList(response, 'result', []);
|
|
128963
|
+
return this.parseOptionChain(result, 'base_currency', 'instrument_name');
|
|
128964
|
+
}
|
|
128965
|
+
parseOption(chain, currency = undefined, market = undefined) {
|
|
128966
|
+
//
|
|
128967
|
+
// {
|
|
128968
|
+
// "mid_price": 0.04025,
|
|
128969
|
+
// "volume_usd": 11045.12,
|
|
128970
|
+
// "quote_currency": "BTC",
|
|
128971
|
+
// "estimated_delivery_price": 65444.72,
|
|
128972
|
+
// "creation_timestamp": 1711100949273,
|
|
128973
|
+
// "base_currency": "BTC",
|
|
128974
|
+
// "underlying_index": "BTC-27DEC24",
|
|
128975
|
+
// "underlying_price": 73742.14,
|
|
128976
|
+
// "volume": 4.0,
|
|
128977
|
+
// "interest_rate": 0.0,
|
|
128978
|
+
// "price_change": -6.9767,
|
|
128979
|
+
// "open_interest": 274.2,
|
|
128980
|
+
// "ask_price": 0.042,
|
|
128981
|
+
// "bid_price": 0.0385,
|
|
128982
|
+
// "instrument_name": "BTC-27DEC24-240000-C",
|
|
128983
|
+
// "mark_price": 0.04007735,
|
|
128984
|
+
// "last": 0.04,
|
|
128985
|
+
// "low": 0.04,
|
|
128986
|
+
// "high": 0.043
|
|
128987
|
+
// }
|
|
128988
|
+
//
|
|
128989
|
+
const marketId = this.safeString(chain, 'instrument_name');
|
|
128990
|
+
market = this.safeMarket(marketId, market);
|
|
128991
|
+
const currencyId = this.safeString(chain, 'base_currency');
|
|
128992
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
128993
|
+
const timestamp = this.safeInteger(chain, 'timestamp');
|
|
128994
|
+
return {
|
|
128995
|
+
'info': chain,
|
|
128996
|
+
'currency': code['code'],
|
|
128997
|
+
'symbol': market['symbol'],
|
|
128998
|
+
'timestamp': timestamp,
|
|
128999
|
+
'datetime': this.iso8601(timestamp),
|
|
129000
|
+
'impliedVolatility': undefined,
|
|
129001
|
+
'openInterest': this.safeNumber(chain, 'open_interest'),
|
|
129002
|
+
'bidPrice': this.safeNumber(chain, 'bid_price'),
|
|
129003
|
+
'askPrice': this.safeNumber(chain, 'ask_price'),
|
|
129004
|
+
'midPrice': this.safeNumber(chain, 'mid_price'),
|
|
129005
|
+
'markPrice': this.safeNumber(chain, 'mark_price'),
|
|
129006
|
+
'lastPrice': this.safeNumber(chain, 'last'),
|
|
129007
|
+
'underlyingPrice': this.safeNumber(chain, 'underlying_price'),
|
|
129008
|
+
'change': undefined,
|
|
129009
|
+
'percentage': this.safeNumber(chain, 'price_change'),
|
|
129010
|
+
'baseVolume': this.safeNumber(chain, 'volume'),
|
|
129011
|
+
'quoteVolume': this.safeNumber(chain, 'volume_usd'),
|
|
129012
|
+
};
|
|
129013
|
+
}
|
|
128827
129014
|
nonce() {
|
|
128828
129015
|
return this.milliseconds();
|
|
128829
129016
|
}
|
|
@@ -140192,8 +140379,17 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
140192
140379
|
'account': account,
|
|
140193
140380
|
};
|
|
140194
140381
|
if (amount !== undefined) {
|
|
140195
|
-
|
|
140196
|
-
|
|
140382
|
+
if (market['spot']) {
|
|
140383
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
140384
|
+
}
|
|
140385
|
+
else {
|
|
140386
|
+
if (side === 'sell') {
|
|
140387
|
+
request['size'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.amountToPrecision(symbol, amount));
|
|
140388
|
+
}
|
|
140389
|
+
else {
|
|
140390
|
+
request['size'] = this.amountToPrecision(symbol, amount);
|
|
140391
|
+
}
|
|
140392
|
+
}
|
|
140197
140393
|
}
|
|
140198
140394
|
if (price !== undefined) {
|
|
140199
140395
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -140991,8 +141187,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
140991
141187
|
*/
|
|
140992
141188
|
await this.loadMarkets();
|
|
140993
141189
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
140994
|
-
const stop = this.
|
|
140995
|
-
params = this.omit(params, 'stop');
|
|
141190
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
141191
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
140996
141192
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
140997
141193
|
const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
140998
141194
|
let response = undefined;
|
|
@@ -141320,7 +141516,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
141320
141516
|
'unrealizedPnl': this.parseNumber(unrealisedPnl),
|
|
141321
141517
|
'realizedPnl': this.safeNumber(position, 'realised_pnl'),
|
|
141322
141518
|
'contracts': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(size)),
|
|
141323
|
-
'contractSize': this.
|
|
141519
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
141324
141520
|
// 'realisedPnl': position['realised_pnl'],
|
|
141325
141521
|
'marginRatio': undefined,
|
|
141326
141522
|
'liquidationPrice': this.safeNumber(position, 'liq_price'),
|
|
@@ -162692,6 +162888,8 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162692
162888
|
*/
|
|
162693
162889
|
await this.loadMarkets();
|
|
162694
162890
|
const market = this.market(symbol);
|
|
162891
|
+
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
162892
|
+
params = this.omit(params, 'vaultAddress');
|
|
162695
162893
|
symbol = market['symbol'];
|
|
162696
162894
|
const order = {
|
|
162697
162895
|
'symbol': symbol,
|
|
@@ -162701,7 +162899,11 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162701
162899
|
'price': price,
|
|
162702
162900
|
'params': params,
|
|
162703
162901
|
};
|
|
162704
|
-
const
|
|
162902
|
+
const globalParams = {};
|
|
162903
|
+
if (vaultAddress !== undefined) {
|
|
162904
|
+
globalParams['vaultAddress'] = vaultAddress;
|
|
162905
|
+
}
|
|
162906
|
+
const response = await this.createOrders([order], globalParams);
|
|
162705
162907
|
const first = this.safeDict(response, 0);
|
|
162706
162908
|
return first;
|
|
162707
162909
|
}
|
|
@@ -162752,7 +162954,6 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162752
162954
|
const amount = this.safeString(rawOrder, 'amount');
|
|
162753
162955
|
const price = this.safeString(rawOrder, 'price');
|
|
162754
162956
|
let orderParams = this.safeDict(rawOrder, 'params', {});
|
|
162755
|
-
orderParams = this.extend(params, orderParams);
|
|
162756
162957
|
const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
|
|
162757
162958
|
const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
|
|
162758
162959
|
let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
|
|
@@ -162800,6 +163001,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162800
163001
|
'tif': timeInForce,
|
|
162801
163002
|
};
|
|
162802
163003
|
}
|
|
163004
|
+
orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
|
|
162803
163005
|
const orderObj = {
|
|
162804
163006
|
'a': this.parseToInt(market['baseId']),
|
|
162805
163007
|
'b': isBuy,
|
|
@@ -162812,9 +163014,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162812
163014
|
if (clientOrderId !== undefined) {
|
|
162813
163015
|
orderObj['c'] = clientOrderId;
|
|
162814
163016
|
}
|
|
162815
|
-
orderReq.push(orderObj);
|
|
163017
|
+
orderReq.push(this.extend(orderObj, orderParams));
|
|
162816
163018
|
}
|
|
162817
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
163019
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
162818
163020
|
const orderAction = {
|
|
162819
163021
|
'type': 'order',
|
|
162820
163022
|
'orders': orderReq,
|
|
@@ -162831,6 +163033,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162831
163033
|
'signature': signature,
|
|
162832
163034
|
// 'vaultAddress': vaultAddress,
|
|
162833
163035
|
};
|
|
163036
|
+
if (vaultAddress !== undefined) {
|
|
163037
|
+
params = this.omit(params, 'vaultAddress');
|
|
163038
|
+
request['vaultAddress'] = vaultAddress;
|
|
163039
|
+
}
|
|
162834
163040
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
162835
163041
|
//
|
|
162836
163042
|
// {
|
|
@@ -162923,10 +163129,14 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
162923
163129
|
}
|
|
162924
163130
|
}
|
|
162925
163131
|
cancelAction['cancels'] = cancelReq;
|
|
162926
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
163132
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
162927
163133
|
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
162928
163134
|
request['action'] = cancelAction;
|
|
162929
163135
|
request['signature'] = signature;
|
|
163136
|
+
if (vaultAddress !== undefined) {
|
|
163137
|
+
params = this.omit(params, 'vaultAddress');
|
|
163138
|
+
request['vaultAddress'] = vaultAddress;
|
|
163139
|
+
}
|
|
162930
163140
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
162931
163141
|
//
|
|
162932
163142
|
// {
|
|
@@ -163044,7 +163254,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163044
163254
|
'type': 'batchModify',
|
|
163045
163255
|
'modifies': [modifyReq],
|
|
163046
163256
|
};
|
|
163047
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
163257
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
163048
163258
|
const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
|
|
163049
163259
|
const request = {
|
|
163050
163260
|
'action': modifyAction,
|
|
@@ -163052,6 +163262,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163052
163262
|
'signature': signature,
|
|
163053
163263
|
// 'vaultAddress': vaultAddress,
|
|
163054
163264
|
};
|
|
163265
|
+
if (vaultAddress !== undefined) {
|
|
163266
|
+
params = this.omit(params, 'vaultAddress');
|
|
163267
|
+
request['vaultAddress'] = vaultAddress;
|
|
163268
|
+
}
|
|
163055
163269
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
163056
163270
|
//
|
|
163057
163271
|
// {
|
|
@@ -163650,7 +163864,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163650
163864
|
'isolated': isIsolated,
|
|
163651
163865
|
'hedged': undefined,
|
|
163652
163866
|
'side': side,
|
|
163653
|
-
'contracts': this.
|
|
163867
|
+
'contracts': this.safeNumber(entry, 'szi'),
|
|
163654
163868
|
'contractSize': undefined,
|
|
163655
163869
|
'entryPrice': this.safeNumber(entry, 'entryPx'),
|
|
163656
163870
|
'markPrice': undefined,
|
|
@@ -163697,7 +163911,13 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163697
163911
|
'isCross': isCross,
|
|
163698
163912
|
'leverage': leverage,
|
|
163699
163913
|
};
|
|
163700
|
-
|
|
163914
|
+
let vaultAddress = this.safeString(params, 'vaultAddress');
|
|
163915
|
+
if (vaultAddress !== undefined) {
|
|
163916
|
+
params = this.omit(params, 'vaultAddress');
|
|
163917
|
+
if (vaultAddress.startsWith('0x')) {
|
|
163918
|
+
vaultAddress = vaultAddress.replace('0x', '');
|
|
163919
|
+
}
|
|
163920
|
+
}
|
|
163701
163921
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
163702
163922
|
const request = {
|
|
163703
163923
|
'action': updateAction,
|
|
@@ -163705,6 +163925,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163705
163925
|
'signature': signature,
|
|
163706
163926
|
// 'vaultAddress': vaultAddress,
|
|
163707
163927
|
};
|
|
163928
|
+
if (vaultAddress !== undefined) {
|
|
163929
|
+
request['vaultAddress'] = vaultAddress;
|
|
163930
|
+
}
|
|
163708
163931
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
163709
163932
|
//
|
|
163710
163933
|
// {
|
|
@@ -163743,7 +163966,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163743
163966
|
'isCross': isCross,
|
|
163744
163967
|
'leverage': leverage,
|
|
163745
163968
|
};
|
|
163746
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
163969
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
163747
163970
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
163748
163971
|
const request = {
|
|
163749
163972
|
'action': updateAction,
|
|
@@ -163751,6 +163974,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163751
163974
|
'signature': signature,
|
|
163752
163975
|
// 'vaultAddress': vaultAddress,
|
|
163753
163976
|
};
|
|
163977
|
+
if (vaultAddress !== undefined) {
|
|
163978
|
+
params = this.omit(params, 'vaultAddress');
|
|
163979
|
+
request['vaultAddress'] = vaultAddress;
|
|
163980
|
+
}
|
|
163754
163981
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
163755
163982
|
//
|
|
163756
163983
|
// {
|
|
@@ -163803,7 +164030,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163803
164030
|
'isBuy': true,
|
|
163804
164031
|
'ntli': sz,
|
|
163805
164032
|
};
|
|
163806
|
-
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
164033
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
163807
164034
|
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
163808
164035
|
const request = {
|
|
163809
164036
|
'action': updateAction,
|
|
@@ -163811,6 +164038,10 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163811
164038
|
'signature': signature,
|
|
163812
164039
|
// 'vaultAddress': vaultAddress,
|
|
163813
164040
|
};
|
|
164041
|
+
if (vaultAddress !== undefined) {
|
|
164042
|
+
params = this.omit(params, 'vaultAddress');
|
|
164043
|
+
request['vaultAddress'] = vaultAddress;
|
|
164044
|
+
}
|
|
163814
164045
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
163815
164046
|
//
|
|
163816
164047
|
// {
|
|
@@ -163909,6 +164140,15 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
163909
164140
|
const response = await this.privatePostExchange(this.extend(request, params));
|
|
163910
164141
|
return response;
|
|
163911
164142
|
}
|
|
164143
|
+
formatVaultAddress(address = undefined) {
|
|
164144
|
+
if (address === undefined) {
|
|
164145
|
+
return undefined;
|
|
164146
|
+
}
|
|
164147
|
+
if (address.startsWith('0x')) {
|
|
164148
|
+
return address.replace('0x', '');
|
|
164149
|
+
}
|
|
164150
|
+
return address;
|
|
164151
|
+
}
|
|
163912
164152
|
handlePublicAddress(methodName, params) {
|
|
163913
164153
|
let userAux = undefined;
|
|
163914
164154
|
[userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
|
|
@@ -226796,7 +227036,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
226796
227036
|
'future': 200,
|
|
226797
227037
|
'delivery': 200,
|
|
226798
227038
|
},
|
|
226799
|
-
'streamBySubscriptionsHash':
|
|
227039
|
+
'streamBySubscriptionsHash': this.createSafeDictionary(),
|
|
226800
227040
|
'streamIndex': -1,
|
|
226801
227041
|
// get updates every 1000ms or 100ms
|
|
226802
227042
|
// or every 0ms in real-time for futures
|
|
@@ -226804,7 +227044,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
226804
227044
|
'tradesLimit': 1000,
|
|
226805
227045
|
'ordersLimit': 1000,
|
|
226806
227046
|
'OHLCVLimit': 1000,
|
|
226807
|
-
'requestId':
|
|
227047
|
+
'requestId': this.createSafeDictionary(),
|
|
226808
227048
|
'watchOrderBookLimit': 1000,
|
|
226809
227049
|
'watchTrades': {
|
|
226810
227050
|
'name': 'trade', // 'trade' or 'aggTrade'
|
|
@@ -226838,14 +227078,14 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
226838
227078
|
});
|
|
226839
227079
|
}
|
|
226840
227080
|
requestId(url) {
|
|
226841
|
-
const options = this.
|
|
227081
|
+
const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
|
|
226842
227082
|
const previousValue = this.safeInteger(options, url, 0);
|
|
226843
227083
|
const newValue = this.sum(previousValue, 1);
|
|
226844
227084
|
this.options['requestId'][url] = newValue;
|
|
226845
227085
|
return newValue;
|
|
226846
227086
|
}
|
|
226847
227087
|
stream(type, subscriptionHash, numSubscriptions = 1) {
|
|
226848
|
-
const streamBySubscriptionsHash = this.
|
|
227088
|
+
const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
|
|
226849
227089
|
let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
|
|
226850
227090
|
if (stream === undefined) {
|
|
226851
227091
|
let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
|
|
@@ -226858,7 +227098,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
226858
227098
|
this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
|
|
226859
227099
|
const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
|
|
226860
227100
|
if (subscriptionsByStreams === undefined) {
|
|
226861
|
-
this.options['numSubscriptionsByStream'] =
|
|
227101
|
+
this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
|
|
226862
227102
|
}
|
|
226863
227103
|
const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
|
|
226864
227104
|
const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
|
|
@@ -238271,7 +238511,8 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
238271
238511
|
},
|
|
238272
238512
|
},
|
|
238273
238513
|
};
|
|
238274
|
-
this.options = this.extend(defaultOptions, this.options);
|
|
238514
|
+
// this.options = this.extend (defaultOptions, this.options);
|
|
238515
|
+
this.extendExchangeOptions(defaultOptions);
|
|
238275
238516
|
const originalHeaders = this.options['ws']['options']['headers'];
|
|
238276
238517
|
const headers = {
|
|
238277
238518
|
'X-BITOPRO-API': 'ccxt',
|
|
@@ -253949,7 +254190,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
253949
254190
|
const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
|
|
253950
254191
|
return orderbook.limit();
|
|
253951
254192
|
}
|
|
253952
|
-
async watchBidsAsks(symbols
|
|
254193
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
253953
254194
|
/**
|
|
253954
254195
|
* @method
|
|
253955
254196
|
* @name gemini#watchBidsAsks
|
|
@@ -254445,7 +254686,8 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
254445
254686
|
},
|
|
254446
254687
|
},
|
|
254447
254688
|
};
|
|
254448
|
-
this.options = this.extend(defaultOptions, this.options);
|
|
254689
|
+
// this.options = this.extend (defaultOptions, this.options);
|
|
254690
|
+
this.extendExchangeOptions(defaultOptions);
|
|
254449
254691
|
const originalHeaders = this.options['ws']['options']['headers'];
|
|
254450
254692
|
const headers = {
|
|
254451
254693
|
'X-GEMINI-APIKEY': this.apiKey,
|
|
@@ -273171,7 +273413,11 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
273171
273413
|
'watchOrders': true,
|
|
273172
273414
|
'watchOrderBook': true,
|
|
273173
273415
|
'watchOHLCV': true,
|
|
273174
|
-
'watchPositions': undefined,
|
|
273416
|
+
'watchPositions': undefined,
|
|
273417
|
+
// mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
|
|
273418
|
+
'watchOrderBookForSymbols': false,
|
|
273419
|
+
'watchTradesForSymbols': false,
|
|
273420
|
+
'watchOHLCVForSymbols': false,
|
|
273175
273421
|
},
|
|
273176
273422
|
'urls': {
|
|
273177
273423
|
'test': {
|
|
@@ -273711,9 +273957,10 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
273711
273957
|
/**
|
|
273712
273958
|
* @method
|
|
273713
273959
|
* @name phemex#watchOrderBook
|
|
273960
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
|
|
273714
273961
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
|
|
273715
273962
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
|
|
273716
|
-
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-
|
|
273963
|
+
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
|
|
273717
273964
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
273718
273965
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
273719
273966
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -301050,6 +301297,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
301050
301297
|
'1m': 'minutes',
|
|
301051
301298
|
'3m': 'minutes',
|
|
301052
301299
|
'5m': 'minutes',
|
|
301300
|
+
'10m': 'minutes',
|
|
301053
301301
|
'15m': 'minutes',
|
|
301054
301302
|
'30m': 'minutes',
|
|
301055
301303
|
'1h': 'minutes',
|
|
@@ -301079,6 +301327,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
301079
301327
|
'candles/minutes/1',
|
|
301080
301328
|
'candles/minutes/3',
|
|
301081
301329
|
'candles/minutes/5',
|
|
301330
|
+
'candles/minutes/10',
|
|
301082
301331
|
'candles/minutes/15',
|
|
301083
301332
|
'candles/minutes/30',
|
|
301084
301333
|
'candles/minutes/60',
|
|
@@ -322279,7 +322528,7 @@ SOFTWARE.
|
|
|
322279
322528
|
|
|
322280
322529
|
//-----------------------------------------------------------------------------
|
|
322281
322530
|
// this is updated by vss.js when building
|
|
322282
|
-
const version = '4.2.
|
|
322531
|
+
const version = '4.2.80';
|
|
322283
322532
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
322284
322533
|
//-----------------------------------------------------------------------------
|
|
322285
322534
|
|