ccxt 4.1.12 → 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 +947 -15
- package/dist/ccxt.browser.min.js +2 -2
- 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 +231 -1
- 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 +11 -2
- 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 +3 -3
- package/dist/cjs/src/deribit.js +163 -0
- package/dist/cjs/src/gate.js +189 -0
- package/dist/cjs/src/huobi.js +102 -0
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/poloniex.js +20 -7
- 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 +231 -1
- 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 +11 -2
- 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.js +3 -3
- 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 +12 -0
- package/js/src/huobi.js +102 -0
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/okx.js +1 -0
- package/js/src/poloniex.js +20 -7
- 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,
|
|
@@ -24240,13 +24275,15 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24240
24275
|
let type = undefined;
|
|
24241
24276
|
let subType = undefined;
|
|
24242
24277
|
let currency = undefined;
|
|
24278
|
+
if (code !== undefined) {
|
|
24279
|
+
currency = this.currency(code);
|
|
24280
|
+
}
|
|
24243
24281
|
let method = undefined;
|
|
24244
24282
|
const request = {};
|
|
24245
24283
|
[type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
|
|
24246
24284
|
[subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
|
|
24247
24285
|
if (type === 'option') {
|
|
24248
24286
|
this.checkRequiredArgument('fetchLedger', code, 'code');
|
|
24249
|
-
currency = this.currency(code);
|
|
24250
24287
|
request['currency'] = currency['id'];
|
|
24251
24288
|
method = 'eapiPrivateGetBill';
|
|
24252
24289
|
}
|
|
@@ -25201,6 +25238,232 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25201
25238
|
'info': interest,
|
|
25202
25239
|
}, market);
|
|
25203
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
|
+
}
|
|
25204
25467
|
}
|
|
25205
25468
|
|
|
25206
25469
|
|
|
@@ -26002,6 +26265,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26002
26265
|
'max': this.safeNumber(market, 'maxNotional'),
|
|
26003
26266
|
},
|
|
26004
26267
|
},
|
|
26268
|
+
'created': undefined,
|
|
26005
26269
|
'info': market,
|
|
26006
26270
|
};
|
|
26007
26271
|
return entry;
|
|
@@ -29707,6 +29971,7 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
29707
29971
|
'max': undefined,
|
|
29708
29972
|
},
|
|
29709
29973
|
},
|
|
29974
|
+
'created': undefined,
|
|
29710
29975
|
'info': entry,
|
|
29711
29976
|
});
|
|
29712
29977
|
}
|
|
@@ -30765,6 +31030,7 @@ class bitbns extends _abstract_bitbns_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
30765
31030
|
'max': this.safeNumber(costLimits, 'max'),
|
|
30766
31031
|
},
|
|
30767
31032
|
},
|
|
31033
|
+
'created': undefined,
|
|
30768
31034
|
'info': market,
|
|
30769
31035
|
});
|
|
30770
31036
|
}
|
|
@@ -32395,6 +32661,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
32395
32661
|
'max': undefined,
|
|
32396
32662
|
},
|
|
32397
32663
|
},
|
|
32664
|
+
'created': undefined,
|
|
32398
32665
|
'info': market,
|
|
32399
32666
|
});
|
|
32400
32667
|
}
|
|
@@ -33994,6 +34261,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
33994
34261
|
'max': undefined,
|
|
33995
34262
|
},
|
|
33996
34263
|
},
|
|
34264
|
+
'created': undefined,
|
|
33997
34265
|
'info': market,
|
|
33998
34266
|
});
|
|
33999
34267
|
}
|
|
@@ -36709,6 +36977,7 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36709
36977
|
'max': undefined,
|
|
36710
36978
|
},
|
|
36711
36979
|
},
|
|
36980
|
+
'created': undefined,
|
|
36712
36981
|
'info': market,
|
|
36713
36982
|
});
|
|
36714
36983
|
}
|
|
@@ -37699,6 +37968,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37699
37968
|
'max': undefined,
|
|
37700
37969
|
},
|
|
37701
37970
|
},
|
|
37971
|
+
'created': undefined,
|
|
37702
37972
|
'info': market,
|
|
37703
37973
|
});
|
|
37704
37974
|
}
|
|
@@ -39776,6 +40046,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39776
40046
|
'max': undefined,
|
|
39777
40047
|
},
|
|
39778
40048
|
},
|
|
40049
|
+
'created': undefined,
|
|
39779
40050
|
};
|
|
39780
40051
|
}
|
|
39781
40052
|
return result;
|
|
@@ -42184,8 +42455,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42184
42455
|
//
|
|
42185
42456
|
const data = this.safeValue(response, 'data');
|
|
42186
42457
|
if (data !== undefined) {
|
|
42187
|
-
|
|
42188
|
-
|
|
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
|
+
}
|
|
42189
42468
|
}
|
|
42190
42469
|
const parsedData = JSON.parse(response);
|
|
42191
42470
|
return this.safeValue(parsedData, 'data', []);
|
|
@@ -43872,6 +44151,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
43872
44151
|
},
|
|
43873
44152
|
'cost': {}, // set via options
|
|
43874
44153
|
},
|
|
44154
|
+
'created': undefined,
|
|
43875
44155
|
'info': market,
|
|
43876
44156
|
}, extension);
|
|
43877
44157
|
result.push(entry);
|
|
@@ -44769,8 +45049,10 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
44769
45049
|
'fetchFundingRate': true,
|
|
44770
45050
|
'fetchFundingRateHistory': false,
|
|
44771
45051
|
'fetchFundingRates': false,
|
|
45052
|
+
'fetchLiquidations': false,
|
|
44772
45053
|
'fetchMarginMode': false,
|
|
44773
45054
|
'fetchMarkets': true,
|
|
45055
|
+
'fetchMyLiquidations': true,
|
|
44774
45056
|
'fetchMyTrades': true,
|
|
44775
45057
|
'fetchOHLCV': true,
|
|
44776
45058
|
'fetchOpenInterest': true,
|
|
@@ -48643,6 +48925,107 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
48643
48925
|
'takeProfitPrice': undefined,
|
|
48644
48926
|
});
|
|
48645
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
|
+
}
|
|
48646
49029
|
nonce() {
|
|
48647
49030
|
return this.milliseconds();
|
|
48648
49031
|
}
|
|
@@ -48779,9 +49162,11 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48779
49162
|
'fetchLedger': true,
|
|
48780
49163
|
'fetchLeverage': false,
|
|
48781
49164
|
'fetchLeverageTiers': false,
|
|
49165
|
+
'fetchLiquidations': true,
|
|
48782
49166
|
'fetchMarketLeverageTiers': false,
|
|
48783
49167
|
'fetchMarkets': true,
|
|
48784
49168
|
'fetchMarkOHLCV': false,
|
|
49169
|
+
'fetchMyLiquidations': false,
|
|
48785
49170
|
'fetchMyTrades': true,
|
|
48786
49171
|
'fetchOHLCV': true,
|
|
48787
49172
|
'fetchOpenOrders': true,
|
|
@@ -51369,6 +51754,74 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
51369
51754
|
}
|
|
51370
51755
|
return cost;
|
|
51371
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
|
+
}
|
|
51372
51825
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
51373
51826
|
if (response === undefined) {
|
|
51374
51827
|
return undefined;
|
|
@@ -51803,6 +52256,7 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51803
52256
|
'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'basePrecision'))),
|
|
51804
52257
|
},
|
|
51805
52258
|
'active': active,
|
|
52259
|
+
'created': undefined,
|
|
51806
52260
|
'info': market,
|
|
51807
52261
|
});
|
|
51808
52262
|
}
|
|
@@ -53582,6 +54036,7 @@ class bitpanda extends _abstract_bitpanda_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
53582
54036
|
'max': undefined,
|
|
53583
54037
|
},
|
|
53584
54038
|
},
|
|
54039
|
+
'created': undefined,
|
|
53585
54040
|
'info': market,
|
|
53586
54041
|
});
|
|
53587
54042
|
}
|
|
@@ -55862,6 +56317,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
55862
56317
|
'max': undefined,
|
|
55863
56318
|
},
|
|
55864
56319
|
},
|
|
56320
|
+
'created': undefined,
|
|
55865
56321
|
'info': market,
|
|
55866
56322
|
};
|
|
55867
56323
|
result.push(entry);
|
|
@@ -57700,6 +58156,7 @@ class bitso extends _abstract_bitso_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
57700
58156
|
'max': this.safeNumber(market, 'maximum_value'),
|
|
57701
58157
|
},
|
|
57702
58158
|
},
|
|
58159
|
+
'created': undefined,
|
|
57703
58160
|
'info': market,
|
|
57704
58161
|
}, fee));
|
|
57705
58162
|
}
|
|
@@ -59495,6 +59952,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
59495
59952
|
'max': undefined,
|
|
59496
59953
|
},
|
|
59497
59954
|
},
|
|
59955
|
+
'created': undefined,
|
|
59498
59956
|
'info': market,
|
|
59499
59957
|
});
|
|
59500
59958
|
}
|
|
@@ -64278,6 +64736,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
64278
64736
|
'max': undefined,
|
|
64279
64737
|
},
|
|
64280
64738
|
},
|
|
64739
|
+
'created': undefined,
|
|
64281
64740
|
'info': market,
|
|
64282
64741
|
});
|
|
64283
64742
|
}
|
|
@@ -66581,6 +67040,7 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
|
|
|
66581
67040
|
'max': undefined,
|
|
66582
67041
|
},
|
|
66583
67042
|
},
|
|
67043
|
+
'created': undefined,
|
|
66584
67044
|
});
|
|
66585
67045
|
}
|
|
66586
67046
|
return result;
|
|
@@ -67671,6 +68131,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
67671
68131
|
'max': undefined,
|
|
67672
68132
|
},
|
|
67673
68133
|
},
|
|
68134
|
+
'created': undefined,
|
|
67674
68135
|
'info': market,
|
|
67675
68136
|
});
|
|
67676
68137
|
}
|
|
@@ -69385,6 +69846,7 @@ class btcmarkets extends _abstract_btcmarkets_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
69385
69846
|
'max': undefined,
|
|
69386
69847
|
},
|
|
69387
69848
|
},
|
|
69849
|
+
'created': undefined,
|
|
69388
69850
|
'info': market,
|
|
69389
69851
|
});
|
|
69390
69852
|
}
|
|
@@ -71040,6 +71502,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71040
71502
|
'max': undefined,
|
|
71041
71503
|
},
|
|
71042
71504
|
},
|
|
71505
|
+
'created': undefined,
|
|
71043
71506
|
'info': entry,
|
|
71044
71507
|
});
|
|
71045
71508
|
}
|
|
@@ -74490,7 +74953,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74490
74953
|
const feeToken = this.safeString(trade, 'feeTokenId');
|
|
74491
74954
|
const feeCurrency = this.safeCurrencyCode(feeToken);
|
|
74492
74955
|
fee = {
|
|
74493
|
-
'cost': feeCost,
|
|
74956
|
+
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeCost),
|
|
74494
74957
|
'currency': feeCurrency,
|
|
74495
74958
|
};
|
|
74496
74959
|
}
|
|
@@ -74656,7 +75119,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74656
75119
|
feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];
|
|
74657
75120
|
}
|
|
74658
75121
|
fee = {
|
|
74659
|
-
'cost': feeCostString,
|
|
75122
|
+
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeCostString),
|
|
74660
75123
|
'currency': feeCurrencyCode,
|
|
74661
75124
|
};
|
|
74662
75125
|
}
|
|
@@ -77256,7 +77719,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77256
77719
|
'referenceAccount': undefined,
|
|
77257
77720
|
'referenceId': referenceId,
|
|
77258
77721
|
'status': undefined,
|
|
77259
|
-
'amount': this.parseNumber(amount),
|
|
77722
|
+
'amount': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(amount)),
|
|
77260
77723
|
'before': this.parseNumber(before),
|
|
77261
77724
|
'after': this.parseNumber(after),
|
|
77262
77725
|
'fee': this.parseNumber(this.safeString(item, 'fee')),
|
|
@@ -105236,9 +105699,11 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
105236
105699
|
'fetchFundingRateHistory': true,
|
|
105237
105700
|
'fetchIndexOHLCV': false,
|
|
105238
105701
|
'fetchLeverageTiers': false,
|
|
105702
|
+
'fetchLiquidations': true,
|
|
105239
105703
|
'fetchMarginMode': false,
|
|
105240
105704
|
'fetchMarkets': true,
|
|
105241
105705
|
'fetchMarkOHLCV': false,
|
|
105706
|
+
'fetchMyLiquidations': true,
|
|
105242
105707
|
'fetchMySettlementHistory': false,
|
|
105243
105708
|
'fetchMyTrades': true,
|
|
105244
105709
|
'fetchOHLCV': true,
|
|
@@ -108092,6 +108557,167 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
108092
108557
|
'previousFundingDatetime': undefined,
|
|
108093
108558
|
};
|
|
108094
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
|
+
}
|
|
108095
108721
|
nonce() {
|
|
108096
108722
|
return this.milliseconds();
|
|
108097
108723
|
}
|
|
@@ -114853,10 +115479,12 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
114853
115479
|
'fetchLedger': true,
|
|
114854
115480
|
'fetchLeverage': false,
|
|
114855
115481
|
'fetchLeverageTiers': true,
|
|
115482
|
+
'fetchLiquidations': true,
|
|
114856
115483
|
'fetchMarginMode': false,
|
|
114857
115484
|
'fetchMarketLeverageTiers': 'emulated',
|
|
114858
115485
|
'fetchMarkets': true,
|
|
114859
115486
|
'fetchMarkOHLCV': true,
|
|
115487
|
+
'fetchMyLiquidations': true,
|
|
114860
115488
|
'fetchMySettlementHistory': true,
|
|
114861
115489
|
'fetchMyTrades': true,
|
|
114862
115490
|
'fetchNetworkDepositAddress': true,
|
|
@@ -121074,6 +121702,193 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121074
121702
|
}
|
|
121075
121703
|
return underlyings;
|
|
121076
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
|
+
}
|
|
121077
121892
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
121078
121893
|
if (response === undefined) {
|
|
121079
121894
|
return undefined;
|
|
@@ -128047,9 +128862,11 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
128047
128862
|
'fetchLedgerEntry': undefined,
|
|
128048
128863
|
'fetchLeverage': false,
|
|
128049
128864
|
'fetchLeverageTiers': true,
|
|
128865
|
+
'fetchLiquidations': true,
|
|
128050
128866
|
'fetchMarketLeverageTiers': true,
|
|
128051
128867
|
'fetchMarkets': true,
|
|
128052
128868
|
'fetchMarkOHLCV': true,
|
|
128869
|
+
'fetchMyLiquidations': false,
|
|
128053
128870
|
'fetchMyTrades': true,
|
|
128054
128871
|
'fetchOHLCV': true,
|
|
128055
128872
|
'fetchOpenInterest': true,
|
|
@@ -136202,6 +137019,106 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
136202
137019
|
'datetime': this.iso8601(timestamp),
|
|
136203
137020
|
};
|
|
136204
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
|
+
}
|
|
136205
137122
|
}
|
|
136206
137123
|
|
|
136207
137124
|
|
|
@@ -147817,6 +148734,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147817
148734
|
'id': accountId,
|
|
147818
148735
|
'type': type,
|
|
147819
148736
|
'currency': code,
|
|
148737
|
+
'code': code,
|
|
147820
148738
|
'info': account,
|
|
147821
148739
|
});
|
|
147822
148740
|
}
|
|
@@ -151903,7 +152821,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
151903
152821
|
//
|
|
151904
152822
|
const symbol = this.safeString(position, 'symbol');
|
|
151905
152823
|
market = this.safeMarket(symbol, market);
|
|
151906
|
-
const timestamp = this.
|
|
152824
|
+
const timestamp = this.safeInteger(position, 'currentTimestamp');
|
|
151907
152825
|
const size = this.safeString(position, 'currentQty');
|
|
151908
152826
|
let side = undefined;
|
|
151909
152827
|
if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(size, '0')) {
|
|
@@ -178442,6 +179360,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
178442
179360
|
'type': type,
|
|
178443
179361
|
'currency': undefined,
|
|
178444
179362
|
'info': account,
|
|
179363
|
+
'code': undefined,
|
|
178445
179364
|
});
|
|
178446
179365
|
}
|
|
178447
179366
|
return result;
|
|
@@ -189271,39 +190190,51 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189271
190190
|
'markets/{symbol}': 1,
|
|
189272
190191
|
'currencies': 20,
|
|
189273
190192
|
'currencies/{currency}': 20,
|
|
190193
|
+
'v2/currencies': 20,
|
|
190194
|
+
'v2/currencies/{currency}': 20,
|
|
189274
190195
|
'timestamp': 1,
|
|
189275
190196
|
'markets/price': 1,
|
|
189276
190197
|
'markets/{symbol}/price': 1,
|
|
190198
|
+
'markets/markPrice': 1,
|
|
190199
|
+
'markets/{symbol}/markPrice': 1,
|
|
190200
|
+
'markets/{symbol}/markPriceComponents': 1,
|
|
189277
190201
|
'markets/{symbol}/orderBook': 1,
|
|
189278
190202
|
'markets/{symbol}/candles': 1,
|
|
189279
190203
|
'markets/{symbol}/trades': 20,
|
|
189280
190204
|
'markets/ticker24h': 20,
|
|
189281
190205
|
'markets/{symbol}/ticker24h': 20,
|
|
190206
|
+
'markets/collateralInfo': 1,
|
|
190207
|
+
'markets/{currency}/collateralInfo': 1,
|
|
190208
|
+
'markets/borrowRatesInfo': 1,
|
|
189282
190209
|
},
|
|
189283
190210
|
},
|
|
189284
190211
|
'private': {
|
|
189285
190212
|
'get': {
|
|
189286
190213
|
'accounts': 4,
|
|
189287
|
-
'accounts/activity': 4,
|
|
189288
190214
|
'accounts/balances': 4,
|
|
189289
190215
|
'accounts/{id}/balances': 4,
|
|
190216
|
+
'accounts/activity': 20,
|
|
189290
190217
|
'accounts/transfer': 20,
|
|
189291
190218
|
'accounts/transfer/{id}': 4,
|
|
190219
|
+
'feeinfo': 20,
|
|
190220
|
+
'accounts/interest/history': 1,
|
|
189292
190221
|
'subaccounts': 4,
|
|
189293
190222
|
'subaccounts/balances': 20,
|
|
189294
190223
|
'subaccounts/{id}/balances': 4,
|
|
189295
190224
|
'subaccounts/transfer': 20,
|
|
189296
190225
|
'subaccounts/transfer/{id}': 4,
|
|
189297
|
-
'feeinfo': 20,
|
|
189298
190226
|
'wallets/addresses': 20,
|
|
189299
|
-
'wallets/activity': 20,
|
|
189300
190227
|
'wallets/addresses/{currency}': 20,
|
|
190228
|
+
'wallets/activity': 20,
|
|
190229
|
+
'margin/accountMargin': 4,
|
|
190230
|
+
'margin/borrowStatus': 4,
|
|
190231
|
+
'margin/maxSize': 4,
|
|
189301
190232
|
'orders': 20,
|
|
189302
190233
|
'orders/{id}': 4,
|
|
189303
|
-
'orders/history': 20,
|
|
189304
190234
|
'orders/killSwitchStatus': 4,
|
|
189305
190235
|
'smartorders': 20,
|
|
189306
190236
|
'smartorders/{id}': 4,
|
|
190237
|
+
'orders/history': 20,
|
|
189307
190238
|
'smartorders/history': 20,
|
|
189308
190239
|
'trades': 20,
|
|
189309
190240
|
'orders/{id}/trades': 4,
|
|
@@ -189313,9 +190244,10 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189313
190244
|
'subaccounts/transfer': 20,
|
|
189314
190245
|
'wallets/address': 20,
|
|
189315
190246
|
'wallets/withdraw': 20,
|
|
190247
|
+
'v2/wallets/withdraw': 20,
|
|
189316
190248
|
'orders': 4,
|
|
189317
|
-
'orders/killSwitch': 4,
|
|
189318
190249
|
'orders/batch': 20,
|
|
190250
|
+
'orders/killSwitch': 4,
|
|
189319
190251
|
'smartorders': 4,
|
|
189320
190252
|
},
|
|
189321
190253
|
'delete': {
|
|
@@ -189327,8 +190259,8 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
189327
190259
|
'smartorders': 20,
|
|
189328
190260
|
},
|
|
189329
190261
|
'put': {
|
|
189330
|
-
'orders/{id}':
|
|
189331
|
-
'smartorders/{id}':
|
|
190262
|
+
'orders/{id}': 20,
|
|
190263
|
+
'smartorders/{id}': 20,
|
|
189332
190264
|
},
|
|
189333
190265
|
},
|
|
189334
190266
|
},
|
|
@@ -276613,7 +277545,7 @@ SOFTWARE.
|
|
|
276613
277545
|
|
|
276614
277546
|
//-----------------------------------------------------------------------------
|
|
276615
277547
|
// this is updated by vss.js when building
|
|
276616
|
-
const version = '4.1.
|
|
277548
|
+
const version = '4.1.13';
|
|
276617
277549
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
276618
277550
|
//-----------------------------------------------------------------------------
|
|
276619
277551
|
|