ccxt 4.1.11 → 4.1.13
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.js +1056 -66
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -0
- package/dist/cjs/src/alpaca.js +1 -0
- package/dist/cjs/src/base/Exchange.js +30 -0
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/binance.js +310 -37
- package/dist/cjs/src/bingx.js +1 -0
- package/dist/cjs/src/bitbank.js +1 -0
- package/dist/cjs/src/bitbns.js +1 -0
- package/dist/cjs/src/bitfinex.js +1 -0
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bitflyer.js +1 -0
- package/dist/cjs/src/bitforex.js +1 -0
- package/dist/cjs/src/bitget.js +20 -4
- package/dist/cjs/src/bithumb.js +1 -0
- package/dist/cjs/src/bitmart.js +103 -0
- package/dist/cjs/src/bitmex.js +70 -0
- package/dist/cjs/src/bitopro.js +1 -0
- package/dist/cjs/src/bitpanda.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitso.js +1 -0
- package/dist/cjs/src/bitstamp.js +1 -0
- package/dist/cjs/src/bitvavo.js +1 -0
- package/dist/cjs/src/blockchaincom.js +1 -0
- package/dist/cjs/src/btcalpha.js +1 -0
- package/dist/cjs/src/btcmarkets.js +1 -0
- package/dist/cjs/src/btcturk.js +1 -0
- package/dist/cjs/src/bybit.js +15 -9
- package/dist/cjs/src/cryptocom.js +1 -1
- package/dist/cjs/src/delta.js +2 -2
- package/dist/cjs/src/deribit.js +163 -0
- package/dist/cjs/src/gate.js +189 -0
- package/dist/cjs/src/huobi.js +105 -4
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/okx.js +2 -0
- package/dist/cjs/src/poloniex.js +21 -7
- package/dist/cjs/src/whitebit.js +1 -0
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/poloniex.d.ts +18 -5
- package/js/src/ace.js +1 -0
- package/js/src/alpaca.js +1 -0
- package/js/src/base/Exchange.d.ts +6 -2
- package/js/src/base/Exchange.js +30 -0
- package/js/src/base/types.d.ts +9 -0
- package/js/src/bigone.js +1 -0
- package/js/src/binance.d.ts +13 -1
- package/js/src/binance.js +310 -37
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +1 -0
- package/js/src/bitbank.js +1 -0
- package/js/src/bitbns.js +1 -0
- package/js/src/bitfinex.js +1 -0
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bitflyer.js +1 -0
- package/js/src/bitforex.js +1 -0
- package/js/src/bitget.js +20 -4
- package/js/src/bithumb.js +1 -0
- package/js/src/bitmart.d.ts +12 -0
- package/js/src/bitmart.js +103 -0
- package/js/src/bitmex.d.ts +13 -1
- package/js/src/bitmex.js +70 -0
- package/js/src/bitopro.js +1 -0
- package/js/src/bitpanda.js +1 -0
- package/js/src/bitrue.js +1 -0
- package/js/src/bitso.js +1 -0
- package/js/src/bitstamp.js +1 -0
- package/js/src/bitvavo.js +1 -0
- package/js/src/blockchaincom.js +1 -0
- package/js/src/btcalpha.js +1 -0
- package/js/src/btcmarkets.js +1 -0
- package/js/src/btcturk.js +1 -0
- package/js/src/bybit.d.ts +3 -3
- package/js/src/bybit.js +15 -9
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +1 -1
- package/js/src/delta.d.ts +2 -54
- package/js/src/delta.js +2 -2
- package/js/src/deribit.d.ts +14 -0
- package/js/src/deribit.js +163 -0
- package/js/src/gate.d.ts +13 -0
- package/js/src/gate.js +189 -0
- package/js/src/huobi.d.ts +13 -1
- package/js/src/huobi.js +105 -4
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/mexc.d.ts +4 -4
- package/js/src/okx.js +2 -0
- package/js/src/poloniex.js +21 -7
- package/js/src/whitebit.js +1 -0
- package/package.json +1 -1
- package/skip-tests.json +61 -5
package/dist/ccxt.browser.js
CHANGED
|
@@ -1710,6 +1710,7 @@ class ace extends _abstract_ace_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
1710
1710
|
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'basePrecision'))),
|
|
1711
1711
|
},
|
|
1712
1712
|
'active': undefined,
|
|
1713
|
+
'created': undefined,
|
|
1713
1714
|
'info': market,
|
|
1714
1715
|
});
|
|
1715
1716
|
}
|
|
@@ -2841,6 +2842,7 @@ class alpaca extends _abstract_alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
2841
2842
|
'max': undefined,
|
|
2842
2843
|
},
|
|
2843
2844
|
},
|
|
2845
|
+
'created': undefined,
|
|
2844
2846
|
'info': asset,
|
|
2845
2847
|
});
|
|
2846
2848
|
}
|
|
@@ -9802,6 +9804,12 @@ class Exchange {
|
|
|
9802
9804
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9803
9805
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyTrades() is not supported yet');
|
|
9804
9806
|
}
|
|
9807
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9808
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyLiquidations() is not supported yet');
|
|
9809
|
+
}
|
|
9810
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
9811
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchLiquidations() is not supported yet');
|
|
9812
|
+
}
|
|
9805
9813
|
async fetchMyTradesWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9806
9814
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyTradesWs() is not supported yet');
|
|
9807
9815
|
}
|
|
@@ -10926,6 +10934,30 @@ class Exchange {
|
|
|
10926
10934
|
'info': this.safeValue(interest, 'info'),
|
|
10927
10935
|
});
|
|
10928
10936
|
}
|
|
10937
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
10938
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseLiquidation () is not supported yet');
|
|
10939
|
+
}
|
|
10940
|
+
parseLiquidations(liquidations, market = undefined, since = undefined, limit = undefined) {
|
|
10941
|
+
/**
|
|
10942
|
+
* @ignore
|
|
10943
|
+
* @method
|
|
10944
|
+
* @description parses liquidation info from the exchange response
|
|
10945
|
+
* @param {object[]} liquidations each item describes an instance of a liquidation event
|
|
10946
|
+
* @param {object} market ccxt market
|
|
10947
|
+
* @param {int} [since] when defined, the response items are filtered to only include items after this timestamp
|
|
10948
|
+
* @param {int} [limit] limits the number of items in the response
|
|
10949
|
+
* @returns {object[]} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
10950
|
+
*/
|
|
10951
|
+
const result = [];
|
|
10952
|
+
for (let i = 0; i < liquidations.length; i++) {
|
|
10953
|
+
const entry = liquidations[i];
|
|
10954
|
+
const parsed = this.parseLiquidation(entry, market);
|
|
10955
|
+
result.push(parsed);
|
|
10956
|
+
}
|
|
10957
|
+
const sorted = this.sortBy(result, 'timestamp');
|
|
10958
|
+
const symbol = this.safeString(market, 'symbol');
|
|
10959
|
+
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
10960
|
+
}
|
|
10929
10961
|
}
|
|
10930
10962
|
|
|
10931
10963
|
|
|
@@ -14606,6 +14638,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
14606
14638
|
'max': this.safeNumber(market, 'max_quote_value'),
|
|
14607
14639
|
},
|
|
14608
14640
|
},
|
|
14641
|
+
'created': undefined,
|
|
14609
14642
|
'info': market,
|
|
14610
14643
|
};
|
|
14611
14644
|
result.push(entry);
|
|
@@ -16056,9 +16089,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16056
16089
|
'fetchLedger': true,
|
|
16057
16090
|
'fetchLeverage': false,
|
|
16058
16091
|
'fetchLeverageTiers': true,
|
|
16092
|
+
'fetchLiquidations': false,
|
|
16059
16093
|
'fetchMarketLeverageTiers': 'emulated',
|
|
16060
16094
|
'fetchMarkets': true,
|
|
16061
16095
|
'fetchMarkOHLCV': true,
|
|
16096
|
+
'fetchMyLiquidations': true,
|
|
16062
16097
|
'fetchMySettlementHistory': true,
|
|
16063
16098
|
'fetchMyTrades': true,
|
|
16064
16099
|
'fetchOHLCV': true,
|
|
@@ -17789,14 +17824,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17789
17824
|
const query = this.omit(params, 'type');
|
|
17790
17825
|
let subType = undefined;
|
|
17791
17826
|
[subType, params] = this.handleSubTypeAndParams('fetchTime', undefined, params);
|
|
17792
|
-
let
|
|
17827
|
+
let response = undefined;
|
|
17793
17828
|
if (this.isLinear(type, subType)) {
|
|
17794
|
-
|
|
17829
|
+
response = await this.fapiPublicGetTime(query);
|
|
17795
17830
|
}
|
|
17796
17831
|
else if (this.isInverse(type, subType)) {
|
|
17797
|
-
|
|
17832
|
+
response = await this.dapiPublicGetTime(query);
|
|
17833
|
+
}
|
|
17834
|
+
else {
|
|
17835
|
+
response = await this.publicGetTime(query);
|
|
17798
17836
|
}
|
|
17799
|
-
const response = await this[method](query);
|
|
17800
17837
|
return this.safeInteger(response, 'serverTime');
|
|
17801
17838
|
}
|
|
17802
17839
|
async fetchCurrencies(params = {}) {
|
|
@@ -18782,17 +18819,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18782
18819
|
if (limit !== undefined) {
|
|
18783
18820
|
request['limit'] = limit; // default 100, max 5000, see https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#order-book
|
|
18784
18821
|
}
|
|
18785
|
-
let
|
|
18822
|
+
let response = undefined;
|
|
18786
18823
|
if (market['option']) {
|
|
18787
|
-
|
|
18824
|
+
response = await this.eapiPublicGetDepth(this.extend(request, params));
|
|
18788
18825
|
}
|
|
18789
18826
|
else if (market['linear']) {
|
|
18790
|
-
|
|
18827
|
+
response = await this.fapiPublicGetDepth(this.extend(request, params));
|
|
18791
18828
|
}
|
|
18792
18829
|
else if (market['inverse']) {
|
|
18793
|
-
|
|
18830
|
+
response = await this.dapiPublicGetDepth(this.extend(request, params));
|
|
18831
|
+
}
|
|
18832
|
+
else {
|
|
18833
|
+
response = await this.publicGetDepth(this.extend(request, params));
|
|
18794
18834
|
}
|
|
18795
|
-
const response = await this[method](this.extend(request, params));
|
|
18796
18835
|
//
|
|
18797
18836
|
// future
|
|
18798
18837
|
//
|
|
@@ -19026,17 +19065,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19026
19065
|
const request = {
|
|
19027
19066
|
'symbol': market['id'],
|
|
19028
19067
|
};
|
|
19029
|
-
let
|
|
19068
|
+
let response = undefined;
|
|
19030
19069
|
if (market['option']) {
|
|
19031
|
-
|
|
19070
|
+
response = await this.eapiPublicGetTicker(this.extend(request, params));
|
|
19032
19071
|
}
|
|
19033
19072
|
else if (market['linear']) {
|
|
19034
|
-
|
|
19073
|
+
response = await this.fapiPublicGetTicker24hr(this.extend(request, params));
|
|
19035
19074
|
}
|
|
19036
19075
|
else if (market['inverse']) {
|
|
19037
|
-
|
|
19076
|
+
response = await this.dapiPublicGetTicker24hr(this.extend(request, params));
|
|
19077
|
+
}
|
|
19078
|
+
else {
|
|
19079
|
+
response = await this.publicGetTicker24hr(this.extend(request, params));
|
|
19038
19080
|
}
|
|
19039
|
-
const response = await this[method](this.extend(request, params));
|
|
19040
19081
|
if (Array.isArray(response)) {
|
|
19041
19082
|
const firstTicker = this.safeValue(response, 0, {});
|
|
19042
19083
|
return this.parseTicker(firstTicker, market);
|
|
@@ -19066,17 +19107,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19066
19107
|
let subType = undefined;
|
|
19067
19108
|
[subType, params] = this.handleSubTypeAndParams('fetchBidsAsks', market, params);
|
|
19068
19109
|
[type, params] = this.handleMarketTypeAndParams('fetchBidsAsks', market, params);
|
|
19069
|
-
let
|
|
19110
|
+
let response = undefined;
|
|
19070
19111
|
if (this.isLinear(type, subType)) {
|
|
19071
|
-
|
|
19112
|
+
response = await this.fapiPublicGetTickerBookTicker(params);
|
|
19072
19113
|
}
|
|
19073
19114
|
else if (this.isInverse(type, subType)) {
|
|
19074
|
-
|
|
19115
|
+
response = await this.dapiPublicGetTickerBookTicker(params);
|
|
19075
19116
|
}
|
|
19076
19117
|
else {
|
|
19077
|
-
|
|
19118
|
+
response = await this.publicGetTickerBookTicker(params);
|
|
19078
19119
|
}
|
|
19079
|
-
const response = await this[method](params);
|
|
19080
19120
|
return this.parseTickers(response, symbols);
|
|
19081
19121
|
}
|
|
19082
19122
|
async fetchLastPrices(symbols = undefined, params = {}) {
|
|
@@ -19098,9 +19138,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19098
19138
|
let subType = undefined;
|
|
19099
19139
|
[subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
|
|
19100
19140
|
[type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
|
|
19101
|
-
let
|
|
19141
|
+
let response = undefined;
|
|
19102
19142
|
if (this.isLinear(type, subType)) {
|
|
19103
|
-
|
|
19143
|
+
response = await this.fapiPublicGetTickerPrice(params);
|
|
19104
19144
|
//
|
|
19105
19145
|
// [
|
|
19106
19146
|
// {
|
|
@@ -19113,7 +19153,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19113
19153
|
//
|
|
19114
19154
|
}
|
|
19115
19155
|
else if (this.isInverse(type, subType)) {
|
|
19116
|
-
|
|
19156
|
+
response = await this.dapiPublicGetTickerPrice(params);
|
|
19117
19157
|
//
|
|
19118
19158
|
// [
|
|
19119
19159
|
// {
|
|
@@ -19126,7 +19166,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19126
19166
|
//
|
|
19127
19167
|
}
|
|
19128
19168
|
else if (type === 'spot') {
|
|
19129
|
-
|
|
19169
|
+
response = await this.publicGetTickerPrice(params);
|
|
19130
19170
|
//
|
|
19131
19171
|
// [
|
|
19132
19172
|
// {
|
|
@@ -19140,7 +19180,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
19140
19180
|
else {
|
|
19141
19181
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
|
|
19142
19182
|
}
|
|
19143
|
-
const response = await this[method](params);
|
|
19144
19183
|
return this.parseLastPrices(response, symbols);
|
|
19145
19184
|
}
|
|
19146
19185
|
parseLastPrice(info, market = undefined) {
|
|
@@ -22460,10 +22499,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22460
22499
|
}
|
|
22461
22500
|
parseTradingFee(fee, market = undefined) {
|
|
22462
22501
|
//
|
|
22502
|
+
// spot
|
|
22503
|
+
// [
|
|
22504
|
+
// {
|
|
22505
|
+
// "symbol": "BTCUSDT",
|
|
22506
|
+
// "makerCommission": "0.001",
|
|
22507
|
+
// "takerCommission": "0.001"
|
|
22508
|
+
// }
|
|
22509
|
+
// ]
|
|
22510
|
+
//
|
|
22511
|
+
// swap
|
|
22463
22512
|
// {
|
|
22464
|
-
// "symbol": "
|
|
22465
|
-
// "
|
|
22466
|
-
// "
|
|
22513
|
+
// "symbol": "BTCUSD_PERP",
|
|
22514
|
+
// "makerCommissionRate": "0.00015", // 0.015%
|
|
22515
|
+
// "takerCommissionRate": "0.00040" // 0.040%
|
|
22467
22516
|
// }
|
|
22468
22517
|
//
|
|
22469
22518
|
const marketId = this.safeString(fee, 'symbol');
|
|
@@ -22471,8 +22520,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22471
22520
|
return {
|
|
22472
22521
|
'info': fee,
|
|
22473
22522
|
'symbol': symbol,
|
|
22474
|
-
'maker': this.
|
|
22475
|
-
'taker': this.
|
|
22523
|
+
'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
|
|
22524
|
+
'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
|
|
22476
22525
|
};
|
|
22477
22526
|
}
|
|
22478
22527
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -22481,17 +22530,37 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22481
22530
|
* @name binance#fetchTradingFee
|
|
22482
22531
|
* @description fetch the trading fees for a market
|
|
22483
22532
|
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
|
22533
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#user-commission-rate-user_data
|
|
22534
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#user-commission-rate-user_data
|
|
22484
22535
|
* @param {string} symbol unified market symbol
|
|
22485
22536
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
22486
22537
|
* @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
|
|
22487
22538
|
*/
|
|
22488
22539
|
await this.loadMarkets();
|
|
22489
22540
|
const market = this.market(symbol);
|
|
22541
|
+
const defaultType = this.safeString2(this.options, 'fetchTradingFee', 'defaultType', 'linear');
|
|
22542
|
+
const type = this.safeString(params, 'type', defaultType);
|
|
22543
|
+
params = this.omit(params, 'type');
|
|
22544
|
+
let subType = undefined;
|
|
22545
|
+
[subType, params] = this.handleSubTypeAndParams('fetchTradingFee', market, params);
|
|
22546
|
+
const isSpotOrMargin = (type === 'spot') || (type === 'margin');
|
|
22547
|
+
const isLinear = this.isLinear(type, subType);
|
|
22548
|
+
const isInverse = this.isInverse(type, subType);
|
|
22490
22549
|
const request = {
|
|
22491
22550
|
'symbol': market['id'],
|
|
22492
22551
|
};
|
|
22493
|
-
|
|
22552
|
+
let response = undefined;
|
|
22553
|
+
if (isSpotOrMargin) {
|
|
22554
|
+
response = await this.sapiGetAssetTradeFee(this.extend(request, params));
|
|
22555
|
+
}
|
|
22556
|
+
else if (isLinear) {
|
|
22557
|
+
response = await this.fapiPrivateGetCommissionRate(this.extend(request, params));
|
|
22558
|
+
}
|
|
22559
|
+
else if (isInverse) {
|
|
22560
|
+
response = await this.dapiPrivateGetCommissionRate(this.extend(request, params));
|
|
22561
|
+
}
|
|
22494
22562
|
//
|
|
22563
|
+
// spot
|
|
22495
22564
|
// [
|
|
22496
22565
|
// {
|
|
22497
22566
|
// "symbol": "BTCUSDT",
|
|
@@ -22500,8 +22569,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22500
22569
|
// }
|
|
22501
22570
|
// ]
|
|
22502
22571
|
//
|
|
22503
|
-
|
|
22504
|
-
|
|
22572
|
+
// swap
|
|
22573
|
+
// {
|
|
22574
|
+
// "symbol": "BTCUSD_PERP",
|
|
22575
|
+
// "makerCommissionRate": "0.00015", // 0.015%
|
|
22576
|
+
// "takerCommissionRate": "0.00040" // 0.040%
|
|
22577
|
+
// }
|
|
22578
|
+
//
|
|
22579
|
+
let data = response;
|
|
22580
|
+
if (Array.isArray(data)) {
|
|
22581
|
+
data = this.safeValue(data, 0, {});
|
|
22582
|
+
}
|
|
22583
|
+
return this.parseTradingFee(data);
|
|
22505
22584
|
}
|
|
22506
22585
|
async fetchTradingFees(params = {}) {
|
|
22507
22586
|
/**
|
|
@@ -22516,11 +22595,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22516
22595
|
*/
|
|
22517
22596
|
await this.loadMarkets();
|
|
22518
22597
|
let method = undefined;
|
|
22519
|
-
|
|
22520
|
-
|
|
22521
|
-
params = this.omit(params, 'type');
|
|
22598
|
+
let type = undefined;
|
|
22599
|
+
[type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
22522
22600
|
let subType = undefined;
|
|
22523
|
-
[subType, params] = this.handleSubTypeAndParams('fetchTradingFees', undefined, params);
|
|
22601
|
+
[subType, params] = this.handleSubTypeAndParams('fetchTradingFees', undefined, params, 'linear');
|
|
22524
22602
|
const isSpotOrMargin = (type === 'spot') || (type === 'margin');
|
|
22525
22603
|
const isLinear = this.isLinear(type, subType);
|
|
22526
22604
|
const isInverse = this.isInverse(type, subType);
|
|
@@ -24197,13 +24275,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24197
24275
|
let type = undefined;
|
|
24198
24276
|
let subType = undefined;
|
|
24199
24277
|
let currency = undefined;
|
|
24278
|
+
if (code !== undefined) {
|
|
24279
|
+
currency = this.currency(code);
|
|
24280
|
+
}
|
|
24200
24281
|
let method = undefined;
|
|
24201
24282
|
const request = {};
|
|
24202
24283
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
24203
24284
|
[subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
|
|
24204
24285
|
if (type === 'option') {
|
|
24205
24286
|
this.checkRequiredArgument('fetchLedger', code, 'code');
|
|
24206
|
-
currency = this.currency(code);
|
|
24207
24287
|
request['currency'] = currency['id'];
|
|
24208
24288
|
method = 'eapiPrivateGetBill';
|
|
24209
24289
|
}
|
|
@@ -25158,6 +25238,232 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25158
25238
|
'info': interest,
|
|
25159
25239
|
}, market);
|
|
25160
25240
|
}
|
|
25241
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
25242
|
+
/**
|
|
25243
|
+
* @method
|
|
25244
|
+
* @name binance#fetchMyLiquidations
|
|
25245
|
+
* @description retrieves the users liquidated positions
|
|
25246
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
|
|
25247
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#user-39-s-force-orders-user_data
|
|
25248
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data
|
|
25249
|
+
* @param {string} [symbol] unified CCXT market symbol
|
|
25250
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
25251
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
25252
|
+
* @param {object} [params] exchange specific parameters for the binance api endpoint
|
|
25253
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
25254
|
+
* @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
25255
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
25256
|
+
*/
|
|
25257
|
+
await this.loadMarkets();
|
|
25258
|
+
let paginate = false;
|
|
25259
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyLiquidations', 'paginate');
|
|
25260
|
+
if (paginate) {
|
|
25261
|
+
return await this.fetchPaginatedCallIncremental('fetchMyLiquidations', symbol, since, limit, params, 'current', 100);
|
|
25262
|
+
}
|
|
25263
|
+
let market = undefined;
|
|
25264
|
+
if (symbol !== undefined) {
|
|
25265
|
+
market = this.market(symbol);
|
|
25266
|
+
}
|
|
25267
|
+
let type = undefined;
|
|
25268
|
+
[type, params] = this.handleMarketTypeAndParams('fetchMyLiquidations', market, params);
|
|
25269
|
+
let subType = undefined;
|
|
25270
|
+
[subType, params] = this.handleSubTypeAndParams('fetchMyLiquidations', market, params, 'linear');
|
|
25271
|
+
let request = {};
|
|
25272
|
+
if (type !== 'spot') {
|
|
25273
|
+
request['autoCloseType'] = 'LIQUIDATION';
|
|
25274
|
+
}
|
|
25275
|
+
if (market !== undefined) {
|
|
25276
|
+
const symbolKey = market['spot'] ? 'isolatedSymbol' : 'symbol';
|
|
25277
|
+
request[symbolKey] = market['id'];
|
|
25278
|
+
}
|
|
25279
|
+
if (since !== undefined) {
|
|
25280
|
+
request['startTime'] = since;
|
|
25281
|
+
}
|
|
25282
|
+
if (limit !== undefined) {
|
|
25283
|
+
if (type === 'spot') {
|
|
25284
|
+
request['size'] = limit;
|
|
25285
|
+
}
|
|
25286
|
+
else {
|
|
25287
|
+
request['limit'] = limit;
|
|
25288
|
+
}
|
|
25289
|
+
}
|
|
25290
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
25291
|
+
let response = undefined;
|
|
25292
|
+
if (type === 'spot') {
|
|
25293
|
+
response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
|
|
25294
|
+
}
|
|
25295
|
+
else if (subType === 'linear') {
|
|
25296
|
+
response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
|
|
25297
|
+
}
|
|
25298
|
+
else if (subType === 'inverse') {
|
|
25299
|
+
response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
|
|
25300
|
+
}
|
|
25301
|
+
else {
|
|
25302
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
|
|
25303
|
+
}
|
|
25304
|
+
//
|
|
25305
|
+
// margin
|
|
25306
|
+
//
|
|
25307
|
+
// {
|
|
25308
|
+
// "rows": [
|
|
25309
|
+
// {
|
|
25310
|
+
// "avgPrice": "0.00388359",
|
|
25311
|
+
// "executedQty": "31.39000000",
|
|
25312
|
+
// "orderId": 180015097,
|
|
25313
|
+
// "price": "0.00388110",
|
|
25314
|
+
// "qty": "31.39000000",
|
|
25315
|
+
// "side": "SELL",
|
|
25316
|
+
// "symbol": "BNBBTC",
|
|
25317
|
+
// "timeInForce": "GTC",
|
|
25318
|
+
// "isIsolated": true,
|
|
25319
|
+
// "updatedTime": 1558941374745
|
|
25320
|
+
// }
|
|
25321
|
+
// ],
|
|
25322
|
+
// "total": 1
|
|
25323
|
+
// }
|
|
25324
|
+
//
|
|
25325
|
+
// linear
|
|
25326
|
+
//
|
|
25327
|
+
// [
|
|
25328
|
+
// {
|
|
25329
|
+
// "orderId": 6071832819,
|
|
25330
|
+
// "symbol": "BTCUSDT",
|
|
25331
|
+
// "status": "FILLED",
|
|
25332
|
+
// "clientOrderId": "autoclose-1596107620040000020",
|
|
25333
|
+
// "price": "10871.09",
|
|
25334
|
+
// "avgPrice": "10913.21000",
|
|
25335
|
+
// "origQty": "0.001",
|
|
25336
|
+
// "executedQty": "0.001",
|
|
25337
|
+
// "cumQuote": "10.91321",
|
|
25338
|
+
// "timeInForce": "IOC",
|
|
25339
|
+
// "type": "LIMIT",
|
|
25340
|
+
// "reduceOnly": false,
|
|
25341
|
+
// "closePosition": false,
|
|
25342
|
+
// "side": "SELL",
|
|
25343
|
+
// "positionSide": "BOTH",
|
|
25344
|
+
// "stopPrice": "0",
|
|
25345
|
+
// "workingType": "CONTRACT_PRICE",
|
|
25346
|
+
// "origType": "LIMIT",
|
|
25347
|
+
// "time": 1596107620044,
|
|
25348
|
+
// "updateTime": 1596107620087
|
|
25349
|
+
// },
|
|
25350
|
+
// ]
|
|
25351
|
+
//
|
|
25352
|
+
// inverse
|
|
25353
|
+
//
|
|
25354
|
+
// [
|
|
25355
|
+
// {
|
|
25356
|
+
// "orderId": 165123080,
|
|
25357
|
+
// "symbol": "BTCUSD_200925",
|
|
25358
|
+
// "pair": "BTCUSD",
|
|
25359
|
+
// "status": "FILLED",
|
|
25360
|
+
// "clientOrderId": "autoclose-1596542005017000006",
|
|
25361
|
+
// "price": "11326.9",
|
|
25362
|
+
// "avgPrice": "11326.9",
|
|
25363
|
+
// "origQty": "1",
|
|
25364
|
+
// "executedQty": "1",
|
|
25365
|
+
// "cumBase": "0.00882854",
|
|
25366
|
+
// "timeInForce": "IOC",
|
|
25367
|
+
// "type": "LIMIT",
|
|
25368
|
+
// "reduceOnly": false,
|
|
25369
|
+
// "closePosition": false,
|
|
25370
|
+
// "side": "SELL",
|
|
25371
|
+
// "positionSide": "BOTH",
|
|
25372
|
+
// "stopPrice": "0",
|
|
25373
|
+
// "workingType": "CONTRACT_PRICE",
|
|
25374
|
+
// "priceProtect": false,
|
|
25375
|
+
// "origType": "LIMIT",
|
|
25376
|
+
// "time": 1596542005019,
|
|
25377
|
+
// "updateTime": 1596542005050
|
|
25378
|
+
// },
|
|
25379
|
+
// ]
|
|
25380
|
+
//
|
|
25381
|
+
const liquidations = this.safeValue(response, 'rows', response);
|
|
25382
|
+
return this.parseLiquidations(liquidations, market, since, limit);
|
|
25383
|
+
}
|
|
25384
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
25385
|
+
//
|
|
25386
|
+
// margin
|
|
25387
|
+
//
|
|
25388
|
+
// {
|
|
25389
|
+
// "avgPrice": "0.00388359",
|
|
25390
|
+
// "executedQty": "31.39000000",
|
|
25391
|
+
// "orderId": 180015097,
|
|
25392
|
+
// "price": "0.00388110",
|
|
25393
|
+
// "qty": "31.39000000",
|
|
25394
|
+
// "side": "SELL",
|
|
25395
|
+
// "symbol": "BNBBTC",
|
|
25396
|
+
// "timeInForce": "GTC",
|
|
25397
|
+
// "isIsolated": true,
|
|
25398
|
+
// "updatedTime": 1558941374745
|
|
25399
|
+
// }
|
|
25400
|
+
//
|
|
25401
|
+
// linear
|
|
25402
|
+
//
|
|
25403
|
+
// {
|
|
25404
|
+
// "orderId": 6071832819,
|
|
25405
|
+
// "symbol": "BTCUSDT",
|
|
25406
|
+
// "status": "FILLED",
|
|
25407
|
+
// "clientOrderId": "autoclose-1596107620040000020",
|
|
25408
|
+
// "price": "10871.09",
|
|
25409
|
+
// "avgPrice": "10913.21000",
|
|
25410
|
+
// "origQty": "0.001",
|
|
25411
|
+
// "executedQty": "0.001",
|
|
25412
|
+
// "cumQuote": "10.91321",
|
|
25413
|
+
// "timeInForce": "IOC",
|
|
25414
|
+
// "type": "LIMIT",
|
|
25415
|
+
// "reduceOnly": false,
|
|
25416
|
+
// "closePosition": false,
|
|
25417
|
+
// "side": "SELL",
|
|
25418
|
+
// "positionSide": "BOTH",
|
|
25419
|
+
// "stopPrice": "0",
|
|
25420
|
+
// "workingType": "CONTRACT_PRICE",
|
|
25421
|
+
// "origType": "LIMIT",
|
|
25422
|
+
// "time": 1596107620044,
|
|
25423
|
+
// "updateTime": 1596107620087
|
|
25424
|
+
// }
|
|
25425
|
+
//
|
|
25426
|
+
// inverse
|
|
25427
|
+
//
|
|
25428
|
+
// {
|
|
25429
|
+
// "orderId": 165123080,
|
|
25430
|
+
// "symbol": "BTCUSD_200925",
|
|
25431
|
+
// "pair": "BTCUSD",
|
|
25432
|
+
// "status": "FILLED",
|
|
25433
|
+
// "clientOrderId": "autoclose-1596542005017000006",
|
|
25434
|
+
// "price": "11326.9",
|
|
25435
|
+
// "avgPrice": "11326.9",
|
|
25436
|
+
// "origQty": "1",
|
|
25437
|
+
// "executedQty": "1",
|
|
25438
|
+
// "cumBase": "0.00882854",
|
|
25439
|
+
// "timeInForce": "IOC",
|
|
25440
|
+
// "type": "LIMIT",
|
|
25441
|
+
// "reduceOnly": false,
|
|
25442
|
+
// "closePosition": false,
|
|
25443
|
+
// "side": "SELL",
|
|
25444
|
+
// "positionSide": "BOTH",
|
|
25445
|
+
// "stopPrice": "0",
|
|
25446
|
+
// "workingType": "CONTRACT_PRICE",
|
|
25447
|
+
// "priceProtect": false,
|
|
25448
|
+
// "origType": "LIMIT",
|
|
25449
|
+
// "time": 1596542005019,
|
|
25450
|
+
// "updateTime": 1596542005050
|
|
25451
|
+
// }
|
|
25452
|
+
//
|
|
25453
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
25454
|
+
const timestamp = this.safeInteger2(liquidation, 'updatedTime', 'updateTime');
|
|
25455
|
+
return {
|
|
25456
|
+
'info': liquidation,
|
|
25457
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
25458
|
+
'contracts': this.safeNumber(liquidation, 'executedQty'),
|
|
25459
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
25460
|
+
'price': this.safeNumber(liquidation, 'avgPrice'),
|
|
25461
|
+
'baseValue': this.safeNumber(liquidation, 'cumBase'),
|
|
25462
|
+
'quoteValue': this.safeNumber(liquidation, 'cumQuote'),
|
|
25463
|
+
'timestamp': timestamp,
|
|
25464
|
+
'datetime': this.iso8601(timestamp),
|
|
25465
|
+
};
|
|
25466
|
+
}
|
|
25161
25467
|
}
|
|
25162
25468
|
|
|
25163
25469
|
|
|
@@ -25959,6 +26265,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
25959
26265
|
'max': this.safeNumber(market, 'maxNotional'),
|
|
25960
26266
|
},
|
|
25961
26267
|
},
|
|
26268
|
+
'created': undefined,
|
|
25962
26269
|
'info': market,
|
|
25963
26270
|
};
|
|
25964
26271
|
return entry;
|
|
@@ -29664,6 +29971,7 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
29664
29971
|
'max': undefined,
|
|
29665
29972
|
},
|
|
29666
29973
|
},
|
|
29974
|
+
'created': undefined,
|
|
29667
29975
|
'info': entry,
|
|
29668
29976
|
});
|
|
29669
29977
|
}
|
|
@@ -30722,6 +31030,7 @@ class bitbns extends _abstract_bitbns_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
30722
31030
|
'max': this.safeNumber(costLimits, 'max'),
|
|
30723
31031
|
},
|
|
30724
31032
|
},
|
|
31033
|
+
'created': undefined,
|
|
30725
31034
|
'info': market,
|
|
30726
31035
|
});
|
|
30727
31036
|
}
|
|
@@ -32352,6 +32661,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
32352
32661
|
'max': undefined,
|
|
32353
32662
|
},
|
|
32354
32663
|
},
|
|
32664
|
+
'created': undefined,
|
|
32355
32665
|
'info': market,
|
|
32356
32666
|
});
|
|
32357
32667
|
}
|
|
@@ -33951,6 +34261,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
33951
34261
|
'max': undefined,
|
|
33952
34262
|
},
|
|
33953
34263
|
},
|
|
34264
|
+
'created': undefined,
|
|
33954
34265
|
'info': market,
|
|
33955
34266
|
});
|
|
33956
34267
|
}
|
|
@@ -36666,6 +36977,7 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36666
36977
|
'max': undefined,
|
|
36667
36978
|
},
|
|
36668
36979
|
},
|
|
36980
|
+
'created': undefined,
|
|
36669
36981
|
'info': market,
|
|
36670
36982
|
});
|
|
36671
36983
|
}
|
|
@@ -37656,6 +37968,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37656
37968
|
'max': undefined,
|
|
37657
37969
|
},
|
|
37658
37970
|
},
|
|
37971
|
+
'created': undefined,
|
|
37659
37972
|
'info': market,
|
|
37660
37973
|
});
|
|
37661
37974
|
}
|
|
@@ -39733,6 +40046,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39733
40046
|
'max': undefined,
|
|
39734
40047
|
},
|
|
39735
40048
|
},
|
|
40049
|
+
'created': undefined,
|
|
39736
40050
|
};
|
|
39737
40051
|
}
|
|
39738
40052
|
return result;
|
|
@@ -39832,7 +40146,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39832
40146
|
}
|
|
39833
40147
|
const currency = this.currency(code);
|
|
39834
40148
|
if (since === undefined) {
|
|
39835
|
-
since = this.milliseconds() -
|
|
40149
|
+
since = this.milliseconds() - 7776000000; // 90 days
|
|
39836
40150
|
}
|
|
39837
40151
|
let request = {
|
|
39838
40152
|
'coin': currency['code'],
|
|
@@ -39988,7 +40302,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39988
40302
|
}
|
|
39989
40303
|
const currency = this.currency(code);
|
|
39990
40304
|
if (since === undefined) {
|
|
39991
|
-
since = this.milliseconds() -
|
|
40305
|
+
since = this.milliseconds() - 7776000000; // 90 days
|
|
39992
40306
|
}
|
|
39993
40307
|
let request = {
|
|
39994
40308
|
'coin': currency['code'],
|
|
@@ -42141,8 +42455,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42141
42455
|
//
|
|
42142
42456
|
const data = this.safeValue(response, 'data');
|
|
42143
42457
|
if (data !== undefined) {
|
|
42144
|
-
|
|
42145
|
-
|
|
42458
|
+
if ('orderList' in data) {
|
|
42459
|
+
const orderList = this.safeValue(data, 'orderList');
|
|
42460
|
+
if (!orderList) {
|
|
42461
|
+
return [];
|
|
42462
|
+
}
|
|
42463
|
+
return this.addPaginationCursorToResult(data, orderList);
|
|
42464
|
+
}
|
|
42465
|
+
else {
|
|
42466
|
+
return this.addPaginationCursorToResult(response, data);
|
|
42467
|
+
}
|
|
42146
42468
|
}
|
|
42147
42469
|
const parsedData = JSON.parse(response);
|
|
42148
42470
|
return this.safeValue(parsedData, 'data', []);
|
|
@@ -42301,10 +42623,17 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42301
42623
|
response = await this.privateSpotPostTradeFills(this.extend(request, params));
|
|
42302
42624
|
}
|
|
42303
42625
|
else {
|
|
42626
|
+
const orderId = this.safeString(params, 'orderId'); // when order id is not defined, startTime and endTime are required
|
|
42304
42627
|
if (since !== undefined) {
|
|
42305
42628
|
request['startTime'] = since;
|
|
42306
42629
|
}
|
|
42630
|
+
else if (orderId === undefined) {
|
|
42631
|
+
request['startTime'] = 0;
|
|
42632
|
+
}
|
|
42307
42633
|
[request, params] = this.handleUntilOption('endTime', params, request);
|
|
42634
|
+
if (!('endTime' in request) && (orderId === undefined)) {
|
|
42635
|
+
request['endTime'] = this.milliseconds();
|
|
42636
|
+
}
|
|
42308
42637
|
response = await this.privateMixGetOrderFills(this.extend(request, params));
|
|
42309
42638
|
}
|
|
42310
42639
|
//
|
|
@@ -43822,6 +44151,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
43822
44151
|
},
|
|
43823
44152
|
'cost': {}, // set via options
|
|
43824
44153
|
},
|
|
44154
|
+
'created': undefined,
|
|
43825
44155
|
'info': market,
|
|
43826
44156
|
}, extension);
|
|
43827
44157
|
result.push(entry);
|
|
@@ -44719,8 +45049,10 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
44719
45049
|
'fetchFundingRate': true,
|
|
44720
45050
|
'fetchFundingRateHistory': false,
|
|
44721
45051
|
'fetchFundingRates': false,
|
|
45052
|
+
'fetchLiquidations': false,
|
|
44722
45053
|
'fetchMarginMode': false,
|
|
44723
45054
|
'fetchMarkets': true,
|
|
45055
|
+
'fetchMyLiquidations': true,
|
|
44724
45056
|
'fetchMyTrades': true,
|
|
44725
45057
|
'fetchOHLCV': true,
|
|
44726
45058
|
'fetchOpenInterest': true,
|
|
@@ -48593,6 +48925,107 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
48593
48925
|
'takeProfitPrice': undefined,
|
|
48594
48926
|
});
|
|
48595
48927
|
}
|
|
48928
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
48929
|
+
/**
|
|
48930
|
+
* @method
|
|
48931
|
+
* @name bitmart#fetchMyLiquidations
|
|
48932
|
+
* @description retrieves the users liquidated positions
|
|
48933
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
|
48934
|
+
* @param {string} symbol unified CCXT market symbol
|
|
48935
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
48936
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
48937
|
+
* @param {object} [params] exchange specific parameters for the bitmart api endpoint
|
|
48938
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
48939
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
48940
|
+
*/
|
|
48941
|
+
this.checkRequiredSymbol('fetchMyLiquidations', symbol);
|
|
48942
|
+
await this.loadMarkets();
|
|
48943
|
+
const market = this.market(symbol);
|
|
48944
|
+
if (!market['swap']) {
|
|
48945
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyLiquidations() supports swap markets only');
|
|
48946
|
+
}
|
|
48947
|
+
let request = {
|
|
48948
|
+
'symbol': market['id'],
|
|
48949
|
+
};
|
|
48950
|
+
if (since !== undefined) {
|
|
48951
|
+
request['start_time'] = since;
|
|
48952
|
+
}
|
|
48953
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
48954
|
+
const response = await this.privateGetContractPrivateOrderHistory(this.extend(request, params));
|
|
48955
|
+
//
|
|
48956
|
+
// {
|
|
48957
|
+
// "code": 1000,
|
|
48958
|
+
// "message": "Ok",
|
|
48959
|
+
// "data": [
|
|
48960
|
+
// {
|
|
48961
|
+
// "order_id": "231007865458273",
|
|
48962
|
+
// "client_order_id": "",
|
|
48963
|
+
// "price": "27407.9",
|
|
48964
|
+
// "size": "1",
|
|
48965
|
+
// "symbol": "BTCUSDT",
|
|
48966
|
+
// "state": 4,
|
|
48967
|
+
// "side": 3,
|
|
48968
|
+
// "type": "liquidate",
|
|
48969
|
+
// "leverage": "10",
|
|
48970
|
+
// "open_type": "isolated",
|
|
48971
|
+
// "deal_avg_price": "27422.6",
|
|
48972
|
+
// "deal_size": "1",
|
|
48973
|
+
// "create_time": 1696405864011,
|
|
48974
|
+
// "update_time": 1696405864045
|
|
48975
|
+
// },
|
|
48976
|
+
// ],
|
|
48977
|
+
// "trace": "4cad855074664097ac6ba4257c47305d.71.16965658195443021"
|
|
48978
|
+
// }
|
|
48979
|
+
//
|
|
48980
|
+
const data = this.safeValue(response, 'data', []);
|
|
48981
|
+
const result = [];
|
|
48982
|
+
for (let i = 0; i < data.length; i++) {
|
|
48983
|
+
const entry = data[i];
|
|
48984
|
+
const checkLiquidation = this.safeString(entry, 'type');
|
|
48985
|
+
if (checkLiquidation === 'liquidate') {
|
|
48986
|
+
result.push(entry);
|
|
48987
|
+
}
|
|
48988
|
+
}
|
|
48989
|
+
return this.parseLiquidations(result, market, since, limit);
|
|
48990
|
+
}
|
|
48991
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
48992
|
+
//
|
|
48993
|
+
// {
|
|
48994
|
+
// "order_id": "231007865458273",
|
|
48995
|
+
// "client_order_id": "",
|
|
48996
|
+
// "price": "27407.9",
|
|
48997
|
+
// "size": "1",
|
|
48998
|
+
// "symbol": "BTCUSDT",
|
|
48999
|
+
// "state": 4,
|
|
49000
|
+
// "side": 3,
|
|
49001
|
+
// "type": "market",
|
|
49002
|
+
// "leverage": "10",
|
|
49003
|
+
// "open_type": "isolated",
|
|
49004
|
+
// "deal_avg_price": "27422.6",
|
|
49005
|
+
// "deal_size": "1",
|
|
49006
|
+
// "create_time": 1696405864011,
|
|
49007
|
+
// "update_time": 1696405864045
|
|
49008
|
+
// }
|
|
49009
|
+
//
|
|
49010
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
49011
|
+
const timestamp = this.safeInteger(liquidation, 'update_time');
|
|
49012
|
+
const contractsString = this.safeString(liquidation, 'deal_size');
|
|
49013
|
+
const contractSizeString = this.safeString(market, 'contractSize');
|
|
49014
|
+
const priceString = this.safeString(liquidation, 'deal_avg_price');
|
|
49015
|
+
const baseValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(contractsString, contractSizeString);
|
|
49016
|
+
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
49017
|
+
return {
|
|
49018
|
+
'info': liquidation,
|
|
49019
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
49020
|
+
'contracts': this.parseNumber(contractsString),
|
|
49021
|
+
'contractSize': this.parseNumber(contractSizeString),
|
|
49022
|
+
'price': this.parseNumber(priceString),
|
|
49023
|
+
'baseValue': this.parseNumber(baseValueString),
|
|
49024
|
+
'quoteValue': this.parseNumber(quoteValueString),
|
|
49025
|
+
'timestamp': timestamp,
|
|
49026
|
+
'datetime': this.iso8601(timestamp),
|
|
49027
|
+
};
|
|
49028
|
+
}
|
|
48596
49029
|
nonce() {
|
|
48597
49030
|
return this.milliseconds();
|
|
48598
49031
|
}
|
|
@@ -48729,9 +49162,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48729
49162
|
'fetchLedger': true,
|
|
48730
49163
|
'fetchLeverage': false,
|
|
48731
49164
|
'fetchLeverageTiers': false,
|
|
49165
|
+
'fetchLiquidations': true,
|
|
48732
49166
|
'fetchMarketLeverageTiers': false,
|
|
48733
49167
|
'fetchMarkets': true,
|
|
48734
49168
|
'fetchMarkOHLCV': false,
|
|
49169
|
+
'fetchMyLiquidations': false,
|
|
48735
49170
|
'fetchMyTrades': true,
|
|
48736
49171
|
'fetchOHLCV': true,
|
|
48737
49172
|
'fetchOpenOrders': true,
|
|
@@ -51319,6 +51754,74 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
51319
51754
|
}
|
|
51320
51755
|
return cost;
|
|
51321
51756
|
}
|
|
51757
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
51758
|
+
/**
|
|
51759
|
+
* @method
|
|
51760
|
+
* @name bitmex#fetchLiquidations
|
|
51761
|
+
* @description retrieves the public liquidations of a trading pair
|
|
51762
|
+
* @see https://www.bitmex.com/api/explorer/#!/Liquidation/Liquidation_get
|
|
51763
|
+
* @param {string} symbol unified CCXT market symbol
|
|
51764
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
51765
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
51766
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
51767
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
51768
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
51769
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
51770
|
+
*/
|
|
51771
|
+
await this.loadMarkets();
|
|
51772
|
+
let paginate = false;
|
|
51773
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLiquidations', 'paginate');
|
|
51774
|
+
if (paginate) {
|
|
51775
|
+
return await this.fetchPaginatedCallDynamic('fetchLiquidations', symbol, since, limit, params);
|
|
51776
|
+
}
|
|
51777
|
+
const market = this.market(symbol);
|
|
51778
|
+
let request = {
|
|
51779
|
+
'symbol': market['id'],
|
|
51780
|
+
};
|
|
51781
|
+
if (since !== undefined) {
|
|
51782
|
+
request['startTime'] = since;
|
|
51783
|
+
}
|
|
51784
|
+
if (limit !== undefined) {
|
|
51785
|
+
request['count'] = limit;
|
|
51786
|
+
}
|
|
51787
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
51788
|
+
const response = await this.publicGetLiquidation(this.extend(request, params));
|
|
51789
|
+
//
|
|
51790
|
+
// [
|
|
51791
|
+
// {
|
|
51792
|
+
// "orderID": "string",
|
|
51793
|
+
// "symbol": "string",
|
|
51794
|
+
// "side": "string",
|
|
51795
|
+
// "price": 0,
|
|
51796
|
+
// "leavesQty": 0
|
|
51797
|
+
// }
|
|
51798
|
+
// ]
|
|
51799
|
+
//
|
|
51800
|
+
return this.parseLiquidations(response, market, since, limit);
|
|
51801
|
+
}
|
|
51802
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
51803
|
+
//
|
|
51804
|
+
// {
|
|
51805
|
+
// "orderID": "string",
|
|
51806
|
+
// "symbol": "string",
|
|
51807
|
+
// "side": "string",
|
|
51808
|
+
// "price": 0,
|
|
51809
|
+
// "leavesQty": 0
|
|
51810
|
+
// }
|
|
51811
|
+
//
|
|
51812
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
51813
|
+
return {
|
|
51814
|
+
'info': liquidation,
|
|
51815
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
51816
|
+
'contracts': undefined,
|
|
51817
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
51818
|
+
'price': this.safeNumber(liquidation, 'price'),
|
|
51819
|
+
'baseValue': undefined,
|
|
51820
|
+
'quoteValue': undefined,
|
|
51821
|
+
'timestamp': undefined,
|
|
51822
|
+
'datetime': undefined,
|
|
51823
|
+
};
|
|
51824
|
+
}
|
|
51322
51825
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
51323
51826
|
if (response === undefined) {
|
|
51324
51827
|
return undefined;
|
|
@@ -51753,6 +52256,7 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51753
52256
|
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'basePrecision'))),
|
|
51754
52257
|
},
|
|
51755
52258
|
'active': active,
|
|
52259
|
+
'created': undefined,
|
|
51756
52260
|
'info': market,
|
|
51757
52261
|
});
|
|
51758
52262
|
}
|
|
@@ -53532,6 +54036,7 @@ class bitpanda extends _abstract_bitpanda_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
53532
54036
|
'max': undefined,
|
|
53533
54037
|
},
|
|
53534
54038
|
},
|
|
54039
|
+
'created': undefined,
|
|
53535
54040
|
'info': market,
|
|
53536
54041
|
});
|
|
53537
54042
|
}
|
|
@@ -55812,6 +56317,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
55812
56317
|
'max': undefined,
|
|
55813
56318
|
},
|
|
55814
56319
|
},
|
|
56320
|
+
'created': undefined,
|
|
55815
56321
|
'info': market,
|
|
55816
56322
|
};
|
|
55817
56323
|
result.push(entry);
|
|
@@ -57650,6 +58156,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
57650
58156
|
'max': this.safeNumber(market, 'maximum_value'),
|
|
57651
58157
|
},
|
|
57652
58158
|
},
|
|
58159
|
+
'created': undefined,
|
|
57653
58160
|
'info': market,
|
|
57654
58161
|
}, fee));
|
|
57655
58162
|
}
|
|
@@ -59445,6 +59952,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
59445
59952
|
'max': undefined,
|
|
59446
59953
|
},
|
|
59447
59954
|
},
|
|
59955
|
+
'created': undefined,
|
|
59448
59956
|
'info': market,
|
|
59449
59957
|
});
|
|
59450
59958
|
}
|
|
@@ -64228,6 +64736,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
64228
64736
|
'max': undefined,
|
|
64229
64737
|
},
|
|
64230
64738
|
},
|
|
64739
|
+
'created': undefined,
|
|
64231
64740
|
'info': market,
|
|
64232
64741
|
});
|
|
64233
64742
|
}
|
|
@@ -66531,6 +67040,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
|
|
|
66531
67040
|
'max': undefined,
|
|
66532
67041
|
},
|
|
66533
67042
|
},
|
|
67043
|
+
'created': undefined,
|
|
66534
67044
|
});
|
|
66535
67045
|
}
|
|
66536
67046
|
return result;
|
|
@@ -67621,6 +68131,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
67621
68131
|
'max': undefined,
|
|
67622
68132
|
},
|
|
67623
68133
|
},
|
|
68134
|
+
'created': undefined,
|
|
67624
68135
|
'info': market,
|
|
67625
68136
|
});
|
|
67626
68137
|
}
|
|
@@ -69335,6 +69846,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
69335
69846
|
'max': undefined,
|
|
69336
69847
|
},
|
|
69337
69848
|
},
|
|
69849
|
+
'created': undefined,
|
|
69338
69850
|
'info': market,
|
|
69339
69851
|
});
|
|
69340
69852
|
}
|
|
@@ -70990,6 +71502,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70990
71502
|
'max': undefined,
|
|
70991
71503
|
},
|
|
70992
71504
|
},
|
|
71505
|
+
'created': undefined,
|
|
70993
71506
|
'info': entry,
|
|
70994
71507
|
});
|
|
70995
71508
|
}
|
|
@@ -73416,6 +73929,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73416
73929
|
'max': this.safeNumber(lotSizeFilter, 'maxOrderAmt'),
|
|
73417
73930
|
},
|
|
73418
73931
|
},
|
|
73932
|
+
'created': undefined,
|
|
73419
73933
|
'info': market,
|
|
73420
73934
|
});
|
|
73421
73935
|
}
|
|
@@ -73590,6 +74104,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73590
74104
|
'max': undefined,
|
|
73591
74105
|
},
|
|
73592
74106
|
},
|
|
74107
|
+
'created': this.safeInteger(market, 'launchTime'),
|
|
73593
74108
|
'info': market,
|
|
73594
74109
|
});
|
|
73595
74110
|
}
|
|
@@ -73722,6 +74237,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
73722
74237
|
'max': undefined,
|
|
73723
74238
|
},
|
|
73724
74239
|
},
|
|
74240
|
+
'created': this.safeInteger(market, 'launchTime'),
|
|
73725
74241
|
'info': market,
|
|
73726
74242
|
});
|
|
73727
74243
|
}
|
|
@@ -74437,7 +74953,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74437
74953
|
const feeToken = this.safeString(trade, 'feeTokenId');
|
|
74438
74954
|
const feeCurrency = this.safeCurrencyCode(feeToken);
|
|
74439
74955
|
fee = {
|
|
74440
|
-
'cost': feeCost,
|
|
74956
|
+
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeCost),
|
|
74441
74957
|
'currency': feeCurrency,
|
|
74442
74958
|
};
|
|
74443
74959
|
}
|
|
@@ -74603,7 +75119,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74603
75119
|
feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];
|
|
74604
75120
|
}
|
|
74605
75121
|
fee = {
|
|
74606
|
-
'cost': feeCostString,
|
|
75122
|
+
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeCostString),
|
|
74607
75123
|
'currency': feeCurrencyCode,
|
|
74608
75124
|
};
|
|
74609
75125
|
}
|
|
@@ -75176,10 +75692,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75176
75692
|
// }
|
|
75177
75693
|
//
|
|
75178
75694
|
const marketId = this.safeString(order, 'symbol');
|
|
75179
|
-
|
|
75695
|
+
const isContract = ('tpslMode' in order);
|
|
75696
|
+
let marketType = undefined;
|
|
75180
75697
|
if (market !== undefined) {
|
|
75181
75698
|
marketType = market['type'];
|
|
75182
75699
|
}
|
|
75700
|
+
else {
|
|
75701
|
+
marketType = isContract ? 'contract' : 'spot';
|
|
75702
|
+
}
|
|
75183
75703
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
75184
75704
|
const symbol = market['symbol'];
|
|
75185
75705
|
const timestamp = this.safeInteger2(order, 'createdTime', 'createdAt');
|
|
@@ -77199,7 +77719,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77199
77719
|
'referenceAccount': undefined,
|
|
77200
77720
|
'referenceId': referenceId,
|
|
77201
77721
|
'status': undefined,
|
|
77202
|
-
'amount': this.parseNumber(amount),
|
|
77722
|
+
'amount': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(amount)),
|
|
77203
77723
|
'before': this.parseNumber(before),
|
|
77204
77724
|
'after': this.parseNumber(after),
|
|
77205
77725
|
'fee': this.parseNumber(this.safeString(item, 'fee')),
|
|
@@ -77356,10 +77876,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77356
77876
|
const timestamp = this.safeInteger(response, 'time');
|
|
77357
77877
|
const first = this.safeValue(positions, 0, {});
|
|
77358
77878
|
const position = this.parsePosition(first, market);
|
|
77359
|
-
|
|
77360
|
-
|
|
77361
|
-
|
|
77362
|
-
});
|
|
77879
|
+
position['timestamp'] = timestamp;
|
|
77880
|
+
position['datetime'] = this.iso8601(timestamp);
|
|
77881
|
+
return position;
|
|
77363
77882
|
}
|
|
77364
77883
|
async fetchUsdcPositions(symbols = undefined, params = {}) {
|
|
77365
77884
|
await this.loadMarkets();
|
|
@@ -77434,7 +77953,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77434
77953
|
}
|
|
77435
77954
|
results.push(this.parsePosition(rawPosition, market));
|
|
77436
77955
|
}
|
|
77437
|
-
return this.
|
|
77956
|
+
return this.filterByArrayPositions(results, 'symbol', symbols, false);
|
|
77438
77957
|
}
|
|
77439
77958
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
77440
77959
|
/**
|
|
@@ -99905,7 +100424,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
99905
100424
|
const marketInner = this.safeMarket(marketId, undefined, undefined, 'contract');
|
|
99906
100425
|
result.push(this.parsePosition(entry, marketInner));
|
|
99907
100426
|
}
|
|
99908
|
-
return this.
|
|
100427
|
+
return this.filterByArrayPositions(result, 'symbol', undefined, false);
|
|
99909
100428
|
}
|
|
99910
100429
|
parsePosition(position, market = undefined) {
|
|
99911
100430
|
//
|
|
@@ -103708,7 +104227,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
103708
104227
|
side = 'sell';
|
|
103709
104228
|
}
|
|
103710
104229
|
}
|
|
103711
|
-
return {
|
|
104230
|
+
return this.safePosition({
|
|
103712
104231
|
'info': position,
|
|
103713
104232
|
'id': undefined,
|
|
103714
104233
|
'symbol': symbol,
|
|
@@ -103734,7 +104253,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
103734
104253
|
'marginRatio': undefined,
|
|
103735
104254
|
'stopLossPrice': undefined,
|
|
103736
104255
|
'takeProfitPrice': undefined,
|
|
103737
|
-
};
|
|
104256
|
+
});
|
|
103738
104257
|
}
|
|
103739
104258
|
parseOrderStatus(status) {
|
|
103740
104259
|
const statuses = {
|
|
@@ -105180,9 +105699,11 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
105180
105699
|
'fetchFundingRateHistory': true,
|
|
105181
105700
|
'fetchIndexOHLCV': false,
|
|
105182
105701
|
'fetchLeverageTiers': false,
|
|
105702
|
+
'fetchLiquidations': true,
|
|
105183
105703
|
'fetchMarginMode': false,
|
|
105184
105704
|
'fetchMarkets': true,
|
|
105185
105705
|
'fetchMarkOHLCV': false,
|
|
105706
|
+
'fetchMyLiquidations': true,
|
|
105186
105707
|
'fetchMySettlementHistory': false,
|
|
105187
105708
|
'fetchMyTrades': true,
|
|
105188
105709
|
'fetchOHLCV': true,
|
|
@@ -108036,6 +108557,167 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
108036
108557
|
'previousFundingDatetime': undefined,
|
|
108037
108558
|
};
|
|
108038
108559
|
}
|
|
108560
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
108561
|
+
/**
|
|
108562
|
+
* @method
|
|
108563
|
+
* @name deribit#fetchLiquidations
|
|
108564
|
+
* @description retrieves the public liquidations of a trading pair
|
|
108565
|
+
* @see https://docs.deribit.com/#public-get_last_settlements_by_currency
|
|
108566
|
+
* @param {string} symbol unified CCXT market symbol
|
|
108567
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
108568
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
108569
|
+
* @param {object} [params] exchange specific parameters for the deribit api endpoint
|
|
108570
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
108571
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
108572
|
+
*/
|
|
108573
|
+
await this.loadMarkets();
|
|
108574
|
+
let paginate = false;
|
|
108575
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLiquidations', 'paginate');
|
|
108576
|
+
if (paginate) {
|
|
108577
|
+
return await this.fetchPaginatedCallCursor('fetchLiquidations', symbol, since, limit, params, 'continuation', 'continuation', undefined);
|
|
108578
|
+
}
|
|
108579
|
+
const market = this.market(symbol);
|
|
108580
|
+
if (market['spot']) {
|
|
108581
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLiquidations() does not support ' + market['type'] + ' markets');
|
|
108582
|
+
}
|
|
108583
|
+
const request = {
|
|
108584
|
+
'instrument_name': market['id'],
|
|
108585
|
+
'type': 'bankruptcy',
|
|
108586
|
+
};
|
|
108587
|
+
if (since !== undefined) {
|
|
108588
|
+
request['search_start_timestamp'] = since;
|
|
108589
|
+
}
|
|
108590
|
+
if (limit !== undefined) {
|
|
108591
|
+
request['count'] = limit;
|
|
108592
|
+
}
|
|
108593
|
+
const response = await this.publicGetGetLastSettlementsByInstrument(this.extend(request, params));
|
|
108594
|
+
//
|
|
108595
|
+
// {
|
|
108596
|
+
// "jsonrpc": "2.0",
|
|
108597
|
+
// "result": {
|
|
108598
|
+
// "settlements": [
|
|
108599
|
+
// {
|
|
108600
|
+
// "type": "bankruptcy",
|
|
108601
|
+
// "timestamp": 1696579200041,
|
|
108602
|
+
// "funded": 10000.0,
|
|
108603
|
+
// "session_bankrupcy": 10000.0
|
|
108604
|
+
// "session_profit_loss": 112951.68715857354,
|
|
108605
|
+
// "session_tax": 0.15,
|
|
108606
|
+
// "session_tax_rate": 0.0015,
|
|
108607
|
+
// "socialized": 0.001,
|
|
108608
|
+
// },
|
|
108609
|
+
// ],
|
|
108610
|
+
// "continuation": "5dHzoGyD8Hs8KURoUhfgXgHpJTA5oyapoudSmNeAfEftqRbjNE6jNNUpo2oCu1khnZL9ao"
|
|
108611
|
+
// },
|
|
108612
|
+
// "usIn": 1696652052254890,
|
|
108613
|
+
// "usOut": 1696652052255733,
|
|
108614
|
+
// "usDiff": 843,
|
|
108615
|
+
// "testnet": false
|
|
108616
|
+
// }
|
|
108617
|
+
//
|
|
108618
|
+
const result = this.safeValue(response, 'result', {});
|
|
108619
|
+
const cursor = this.safeString(result, 'continuation');
|
|
108620
|
+
const settlements = this.safeValue(result, 'settlements', []);
|
|
108621
|
+
const settlementsWithCursor = this.addPaginationCursorToResult(cursor, settlements);
|
|
108622
|
+
return this.parseLiquidations(settlementsWithCursor, market, since, limit);
|
|
108623
|
+
}
|
|
108624
|
+
addPaginationCursorToResult(cursor, data) {
|
|
108625
|
+
if (cursor !== undefined) {
|
|
108626
|
+
const dataLength = data.length;
|
|
108627
|
+
if (dataLength > 0) {
|
|
108628
|
+
const first = data[0];
|
|
108629
|
+
const last = data[dataLength - 1];
|
|
108630
|
+
first['continuation'] = cursor;
|
|
108631
|
+
last['continuation'] = cursor;
|
|
108632
|
+
data[0] = first;
|
|
108633
|
+
data[dataLength - 1] = last;
|
|
108634
|
+
}
|
|
108635
|
+
}
|
|
108636
|
+
return data;
|
|
108637
|
+
}
|
|
108638
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
108639
|
+
/**
|
|
108640
|
+
* @method
|
|
108641
|
+
* @name deribit#fetchMyLiquidations
|
|
108642
|
+
* @description retrieves the users liquidated positions
|
|
108643
|
+
* @see https://docs.deribit.com/#private-get_settlement_history_by_instrument
|
|
108644
|
+
* @param {string} symbol unified CCXT market symbol
|
|
108645
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
108646
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
108647
|
+
* @param {object} [params] exchange specific parameters for the deribit api endpoint
|
|
108648
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
108649
|
+
*/
|
|
108650
|
+
this.checkRequiredSymbol('fetchMyLiquidations', symbol);
|
|
108651
|
+
await this.loadMarkets();
|
|
108652
|
+
const market = this.market(symbol);
|
|
108653
|
+
if (market['spot']) {
|
|
108654
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
|
|
108655
|
+
}
|
|
108656
|
+
const request = {
|
|
108657
|
+
'instrument_name': market['id'],
|
|
108658
|
+
'type': 'bankruptcy',
|
|
108659
|
+
};
|
|
108660
|
+
if (since !== undefined) {
|
|
108661
|
+
request['search_start_timestamp'] = since;
|
|
108662
|
+
}
|
|
108663
|
+
if (limit !== undefined) {
|
|
108664
|
+
request['count'] = limit;
|
|
108665
|
+
}
|
|
108666
|
+
const response = await this.privateGetGetSettlementHistoryByInstrument(this.extend(request, params));
|
|
108667
|
+
//
|
|
108668
|
+
// {
|
|
108669
|
+
// "jsonrpc": "2.0",
|
|
108670
|
+
// "result": {
|
|
108671
|
+
// "settlements": [
|
|
108672
|
+
// {
|
|
108673
|
+
// "type": "bankruptcy",
|
|
108674
|
+
// "timestamp": 1696579200041,
|
|
108675
|
+
// "funded": 10000.0,
|
|
108676
|
+
// "session_bankrupcy": 10000.0
|
|
108677
|
+
// "session_profit_loss": 112951.68715857354,
|
|
108678
|
+
// "session_tax": 0.15,
|
|
108679
|
+
// "session_tax_rate": 0.0015,
|
|
108680
|
+
// "socialized": 0.001,
|
|
108681
|
+
// },
|
|
108682
|
+
// ],
|
|
108683
|
+
// "continuation": "5dHzoGyD8Hs8KURoUhfgXgHpJTA5oyapoudSmNeAfEftqRbjNE6jNNUpo2oCu1khnZL9ao"
|
|
108684
|
+
// },
|
|
108685
|
+
// "usIn": 1696652052254890,
|
|
108686
|
+
// "usOut": 1696652052255733,
|
|
108687
|
+
// "usDiff": 843,
|
|
108688
|
+
// "testnet": false
|
|
108689
|
+
// }
|
|
108690
|
+
//
|
|
108691
|
+
const result = this.safeValue(response, 'result', {});
|
|
108692
|
+
const settlements = this.safeValue(result, 'settlements', []);
|
|
108693
|
+
return this.parseLiquidations(settlements, market, since, limit);
|
|
108694
|
+
}
|
|
108695
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
108696
|
+
//
|
|
108697
|
+
// {
|
|
108698
|
+
// "type": "bankruptcy",
|
|
108699
|
+
// "timestamp": 1696579200041,
|
|
108700
|
+
// "funded": 1,
|
|
108701
|
+
// "session_bankrupcy": 0.001,
|
|
108702
|
+
// "session_profit_loss": 0.001,
|
|
108703
|
+
// "session_tax": 0.0015,
|
|
108704
|
+
// "session_tax_rate": 0.0015,
|
|
108705
|
+
// "socialized": 0.001,
|
|
108706
|
+
// }
|
|
108707
|
+
//
|
|
108708
|
+
const timestamp = this.safeInteger(liquidation, 'timestamp');
|
|
108709
|
+
return {
|
|
108710
|
+
'info': liquidation,
|
|
108711
|
+
'symbol': this.safeSymbol(undefined, market),
|
|
108712
|
+
'contracts': undefined,
|
|
108713
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
108714
|
+
'price': undefined,
|
|
108715
|
+
'baseValue': this.safeNumber(liquidation, 'session_bankrupcy'),
|
|
108716
|
+
'quoteValue': undefined,
|
|
108717
|
+
'timestamp': timestamp,
|
|
108718
|
+
'datetime': this.iso8601(timestamp),
|
|
108719
|
+
};
|
|
108720
|
+
}
|
|
108039
108721
|
nonce() {
|
|
108040
108722
|
return this.milliseconds();
|
|
108041
108723
|
}
|
|
@@ -114797,10 +115479,12 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
114797
115479
|
'fetchLedger': true,
|
|
114798
115480
|
'fetchLeverage': false,
|
|
114799
115481
|
'fetchLeverageTiers': true,
|
|
115482
|
+
'fetchLiquidations': true,
|
|
114800
115483
|
'fetchMarginMode': false,
|
|
114801
115484
|
'fetchMarketLeverageTiers': 'emulated',
|
|
114802
115485
|
'fetchMarkets': true,
|
|
114803
115486
|
'fetchMarkOHLCV': true,
|
|
115487
|
+
'fetchMyLiquidations': true,
|
|
114804
115488
|
'fetchMySettlementHistory': true,
|
|
114805
115489
|
'fetchMyTrades': true,
|
|
114806
115490
|
'fetchNetworkDepositAddress': true,
|
|
@@ -121018,6 +121702,193 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121018
121702
|
}
|
|
121019
121703
|
return underlyings;
|
|
121020
121704
|
}
|
|
121705
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
121706
|
+
/**
|
|
121707
|
+
* @method
|
|
121708
|
+
* @name gate#fetchLiquidations
|
|
121709
|
+
* @description retrieves the public liquidations of a trading pair
|
|
121710
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-liquidation-history
|
|
121711
|
+
* @param {string} symbol unified CCXT market symbol
|
|
121712
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
121713
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
121714
|
+
* @param {object} [params] exchange specific parameters for the gate api endpoint
|
|
121715
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
121716
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
121717
|
+
*/
|
|
121718
|
+
await this.loadMarkets();
|
|
121719
|
+
const market = this.market(symbol);
|
|
121720
|
+
if (!market['swap']) {
|
|
121721
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLiquidations() supports swap markets only');
|
|
121722
|
+
}
|
|
121723
|
+
let request = {
|
|
121724
|
+
'settle': market['settleId'],
|
|
121725
|
+
'contract': market['id'],
|
|
121726
|
+
};
|
|
121727
|
+
if (since !== undefined) {
|
|
121728
|
+
request['from'] = since;
|
|
121729
|
+
}
|
|
121730
|
+
if (limit !== undefined) {
|
|
121731
|
+
request['limit'] = limit;
|
|
121732
|
+
}
|
|
121733
|
+
[request, params] = this.handleUntilOption('to', request, params);
|
|
121734
|
+
const response = await this.publicFuturesGetSettleLiqOrders(this.extend(request, params));
|
|
121735
|
+
//
|
|
121736
|
+
// [
|
|
121737
|
+
// {
|
|
121738
|
+
// "contract": "BTC_USDT",
|
|
121739
|
+
// "left": 0,
|
|
121740
|
+
// "size": -165,
|
|
121741
|
+
// "fill_price": "28070",
|
|
121742
|
+
// "order_price": "28225",
|
|
121743
|
+
// "time": 1696736132
|
|
121744
|
+
// },
|
|
121745
|
+
// ]
|
|
121746
|
+
//
|
|
121747
|
+
return this.parseLiquidations(response, market, since, limit);
|
|
121748
|
+
}
|
|
121749
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
121750
|
+
/**
|
|
121751
|
+
* @method
|
|
121752
|
+
* @name gate#fetchMyLiquidations
|
|
121753
|
+
* @description retrieves the users liquidated positions
|
|
121754
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history
|
|
121755
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history-2
|
|
121756
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-user-s-liquidation-history-of-specified-underlying
|
|
121757
|
+
* @param {string} symbol unified CCXT market symbol
|
|
121758
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
121759
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
121760
|
+
* @param {object} [params] exchange specific parameters for the gate api endpoint
|
|
121761
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
121762
|
+
*/
|
|
121763
|
+
this.checkRequiredSymbol('fetchMyLiquidations', symbol);
|
|
121764
|
+
await this.loadMarkets();
|
|
121765
|
+
const market = this.market(symbol);
|
|
121766
|
+
const request = {
|
|
121767
|
+
'contract': market['id'],
|
|
121768
|
+
};
|
|
121769
|
+
let response = undefined;
|
|
121770
|
+
if ((market['swap']) || (market['future'])) {
|
|
121771
|
+
if (limit !== undefined) {
|
|
121772
|
+
request['limit'] = limit;
|
|
121773
|
+
}
|
|
121774
|
+
request['settle'] = market['settleId'];
|
|
121775
|
+
}
|
|
121776
|
+
else if (market['option']) {
|
|
121777
|
+
const marketId = market['id'];
|
|
121778
|
+
const optionParts = marketId.split('-');
|
|
121779
|
+
request['underlying'] = this.safeString(optionParts, 0);
|
|
121780
|
+
}
|
|
121781
|
+
if (market['swap']) {
|
|
121782
|
+
response = await this.privateFuturesGetSettleLiquidates(this.extend(request, params));
|
|
121783
|
+
}
|
|
121784
|
+
else if (market['future']) {
|
|
121785
|
+
response = await this.privateDeliveryGetSettleLiquidates(this.extend(request, params));
|
|
121786
|
+
}
|
|
121787
|
+
else if (market['option']) {
|
|
121788
|
+
response = await this.privateOptionsGetPositionClose(this.extend(request, params));
|
|
121789
|
+
}
|
|
121790
|
+
else {
|
|
121791
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' orders');
|
|
121792
|
+
}
|
|
121793
|
+
//
|
|
121794
|
+
// swap and future
|
|
121795
|
+
//
|
|
121796
|
+
// [
|
|
121797
|
+
// {
|
|
121798
|
+
// "time": 1548654951,
|
|
121799
|
+
// "contract": "BTC_USDT",
|
|
121800
|
+
// "size": 600,
|
|
121801
|
+
// "leverage": "25",
|
|
121802
|
+
// "margin": "0.006705256878",
|
|
121803
|
+
// "entry_price": "3536.123",
|
|
121804
|
+
// "liq_price": "3421.54",
|
|
121805
|
+
// "mark_price": "3420.27",
|
|
121806
|
+
// "order_id": 317393847,
|
|
121807
|
+
// "order_price": "3405",
|
|
121808
|
+
// "fill_price": "3424",
|
|
121809
|
+
// "left": 0
|
|
121810
|
+
// }
|
|
121811
|
+
// ]
|
|
121812
|
+
//
|
|
121813
|
+
// option
|
|
121814
|
+
//
|
|
121815
|
+
// [
|
|
121816
|
+
// {
|
|
121817
|
+
// "time": 1631764800,
|
|
121818
|
+
// "pnl": "-42914.291",
|
|
121819
|
+
// "settle_size": "-10001",
|
|
121820
|
+
// "side": "short",
|
|
121821
|
+
// "contract": "BTC_USDT-20210916-5000-C",
|
|
121822
|
+
// "text": "settled"
|
|
121823
|
+
// }
|
|
121824
|
+
// ]
|
|
121825
|
+
//
|
|
121826
|
+
return this.parseLiquidations(response, market, since, limit);
|
|
121827
|
+
}
|
|
121828
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
121829
|
+
//
|
|
121830
|
+
// fetchLiquidations
|
|
121831
|
+
//
|
|
121832
|
+
// {
|
|
121833
|
+
// "contract": "BTC_USDT",
|
|
121834
|
+
// "left": 0,
|
|
121835
|
+
// "size": -165,
|
|
121836
|
+
// "fill_price": "28070",
|
|
121837
|
+
// "order_price": "28225",
|
|
121838
|
+
// "time": 1696736132
|
|
121839
|
+
// }
|
|
121840
|
+
//
|
|
121841
|
+
// swap and future: fetchMyLiquidations
|
|
121842
|
+
//
|
|
121843
|
+
// {
|
|
121844
|
+
// "time": 1548654951,
|
|
121845
|
+
// "contract": "BTC_USDT",
|
|
121846
|
+
// "size": 600,
|
|
121847
|
+
// "leverage": "25",
|
|
121848
|
+
// "margin": "0.006705256878",
|
|
121849
|
+
// "entry_price": "3536.123",
|
|
121850
|
+
// "liq_price": "3421.54",
|
|
121851
|
+
// "mark_price": "3420.27",
|
|
121852
|
+
// "order_id": 317393847,
|
|
121853
|
+
// "order_price": "3405",
|
|
121854
|
+
// "fill_price": "3424",
|
|
121855
|
+
// "left": 0
|
|
121856
|
+
// }
|
|
121857
|
+
//
|
|
121858
|
+
// option: fetchMyLiquidations
|
|
121859
|
+
//
|
|
121860
|
+
// {
|
|
121861
|
+
// "time": 1631764800,
|
|
121862
|
+
// "pnl": "-42914.291",
|
|
121863
|
+
// "settle_size": "-10001",
|
|
121864
|
+
// "side": "short",
|
|
121865
|
+
// "contract": "BTC_USDT-20210916-5000-C",
|
|
121866
|
+
// "text": "settled"
|
|
121867
|
+
// }
|
|
121868
|
+
//
|
|
121869
|
+
const marketId = this.safeString(liquidation, 'contract');
|
|
121870
|
+
const timestamp = this.safeTimestamp(liquidation, 'time');
|
|
121871
|
+
const contractsStringRaw = this.safeString2(liquidation, 'size', 'settle_size');
|
|
121872
|
+
const contractsString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(contractsStringRaw);
|
|
121873
|
+
const contractSizeString = this.safeString(market, 'contractSize');
|
|
121874
|
+
const priceString = this.safeString2(liquidation, 'liq_price', 'fill_price');
|
|
121875
|
+
const baseValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(contractsString, contractSizeString);
|
|
121876
|
+
let quoteValueString = this.safeString(liquidation, 'pnl');
|
|
121877
|
+
if (quoteValueString === undefined) {
|
|
121878
|
+
quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
121879
|
+
}
|
|
121880
|
+
return {
|
|
121881
|
+
'info': liquidation,
|
|
121882
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
121883
|
+
'contracts': this.parseNumber(contractsString),
|
|
121884
|
+
'contractSize': this.parseNumber(contractSizeString),
|
|
121885
|
+
'price': this.parseNumber(priceString),
|
|
121886
|
+
'baseValue': this.parseNumber(baseValueString),
|
|
121887
|
+
'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(quoteValueString)),
|
|
121888
|
+
'timestamp': timestamp,
|
|
121889
|
+
'datetime': this.iso8601(timestamp),
|
|
121890
|
+
};
|
|
121891
|
+
}
|
|
121021
121892
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
121022
121893
|
if (response === undefined) {
|
|
121023
121894
|
return undefined;
|
|
@@ -127991,9 +128862,11 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
127991
128862
|
'fetchLedgerEntry': undefined,
|
|
127992
128863
|
'fetchLeverage': false,
|
|
127993
128864
|
'fetchLeverageTiers': true,
|
|
128865
|
+
'fetchLiquidations': true,
|
|
127994
128866
|
'fetchMarketLeverageTiers': true,
|
|
127995
128867
|
'fetchMarkets': true,
|
|
127996
128868
|
'fetchMarkOHLCV': true,
|
|
128869
|
+
'fetchMyLiquidations': false,
|
|
127997
128870
|
'fetchMyTrades': true,
|
|
127998
128871
|
'fetchOHLCV': true,
|
|
127999
128872
|
'fetchOpenInterest': true,
|
|
@@ -135134,10 +136007,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
135134
136007
|
}
|
|
135135
136008
|
const timestamp = this.safeInteger(response, 'ts');
|
|
135136
136009
|
const parsed = this.parsePosition(this.extend(position, omitted));
|
|
135137
|
-
|
|
135138
|
-
|
|
135139
|
-
|
|
135140
|
-
});
|
|
136010
|
+
parsed['timestamp'] = timestamp;
|
|
136011
|
+
parsed['datetime'] = this.iso8601(timestamp);
|
|
136012
|
+
return parsed;
|
|
135141
136013
|
}
|
|
135142
136014
|
parseLedgerEntryType(type) {
|
|
135143
136015
|
const types = {
|
|
@@ -136147,6 +137019,106 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136147
137019
|
'datetime': this.iso8601(timestamp),
|
|
136148
137020
|
};
|
|
136149
137021
|
}
|
|
137022
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
137023
|
+
/**
|
|
137024
|
+
* @method
|
|
137025
|
+
* @name huobi#fetchLiquidations
|
|
137026
|
+
* @description retrieves the public liquidations of a trading pair
|
|
137027
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-liquidation-orders-new
|
|
137028
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-liquidation-orders-new
|
|
137029
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#query-liquidation-order-information-new
|
|
137030
|
+
* @param {string} symbol unified CCXT market symbol
|
|
137031
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
137032
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
137033
|
+
* @param {object} [params] exchange specific parameters for the huobi api endpoint
|
|
137034
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
137035
|
+
* @param {int} [params.tradeType] default 0, linear swap 0: all liquidated orders, 5: liquidated longs; 6: liquidated shorts, inverse swap and future 0: filled liquidated orders, 5: liquidated close orders, 6: liquidated open orders
|
|
137036
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
137037
|
+
*/
|
|
137038
|
+
await this.loadMarkets();
|
|
137039
|
+
const market = this.market(symbol);
|
|
137040
|
+
const tradeType = this.safeInteger(params, 'trade_type', 0);
|
|
137041
|
+
let request = {
|
|
137042
|
+
'trade_type': tradeType,
|
|
137043
|
+
};
|
|
137044
|
+
if (since !== undefined) {
|
|
137045
|
+
request['start_time'] = since;
|
|
137046
|
+
}
|
|
137047
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
137048
|
+
let response = undefined;
|
|
137049
|
+
if (market['swap']) {
|
|
137050
|
+
request['contract'] = market['id'];
|
|
137051
|
+
if (market['linear']) {
|
|
137052
|
+
response = await this.contractPublicGetLinearSwapApiV3SwapLiquidationOrders(this.extend(request, params));
|
|
137053
|
+
}
|
|
137054
|
+
else {
|
|
137055
|
+
response = await this.contractPublicGetSwapApiV3SwapLiquidationOrders(this.extend(request, params));
|
|
137056
|
+
}
|
|
137057
|
+
}
|
|
137058
|
+
else if (market['future']) {
|
|
137059
|
+
request['symbol'] = market['id'];
|
|
137060
|
+
response = await this.contractPublicGetApiV3ContractLiquidationOrders(this.extend(request, params));
|
|
137061
|
+
}
|
|
137062
|
+
else {
|
|
137063
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLiquidations() does not support ' + market['type'] + ' orders');
|
|
137064
|
+
}
|
|
137065
|
+
//
|
|
137066
|
+
// {
|
|
137067
|
+
// "code": 200,
|
|
137068
|
+
// "msg": "",
|
|
137069
|
+
// "data": [
|
|
137070
|
+
// {
|
|
137071
|
+
// "query_id": 452057,
|
|
137072
|
+
// "contract_code": "BTC-USDT-211210",
|
|
137073
|
+
// "symbol": "USDT",
|
|
137074
|
+
// "direction": "sell",
|
|
137075
|
+
// "offset": "close",
|
|
137076
|
+
// "volume": 479.000000000000000000,
|
|
137077
|
+
// "price": 51441.700000000000000000,
|
|
137078
|
+
// "created_at": 1638593647864,
|
|
137079
|
+
// "amount": 0.479000000000000000,
|
|
137080
|
+
// "trade_turnover": 24640.574300000000000000,
|
|
137081
|
+
// "business_type": "futures",
|
|
137082
|
+
// "pair": "BTC-USDT"
|
|
137083
|
+
// }
|
|
137084
|
+
// ],
|
|
137085
|
+
// "ts": 1604312615051
|
|
137086
|
+
// }
|
|
137087
|
+
//
|
|
137088
|
+
const data = this.safeValue(response, 'data', []);
|
|
137089
|
+
return this.parseLiquidations(data, market, since, limit);
|
|
137090
|
+
}
|
|
137091
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
137092
|
+
//
|
|
137093
|
+
// {
|
|
137094
|
+
// "query_id": 452057,
|
|
137095
|
+
// "contract_code": "BTC-USDT-211210",
|
|
137096
|
+
// "symbol": "USDT",
|
|
137097
|
+
// "direction": "sell",
|
|
137098
|
+
// "offset": "close",
|
|
137099
|
+
// "volume": 479.000000000000000000,
|
|
137100
|
+
// "price": 51441.700000000000000000,
|
|
137101
|
+
// "created_at": 1638593647864,
|
|
137102
|
+
// "amount": 0.479000000000000000,
|
|
137103
|
+
// "trade_turnover": 24640.574300000000000000,
|
|
137104
|
+
// "business_type": "futures",
|
|
137105
|
+
// "pair": "BTC-USDT"
|
|
137106
|
+
// }
|
|
137107
|
+
//
|
|
137108
|
+
const marketId = this.safeString(liquidation, 'contract_code');
|
|
137109
|
+
const timestamp = this.safeInteger(liquidation, 'created_at');
|
|
137110
|
+
return {
|
|
137111
|
+
'info': liquidation,
|
|
137112
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
137113
|
+
'contracts': this.safeNumber(liquidation, 'volume'),
|
|
137114
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
137115
|
+
'price': this.safeNumber(liquidation, 'price'),
|
|
137116
|
+
'baseValue': this.safeNumber(liquidation, 'amount'),
|
|
137117
|
+
'quoteValue': this.safeNumber(liquidation, 'trade_turnover'),
|
|
137118
|
+
'timestamp': timestamp,
|
|
137119
|
+
'datetime': this.iso8601(timestamp),
|
|
137120
|
+
};
|
|
137121
|
+
}
|
|
136150
137122
|
}
|
|
136151
137123
|
|
|
136152
137124
|
|
|
@@ -147762,6 +148734,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147762
148734
|
'id': accountId,
|
|
147763
148735
|
'type': type,
|
|
147764
148736
|
'currency': code,
|
|
148737
|
+
'code': code,
|
|
147765
148738
|
'info': account,
|
|
147766
148739
|
});
|
|
147767
148740
|
}
|
|
@@ -151848,7 +152821,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151848
152821
|
//
|
|
151849
152822
|
const symbol = this.safeString(position, 'symbol');
|
|
151850
152823
|
market = this.safeMarket(symbol, market);
|
|
151851
|
-
const timestamp = this.
|
|
152824
|
+
const timestamp = this.safeInteger(position, 'currentTimestamp');
|
|
151852
152825
|
const size = this.safeString(position, 'currentQty');
|
|
151853
152826
|
let side = undefined;
|
|
151854
152827
|
if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(size, '0')) {
|
|
@@ -178387,6 +179360,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
178387
179360
|
'type': type,
|
|
178388
179361
|
'currency': undefined,
|
|
178389
179362
|
'info': account,
|
|
179363
|
+
'code': undefined,
|
|
178390
179364
|
});
|
|
178391
179365
|
}
|
|
178392
179366
|
return result;
|
|
@@ -179261,6 +180235,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179261
180235
|
}
|
|
179262
180236
|
}
|
|
179263
180237
|
else if (price === 'index') {
|
|
180238
|
+
request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
|
|
179264
180239
|
if (isHistoryCandles) {
|
|
179265
180240
|
response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
|
|
179266
180241
|
}
|
|
@@ -189215,39 +190190,51 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189215
190190
|
'markets/{symbol}': 1,
|
|
189216
190191
|
'currencies': 20,
|
|
189217
190192
|
'currencies/{currency}': 20,
|
|
190193
|
+
'v2/currencies': 20,
|
|
190194
|
+
'v2/currencies/{currency}': 20,
|
|
189218
190195
|
'timestamp': 1,
|
|
189219
190196
|
'markets/price': 1,
|
|
189220
190197
|
'markets/{symbol}/price': 1,
|
|
190198
|
+
'markets/markPrice': 1,
|
|
190199
|
+
'markets/{symbol}/markPrice': 1,
|
|
190200
|
+
'markets/{symbol}/markPriceComponents': 1,
|
|
189221
190201
|
'markets/{symbol}/orderBook': 1,
|
|
189222
190202
|
'markets/{symbol}/candles': 1,
|
|
189223
190203
|
'markets/{symbol}/trades': 20,
|
|
189224
190204
|
'markets/ticker24h': 20,
|
|
189225
190205
|
'markets/{symbol}/ticker24h': 20,
|
|
190206
|
+
'markets/collateralInfo': 1,
|
|
190207
|
+
'markets/{currency}/collateralInfo': 1,
|
|
190208
|
+
'markets/borrowRatesInfo': 1,
|
|
189226
190209
|
},
|
|
189227
190210
|
},
|
|
189228
190211
|
'private': {
|
|
189229
190212
|
'get': {
|
|
189230
190213
|
'accounts': 4,
|
|
189231
|
-
'accounts/activity': 4,
|
|
189232
190214
|
'accounts/balances': 4,
|
|
189233
190215
|
'accounts/{id}/balances': 4,
|
|
190216
|
+
'accounts/activity': 20,
|
|
189234
190217
|
'accounts/transfer': 20,
|
|
189235
190218
|
'accounts/transfer/{id}': 4,
|
|
190219
|
+
'feeinfo': 20,
|
|
190220
|
+
'accounts/interest/history': 1,
|
|
189236
190221
|
'subaccounts': 4,
|
|
189237
190222
|
'subaccounts/balances': 20,
|
|
189238
190223
|
'subaccounts/{id}/balances': 4,
|
|
189239
190224
|
'subaccounts/transfer': 20,
|
|
189240
190225
|
'subaccounts/transfer/{id}': 4,
|
|
189241
|
-
'feeinfo': 20,
|
|
189242
190226
|
'wallets/addresses': 20,
|
|
189243
|
-
'wallets/activity': 20,
|
|
189244
190227
|
'wallets/addresses/{currency}': 20,
|
|
190228
|
+
'wallets/activity': 20,
|
|
190229
|
+
'margin/accountMargin': 4,
|
|
190230
|
+
'margin/borrowStatus': 4,
|
|
190231
|
+
'margin/maxSize': 4,
|
|
189245
190232
|
'orders': 20,
|
|
189246
190233
|
'orders/{id}': 4,
|
|
189247
|
-
'orders/history': 20,
|
|
189248
190234
|
'orders/killSwitchStatus': 4,
|
|
189249
190235
|
'smartorders': 20,
|
|
189250
190236
|
'smartorders/{id}': 4,
|
|
190237
|
+
'orders/history': 20,
|
|
189251
190238
|
'smartorders/history': 20,
|
|
189252
190239
|
'trades': 20,
|
|
189253
190240
|
'orders/{id}/trades': 4,
|
|
@@ -189257,9 +190244,10 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189257
190244
|
'subaccounts/transfer': 20,
|
|
189258
190245
|
'wallets/address': 20,
|
|
189259
190246
|
'wallets/withdraw': 20,
|
|
190247
|
+
'v2/wallets/withdraw': 20,
|
|
189260
190248
|
'orders': 4,
|
|
189261
|
-
'orders/killSwitch': 4,
|
|
189262
190249
|
'orders/batch': 20,
|
|
190250
|
+
'orders/killSwitch': 4,
|
|
189263
190251
|
'smartorders': 4,
|
|
189264
190252
|
},
|
|
189265
190253
|
'delete': {
|
|
@@ -189271,8 +190259,8 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189271
190259
|
'smartorders': 20,
|
|
189272
190260
|
},
|
|
189273
190261
|
'put': {
|
|
189274
|
-
'orders/{id}':
|
|
189275
|
-
'smartorders/{id}':
|
|
190262
|
+
'orders/{id}': 20,
|
|
190263
|
+
'smartorders/{id}': 20,
|
|
189276
190264
|
},
|
|
189277
190265
|
},
|
|
189278
190266
|
},
|
|
@@ -189399,6 +190387,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189399
190387
|
'21352': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
|
|
189400
190388
|
'21353': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
189401
190389
|
'21354': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
190390
|
+
'21359': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
189402
190391
|
'21360': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
|
|
189403
190392
|
'24106': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
189404
190393
|
'24201': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeNotAvailable,
|
|
@@ -262181,6 +263170,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
262181
263170
|
'fetchMarginMode': false,
|
|
262182
263171
|
'fetchMarkets': true,
|
|
262183
263172
|
'fetchMarkOHLCV': false,
|
|
263173
|
+
'fetchMyTrades': true,
|
|
262184
263174
|
'fetchOHLCV': true,
|
|
262185
263175
|
'fetchOpenInterestHistory': false,
|
|
262186
263176
|
'fetchOpenOrders': true,
|
|
@@ -276555,7 +277545,7 @@ SOFTWARE.
|
|
|
276555
277545
|
|
|
276556
277546
|
//-----------------------------------------------------------------------------
|
|
276557
277547
|
// this is updated by vss.js when building
|
|
276558
|
-
const version = '4.1.
|
|
277548
|
+
const version = '4.1.13';
|
|
276559
277549
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
276560
277550
|
//-----------------------------------------------------------------------------
|
|
276561
277551
|
|