ccxt 4.3.32 → 4.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +26 -0
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/coinbase.js +106 -53
- package/dist/cjs/src/pro/binance.js +352 -0
- package/dist/cjs/src/pro/bitmex.js +108 -0
- package/dist/cjs/src/pro/bybit.js +85 -0
- package/dist/cjs/src/pro/gate.js +183 -0
- package/dist/cjs/src/pro/kucoinfutures.js +4 -0
- package/dist/cjs/src/pro/okx.js +259 -1
- package/dist/cjs/src/whitebit.js +2 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/ace.d.ts +3 -3
- package/js/src/alpaca.d.ts +2 -2
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/base/Exchange.d.ts +13 -3
- package/js/src/base/Exchange.js +26 -0
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bigone.d.ts +3 -3
- package/js/src/binance.d.ts +4 -4
- package/js/src/binance.js +1 -0
- package/js/src/bingx.d.ts +3 -3
- package/js/src/bit2c.d.ts +2 -2
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitbns.d.ts +2 -2
- package/js/src/bitfinex.d.ts +3 -3
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +1 -1
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/bitmart.d.ts +3 -3
- package/js/src/bitmex.d.ts +4 -4
- package/js/src/bitopro.d.ts +4 -4
- package/js/src/bitrue.d.ts +3 -3
- package/js/src/bitso.d.ts +3 -3
- package/js/src/bitstamp.d.ts +3 -3
- package/js/src/bitteam.d.ts +4 -4
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +4 -4
- package/js/src/btcalpha.d.ts +4 -4
- package/js/src/btcbox.d.ts +2 -2
- package/js/src/btcmarkets.d.ts +4 -4
- package/js/src/btcturk.d.ts +2 -2
- package/js/src/bybit.d.ts +3 -3
- package/js/src/cex.d.ts +2 -2
- package/js/src/coinbase.d.ts +3 -3
- package/js/src/coinbase.js +106 -53
- package/js/src/coinbaseexchange.d.ts +2 -2
- package/js/src/coinbaseinternational.d.ts +4 -4
- package/js/src/coincheck.d.ts +3 -3
- package/js/src/coinex.d.ts +3 -3
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +3 -3
- package/js/src/coinmetro.d.ts +3 -3
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +3 -3
- package/js/src/cryptocom.d.ts +2 -2
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +3 -3
- package/js/src/digifinex.d.ts +3 -3
- package/js/src/exmo.d.ts +3 -3
- package/js/src/gate.d.ts +3 -3
- package/js/src/gemini.d.ts +3 -3
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hollaex.d.ts +2 -2
- package/js/src/htx.d.ts +3 -3
- package/js/src/huobijp.d.ts +3 -3
- package/js/src/hyperliquid.d.ts +3 -3
- package/js/src/idex.d.ts +3 -3
- package/js/src/indodax.d.ts +3 -3
- package/js/src/kraken.d.ts +3 -3
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kuna.d.ts +3 -3
- package/js/src/latoken.d.ts +3 -3
- package/js/src/lbank.d.ts +2 -2
- package/js/src/luno.d.ts +2 -2
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mercado.d.ts +2 -2
- package/js/src/mexc.d.ts +2 -2
- package/js/src/ndax.d.ts +3 -3
- package/js/src/novadax.d.ts +4 -4
- package/js/src/oceanex.d.ts +3 -3
- package/js/src/okcoin.d.ts +4 -4
- package/js/src/okx.d.ts +4 -4
- package/js/src/onetrading.d.ts +3 -3
- package/js/src/p2b.d.ts +3 -3
- package/js/src/paymium.d.ts +2 -2
- package/js/src/phemex.d.ts +5 -5
- package/js/src/poloniex.d.ts +4 -4
- package/js/src/poloniexfutures.d.ts +3 -3
- package/js/src/pro/binance.d.ts +9 -2
- package/js/src/pro/binance.js +352 -0
- package/js/src/pro/bitmex.d.ts +4 -1
- package/js/src/pro/bitmex.js +108 -0
- package/js/src/pro/bybit.d.ts +4 -1
- package/js/src/pro/bybit.js +85 -0
- package/js/src/pro/gate.d.ts +5 -1
- package/js/src/pro/gate.js +183 -0
- package/js/src/pro/kucoinfutures.js +4 -0
- package/js/src/pro/okx.d.ts +8 -1
- package/js/src/pro/okx.js +259 -1
- package/js/src/probit.d.ts +4 -4
- package/js/src/timex.d.ts +3 -3
- package/js/src/tokocrypto.d.ts +2 -2
- package/js/src/tradeogre.d.ts +2 -2
- package/js/src/upbit.d.ts +4 -4
- package/js/src/wavesexchange.d.ts +2 -2
- package/js/src/wazirx.d.ts +4 -4
- package/js/src/whitebit.d.ts +4 -4
- package/js/src/whitebit.js +2 -2
- package/js/src/woo.d.ts +4 -4
- package/js/src/woofipro.d.ts +4 -4
- package/js/src/yobit.d.ts +2 -2
- package/js/src/zaif.d.ts +3 -3
- package/js/src/zonda.d.ts +2 -2
- package/package.json +1 -1
package/js/src/pro/binance.js
CHANGED
|
@@ -20,6 +20,10 @@ export default class binance extends binanceRest {
|
|
|
20
20
|
'has': {
|
|
21
21
|
'ws': true,
|
|
22
22
|
'watchBalance': true,
|
|
23
|
+
'watchLiquidations': true,
|
|
24
|
+
'watchLiquidationsForSymbols': true,
|
|
25
|
+
'watchMyLiquidations': true,
|
|
26
|
+
'watchMyLiquidationsForSymbols': true,
|
|
23
27
|
'watchBidsAsks': true,
|
|
24
28
|
'watchMyTrades': true,
|
|
25
29
|
'watchOHLCV': true,
|
|
@@ -104,6 +108,8 @@ export default class binance extends binanceRest {
|
|
|
104
108
|
// get updates every 1000ms or 100ms
|
|
105
109
|
// or every 0ms in real-time for futures
|
|
106
110
|
'watchOrderBookRate': 100,
|
|
111
|
+
'liquidationsLimit': 1000,
|
|
112
|
+
'myLiquidationsLimit': 1000,
|
|
107
113
|
'tradesLimit': 1000,
|
|
108
114
|
'ordersLimit': 1000,
|
|
109
115
|
'OHLCVLimit': 1000,
|
|
@@ -128,6 +134,9 @@ export default class binance extends binanceRest {
|
|
|
128
134
|
'fetchBalanceSnapshot': false,
|
|
129
135
|
'awaitBalanceSnapshot': true, // whether to wait for the balance snapshot before providing updates
|
|
130
136
|
},
|
|
137
|
+
'watchLiquidationsForSymbols': {
|
|
138
|
+
'defaultType': 'swap',
|
|
139
|
+
},
|
|
131
140
|
'watchPositions': {
|
|
132
141
|
'fetchPositionsSnapshot': true,
|
|
133
142
|
'awaitPositionsSnapshot': true, // whether to wait for the positions snapshot before providing updates
|
|
@@ -182,6 +191,347 @@ export default class binance extends binanceRest {
|
|
|
182
191
|
}
|
|
183
192
|
return stream;
|
|
184
193
|
}
|
|
194
|
+
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
195
|
+
/**
|
|
196
|
+
* @method
|
|
197
|
+
* @name binance#watchLiquidations
|
|
198
|
+
* @description watch the public liquidations of a trading pair
|
|
199
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#liquidation-order-streams
|
|
200
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#liquidation-order-streams
|
|
201
|
+
* @param {string} symbol unified CCXT market symbol
|
|
202
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
203
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
204
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
205
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
206
|
+
*/
|
|
207
|
+
return this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
208
|
+
}
|
|
209
|
+
async watchLiquidationsForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
210
|
+
/**
|
|
211
|
+
* @method
|
|
212
|
+
* @name binance#watchLiquidationsForSymbols
|
|
213
|
+
* @description watch the public liquidations of a trading pair
|
|
214
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#all-market-liquidation-order-streams
|
|
215
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-market-liquidation-order-streams
|
|
216
|
+
* @param {string} symbol unified CCXT market symbol
|
|
217
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
218
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
219
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
220
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
221
|
+
*/
|
|
222
|
+
await this.loadMarkets();
|
|
223
|
+
const subscriptionHashes = [];
|
|
224
|
+
const messageHashes = [];
|
|
225
|
+
let streamHash = 'liquidations';
|
|
226
|
+
symbols = this.marketSymbols(symbols, undefined, true, true);
|
|
227
|
+
if (this.isEmpty(symbols)) {
|
|
228
|
+
subscriptionHashes.push('!' + 'forceOrder@arr');
|
|
229
|
+
messageHashes.push('liquidations');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
233
|
+
const market = this.market(symbols[i]);
|
|
234
|
+
subscriptionHashes.push(market['id'] + '@forceOrder');
|
|
235
|
+
messageHashes.push('liquidations::' + symbols[i]);
|
|
236
|
+
}
|
|
237
|
+
streamHash += '::' + symbols.join(',');
|
|
238
|
+
}
|
|
239
|
+
const firstMarket = this.getMarketFromSymbols(symbols);
|
|
240
|
+
let type = undefined;
|
|
241
|
+
[type, params] = this.handleMarketTypeAndParams('watchLiquidationsForSymbols', firstMarket, params);
|
|
242
|
+
if (type === 'spot') {
|
|
243
|
+
throw new BadRequest(this.id + 'watchLiquidationsForSymbols is not supported for swap symbols');
|
|
244
|
+
}
|
|
245
|
+
let subType = undefined;
|
|
246
|
+
[subType, params] = this.handleSubTypeAndParams('watchLiquidationsForSymbols', firstMarket, params);
|
|
247
|
+
if (this.isLinear(type, subType)) {
|
|
248
|
+
type = 'future';
|
|
249
|
+
}
|
|
250
|
+
else if (this.isInverse(type, subType)) {
|
|
251
|
+
type = 'delivery';
|
|
252
|
+
}
|
|
253
|
+
const numSubscriptions = subscriptionHashes.length;
|
|
254
|
+
const url = this.urls['api']['ws'][type] + '/' + this.stream(type, streamHash, numSubscriptions);
|
|
255
|
+
const requestId = this.requestId(url);
|
|
256
|
+
const request = {
|
|
257
|
+
'method': 'SUBSCRIBE',
|
|
258
|
+
'params': subscriptionHashes,
|
|
259
|
+
'id': requestId,
|
|
260
|
+
};
|
|
261
|
+
const subscribe = {
|
|
262
|
+
'id': requestId,
|
|
263
|
+
};
|
|
264
|
+
const newLiquidations = await this.watchMultiple(url, messageHashes, this.extend(request, params), subscriptionHashes, subscribe);
|
|
265
|
+
if (this.newUpdates) {
|
|
266
|
+
return newLiquidations;
|
|
267
|
+
}
|
|
268
|
+
return this.filterBySymbolsSinceLimit(this.liquidations, symbols, since, limit, true);
|
|
269
|
+
}
|
|
270
|
+
handleLiquidation(client, message) {
|
|
271
|
+
//
|
|
272
|
+
// future
|
|
273
|
+
// {
|
|
274
|
+
// "e":"forceOrder",
|
|
275
|
+
// "E":1698871323061,
|
|
276
|
+
// "o":{
|
|
277
|
+
// "s":"BTCUSDT",
|
|
278
|
+
// "S":"BUY",
|
|
279
|
+
// "o":"LIMIT",
|
|
280
|
+
// "f":"IOC",
|
|
281
|
+
// "q":"1.437",
|
|
282
|
+
// "p":"35100.81",
|
|
283
|
+
// "ap":"34959.70",
|
|
284
|
+
// "X":"FILLED",
|
|
285
|
+
// "l":"1.437",
|
|
286
|
+
// "z":"1.437",
|
|
287
|
+
// "T":1698871323059
|
|
288
|
+
// }
|
|
289
|
+
// }
|
|
290
|
+
// delivery
|
|
291
|
+
// {
|
|
292
|
+
// "e":"forceOrder", // Event Type
|
|
293
|
+
// "E": 1591154240950, // Event Time
|
|
294
|
+
// "o":{
|
|
295
|
+
// "s":"BTCUSD_200925", // Symbol
|
|
296
|
+
// "ps": "BTCUSD", // Pair
|
|
297
|
+
// "S":"SELL", // Side
|
|
298
|
+
// "o":"LIMIT", // Order Type
|
|
299
|
+
// "f":"IOC", // Time in Force
|
|
300
|
+
// "q":"1", // Original Quantity
|
|
301
|
+
// "p":"9425.5", // Price
|
|
302
|
+
// "ap":"9496.5", // Average Price
|
|
303
|
+
// "X":"FILLED", // Order Status
|
|
304
|
+
// "l":"1", // Order Last Filled Quantity
|
|
305
|
+
// "z":"1", // Order Filled Accumulated Quantity
|
|
306
|
+
// "T": 1591154240949, // Order Trade Time
|
|
307
|
+
// }
|
|
308
|
+
// }
|
|
309
|
+
//
|
|
310
|
+
const rawLiquidation = this.safeValue(message, 'o', {});
|
|
311
|
+
const marketId = this.safeString(rawLiquidation, 's');
|
|
312
|
+
const market = this.safeMarket(marketId, undefined, '', 'contract');
|
|
313
|
+
const symbol = market['symbol'];
|
|
314
|
+
const liquidation = this.parseWsLiquidation(rawLiquidation, market);
|
|
315
|
+
let liquidations = this.safeValue(this.liquidations, symbol);
|
|
316
|
+
if (liquidations === undefined) {
|
|
317
|
+
const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
|
|
318
|
+
liquidations = new ArrayCache(limit);
|
|
319
|
+
}
|
|
320
|
+
liquidations.append(liquidation);
|
|
321
|
+
this.liquidations[symbol] = liquidations;
|
|
322
|
+
client.resolve([liquidation], 'liquidations');
|
|
323
|
+
client.resolve([liquidation], 'liquidations::' + symbol);
|
|
324
|
+
}
|
|
325
|
+
parseWsLiquidation(liquidation, market = undefined) {
|
|
326
|
+
//
|
|
327
|
+
// future
|
|
328
|
+
// {
|
|
329
|
+
// "s":"BTCUSDT",
|
|
330
|
+
// "S":"BUY",
|
|
331
|
+
// "o":"LIMIT",
|
|
332
|
+
// "f":"IOC",
|
|
333
|
+
// "q":"1.437",
|
|
334
|
+
// "p":"35100.81",
|
|
335
|
+
// "ap":"34959.70",
|
|
336
|
+
// "X":"FILLED",
|
|
337
|
+
// "l":"1.437",
|
|
338
|
+
// "z":"1.437",
|
|
339
|
+
// "T":1698871323059
|
|
340
|
+
// }
|
|
341
|
+
// delivery
|
|
342
|
+
// {
|
|
343
|
+
// "s":"BTCUSD_200925", // Symbol
|
|
344
|
+
// "ps": "BTCUSD", // Pair
|
|
345
|
+
// "S":"SELL", // Side
|
|
346
|
+
// "o":"LIMIT", // Order Type
|
|
347
|
+
// "f":"IOC", // Time in Force
|
|
348
|
+
// "q":"1", // Original Quantity
|
|
349
|
+
// "p":"9425.5", // Price
|
|
350
|
+
// "ap":"9496.5", // Average Price
|
|
351
|
+
// "X":"FILLED", // Order Status
|
|
352
|
+
// "l":"1", // Order Last Filled Quantity
|
|
353
|
+
// "z":"1", // Order Filled Accumulated Quantity
|
|
354
|
+
// "T": 1591154240949, // Order Trade Time
|
|
355
|
+
// }
|
|
356
|
+
// myLiquidation
|
|
357
|
+
// {
|
|
358
|
+
// "s":"BTCUSDT", // Symbol
|
|
359
|
+
// "c":"TEST", // Client Order Id
|
|
360
|
+
// // special client order id:
|
|
361
|
+
// // starts with "autoclose-": liquidation order
|
|
362
|
+
// // "adl_autoclose": ADL auto close order
|
|
363
|
+
// // "settlement_autoclose-": settlement order for delisting or delivery
|
|
364
|
+
// "S":"SELL", // Side
|
|
365
|
+
// "o":"TRAILING_STOP_MARKET", // Order Type
|
|
366
|
+
// "f":"GTC", // Time in Force
|
|
367
|
+
// "q":"0.001", // Original Quantity
|
|
368
|
+
// "p":"0", // Original Price
|
|
369
|
+
// "ap":"0", // Average Price
|
|
370
|
+
// "sp":"7103.04", // Stop Price. Please ignore with TRAILING_STOP_MARKET order
|
|
371
|
+
// "x":"NEW", // Execution Type
|
|
372
|
+
// "X":"NEW", // Order Status
|
|
373
|
+
// "i":8886774, // Order Id
|
|
374
|
+
// "l":"0", // Order Last Filled Quantity
|
|
375
|
+
// "z":"0", // Order Filled Accumulated Quantity
|
|
376
|
+
// "L":"0", // Last Filled Price
|
|
377
|
+
// "N":"USDT", // Commission Asset, will not push if no commission
|
|
378
|
+
// "n":"0", // Commission, will not push if no commission
|
|
379
|
+
// "T":1568879465650, // Order Trade Time
|
|
380
|
+
// "t":0, // Trade Id
|
|
381
|
+
// "b":"0", // Bids Notional
|
|
382
|
+
// "a":"9.91", // Ask Notional
|
|
383
|
+
// "m":false, // Is this trade the maker side?
|
|
384
|
+
// "R":false, // Is this reduce only
|
|
385
|
+
// "wt":"CONTRACT_PRICE", // Stop Price Working Type
|
|
386
|
+
// "ot":"TRAILING_STOP_MARKET",// Original Order Type
|
|
387
|
+
// "ps":"LONG", // Position Side
|
|
388
|
+
// "cp":false, // If Close-All, pushed with conditional order
|
|
389
|
+
// "AP":"7476.89", // Activation Price, only puhed with TRAILING_STOP_MARKET order
|
|
390
|
+
// "cr":"5.0", // Callback Rate, only puhed with TRAILING_STOP_MARKET order
|
|
391
|
+
// "pP": false, // If price protection is turned on
|
|
392
|
+
// "si": 0, // ignore
|
|
393
|
+
// "ss": 0, // ignore
|
|
394
|
+
// "rp":"0", // Realized Profit of the trade
|
|
395
|
+
// "V":"EXPIRE_TAKER", // STP mode
|
|
396
|
+
// "pm":"OPPONENT", // Price match mode
|
|
397
|
+
// "gtd":0 // TIF GTD order auto cancel time
|
|
398
|
+
// }
|
|
399
|
+
//
|
|
400
|
+
const marketId = this.safeString(liquidation, 's');
|
|
401
|
+
market = this.safeMarket(marketId, market);
|
|
402
|
+
const timestamp = this.safeInteger(liquidation, 'T');
|
|
403
|
+
return this.safeLiquidation({
|
|
404
|
+
'info': liquidation,
|
|
405
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
406
|
+
'contracts': this.safeNumber(liquidation, 'l'),
|
|
407
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
408
|
+
'price': this.safeNumber(liquidation, 'ap'),
|
|
409
|
+
'baseValue': undefined,
|
|
410
|
+
'quoteValue': undefined,
|
|
411
|
+
'timestamp': timestamp,
|
|
412
|
+
'datetime': this.iso8601(timestamp),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
async watchMyLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
416
|
+
/**
|
|
417
|
+
* @method
|
|
418
|
+
* @name binance#watchMyLiquidations
|
|
419
|
+
* @description watch the private liquidations of a trading pair
|
|
420
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#event-order-update
|
|
421
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#event-order-update
|
|
422
|
+
* @param {string} symbol unified CCXT market symbol
|
|
423
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
424
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
425
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
426
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
427
|
+
*/
|
|
428
|
+
return this.watchMyLiquidationsForSymbols([symbol], since, limit, params);
|
|
429
|
+
}
|
|
430
|
+
async watchMyLiquidationsForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
431
|
+
/**
|
|
432
|
+
* @method
|
|
433
|
+
* @name binance#watchMyLiquidationsForSymbols
|
|
434
|
+
* @description watch the private liquidations of a trading pair
|
|
435
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#event-order-update
|
|
436
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#event-order-update
|
|
437
|
+
* @param {string} symbol unified CCXT market symbol
|
|
438
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
439
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
440
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
441
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
442
|
+
*/
|
|
443
|
+
await this.loadMarkets();
|
|
444
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
445
|
+
const market = this.getMarketFromSymbols(symbols);
|
|
446
|
+
const messageHashes = ['myLiquidations'];
|
|
447
|
+
if (!this.isEmpty(symbols)) {
|
|
448
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
449
|
+
const symbol = symbols[i];
|
|
450
|
+
messageHashes.push('myLiquidations::' + symbol);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
let type = undefined;
|
|
454
|
+
[type, params] = this.handleMarketTypeAndParams('watchMyLiquidationsForSymbols', market, params);
|
|
455
|
+
let subType = undefined;
|
|
456
|
+
[subType, params] = this.handleSubTypeAndParams('watchMyLiquidationsForSymbols', market, params);
|
|
457
|
+
if (this.isLinear(type, subType)) {
|
|
458
|
+
type = 'future';
|
|
459
|
+
}
|
|
460
|
+
else if (this.isInverse(type, subType)) {
|
|
461
|
+
type = 'delivery';
|
|
462
|
+
}
|
|
463
|
+
await this.authenticate(params);
|
|
464
|
+
const url = this.urls['api']['ws'][type] + '/' + this.options[type]['listenKey'];
|
|
465
|
+
const message = undefined;
|
|
466
|
+
const newLiquidations = await this.watchMultiple(url, messageHashes, message, [type]);
|
|
467
|
+
if (this.newUpdates) {
|
|
468
|
+
return newLiquidations;
|
|
469
|
+
}
|
|
470
|
+
return this.filterBySymbolsSinceLimit(this.liquidations, symbols, since, limit);
|
|
471
|
+
}
|
|
472
|
+
handleMyLiquidation(client, message) {
|
|
473
|
+
//
|
|
474
|
+
// {
|
|
475
|
+
// "s":"BTCUSDT", // Symbol
|
|
476
|
+
// "c":"TEST", // Client Order Id
|
|
477
|
+
// // special client order id:
|
|
478
|
+
// // starts with "autoclose-": liquidation order
|
|
479
|
+
// // "adl_autoclose": ADL auto close order
|
|
480
|
+
// // "settlement_autoclose-": settlement order for delisting or delivery
|
|
481
|
+
// "S":"SELL", // Side
|
|
482
|
+
// "o":"TRAILING_STOP_MARKET", // Order Type
|
|
483
|
+
// "f":"GTC", // Time in Force
|
|
484
|
+
// "q":"0.001", // Original Quantity
|
|
485
|
+
// "p":"0", // Original Price
|
|
486
|
+
// "ap":"0", // Average Price
|
|
487
|
+
// "sp":"7103.04", // Stop Price. Please ignore with TRAILING_STOP_MARKET order
|
|
488
|
+
// "x":"NEW", // Execution Type
|
|
489
|
+
// "X":"NEW", // Order Status
|
|
490
|
+
// "i":8886774, // Order Id
|
|
491
|
+
// "l":"0", // Order Last Filled Quantity
|
|
492
|
+
// "z":"0", // Order Filled Accumulated Quantity
|
|
493
|
+
// "L":"0", // Last Filled Price
|
|
494
|
+
// "N":"USDT", // Commission Asset, will not push if no commission
|
|
495
|
+
// "n":"0", // Commission, will not push if no commission
|
|
496
|
+
// "T":1568879465650, // Order Trade Time
|
|
497
|
+
// "t":0, // Trade Id
|
|
498
|
+
// "b":"0", // Bids Notional
|
|
499
|
+
// "a":"9.91", // Ask Notional
|
|
500
|
+
// "m":false, // Is this trade the maker side?
|
|
501
|
+
// "R":false, // Is this reduce only
|
|
502
|
+
// "wt":"CONTRACT_PRICE", // Stop Price Working Type
|
|
503
|
+
// "ot":"TRAILING_STOP_MARKET",// Original Order Type
|
|
504
|
+
// "ps":"LONG", // Position Side
|
|
505
|
+
// "cp":false, // If Close-All, pushed with conditional order
|
|
506
|
+
// "AP":"7476.89", // Activation Price, only puhed with TRAILING_STOP_MARKET order
|
|
507
|
+
// "cr":"5.0", // Callback Rate, only puhed with TRAILING_STOP_MARKET order
|
|
508
|
+
// "pP": false, // If price protection is turned on
|
|
509
|
+
// "si": 0, // ignore
|
|
510
|
+
// "ss": 0, // ignore
|
|
511
|
+
// "rp":"0", // Realized Profit of the trade
|
|
512
|
+
// "V":"EXPIRE_TAKER", // STP mode
|
|
513
|
+
// "pm":"OPPONENT", // Price match mode
|
|
514
|
+
// "gtd":0 // TIF GTD order auto cancel time
|
|
515
|
+
// }
|
|
516
|
+
//
|
|
517
|
+
const orderType = this.safeString(message, 'o');
|
|
518
|
+
if (orderType !== 'LIQUIDATION') {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const marketId = this.safeString(message, 's');
|
|
522
|
+
const market = this.safeMarket(marketId);
|
|
523
|
+
const symbol = this.safeSymbol(marketId);
|
|
524
|
+
const liquidation = this.parseWsLiquidation(message, market);
|
|
525
|
+
let myLiquidations = this.safeValue(this.myLiquidations, symbol);
|
|
526
|
+
if (myLiquidations === undefined) {
|
|
527
|
+
const limit = this.safeInteger(this.options, 'myLiquidationsLimit', 1000);
|
|
528
|
+
myLiquidations = new ArrayCache(limit);
|
|
529
|
+
}
|
|
530
|
+
myLiquidations.append(liquidation);
|
|
531
|
+
this.myLiquidations[symbol] = myLiquidations;
|
|
532
|
+
client.resolve([liquidation], 'myLiquidations');
|
|
533
|
+
client.resolve([liquidation], 'myLiquidations::' + symbol);
|
|
534
|
+
}
|
|
185
535
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
186
536
|
/**
|
|
187
537
|
* @method
|
|
@@ -2821,6 +3171,7 @@ export default class binance extends binanceRest {
|
|
|
2821
3171
|
}
|
|
2822
3172
|
this.handleMyTrade(client, message);
|
|
2823
3173
|
this.handleOrder(client, message);
|
|
3174
|
+
this.handleMyLiquidation(client, message);
|
|
2824
3175
|
}
|
|
2825
3176
|
async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2826
3177
|
/**
|
|
@@ -3439,6 +3790,7 @@ export default class binance extends binanceRest {
|
|
|
3439
3790
|
'ACCOUNT_UPDATE': this.handleAcountUpdate,
|
|
3440
3791
|
'executionReport': this.handleOrderUpdate,
|
|
3441
3792
|
'ORDER_TRADE_UPDATE': this.handleOrderUpdate,
|
|
3793
|
+
'forceOrder': this.handleLiquidation,
|
|
3442
3794
|
};
|
|
3443
3795
|
let event = this.safeString(message, 'e');
|
|
3444
3796
|
if (Array.isArray(message)) {
|
package/js/src/pro/bitmex.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import bitmexRest from '../bitmex.js';
|
|
2
|
-
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances } from '../base/types.js';
|
|
2
|
+
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances, Liquidation } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class bitmex extends bitmexRest {
|
|
5
5
|
describe(): any;
|
|
6
6
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
7
7
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
8
8
|
handleTicker(client: Client, message: any): any;
|
|
9
|
+
watchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
10
|
+
watchLiquidationsForSymbols(symbols?: string[], since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
11
|
+
handleLiquidation(client: Client, message: any): void;
|
|
9
12
|
watchBalance(params?: {}): Promise<Balances>;
|
|
10
13
|
handleBalance(client: Client, message: any): void;
|
|
11
14
|
handleTrades(client: Client, message: any): void;
|
package/js/src/pro/bitmex.js
CHANGED
|
@@ -16,6 +16,10 @@ export default class bitmex extends bitmexRest {
|
|
|
16
16
|
'has': {
|
|
17
17
|
'ws': true,
|
|
18
18
|
'watchBalance': true,
|
|
19
|
+
'watchLiquidations': true,
|
|
20
|
+
'watchLiquidationsForSymbols': true,
|
|
21
|
+
'watchMyLiquidations': undefined,
|
|
22
|
+
'watchMyLiquidationsForSymbols': undefined,
|
|
19
23
|
'watchMyTrades': true,
|
|
20
24
|
'watchOHLCV': true,
|
|
21
25
|
'watchOrderBook': true,
|
|
@@ -354,6 +358,109 @@ export default class bitmex extends bitmexRest {
|
|
|
354
358
|
}
|
|
355
359
|
return message;
|
|
356
360
|
}
|
|
361
|
+
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
362
|
+
/**
|
|
363
|
+
* @method
|
|
364
|
+
* @name bitmex#watchLiquidations
|
|
365
|
+
* @description watch the public liquidations of a trading pair
|
|
366
|
+
* @see https://www.bitmex.com/app/wsAPI#Liquidation
|
|
367
|
+
* @param {string} symbol unified CCXT market symbol
|
|
368
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
369
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
370
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
371
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
372
|
+
*/
|
|
373
|
+
return this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
374
|
+
}
|
|
375
|
+
async watchLiquidationsForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
376
|
+
/**
|
|
377
|
+
* @method
|
|
378
|
+
* @name bitmex#watchLiquidationsForSymbols
|
|
379
|
+
* @description watch the public liquidations of a trading pair
|
|
380
|
+
* @see https://www.bitmex.com/app/wsAPI#Liquidation
|
|
381
|
+
* @param {string} symbol unified CCXT market symbol
|
|
382
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
383
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
384
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
385
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
386
|
+
*/
|
|
387
|
+
await this.loadMarkets();
|
|
388
|
+
symbols = this.marketSymbols(symbols, undefined, true, true);
|
|
389
|
+
const messageHashes = [];
|
|
390
|
+
const subscriptionHashes = [];
|
|
391
|
+
if (this.isEmpty(symbols)) {
|
|
392
|
+
subscriptionHashes.push('liquidation');
|
|
393
|
+
messageHashes.push('liquidations');
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
397
|
+
const symbol = symbols[i];
|
|
398
|
+
const market = this.market(symbol);
|
|
399
|
+
subscriptionHashes.push('liquidation:' + market['id']);
|
|
400
|
+
messageHashes.push('liquidations::' + symbol);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const url = this.urls['api']['ws'];
|
|
404
|
+
const request = {
|
|
405
|
+
'op': 'subscribe',
|
|
406
|
+
'args': subscriptionHashes,
|
|
407
|
+
};
|
|
408
|
+
const newLiquidations = await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), subscriptionHashes);
|
|
409
|
+
if (this.newUpdates) {
|
|
410
|
+
return newLiquidations;
|
|
411
|
+
}
|
|
412
|
+
return this.filterBySymbolsSinceLimit(this.liquidations, symbols, since, limit, true);
|
|
413
|
+
}
|
|
414
|
+
handleLiquidation(client, message) {
|
|
415
|
+
//
|
|
416
|
+
// {
|
|
417
|
+
// "table":"liquidation",
|
|
418
|
+
// "action":"partial",
|
|
419
|
+
// "keys":[
|
|
420
|
+
// "orderID"
|
|
421
|
+
// ],
|
|
422
|
+
// "types":{
|
|
423
|
+
// "orderID":"guid",
|
|
424
|
+
// "symbol":"symbol",
|
|
425
|
+
// "side":"symbol",
|
|
426
|
+
// "price":"float",
|
|
427
|
+
// "leavesQty":"long"
|
|
428
|
+
// },
|
|
429
|
+
// "filter":{},
|
|
430
|
+
// "data":[
|
|
431
|
+
// {
|
|
432
|
+
// "orderID":"e0a568ee-7830-4428-92c3-73e82b9576ce",
|
|
433
|
+
// "symbol":"XPLAUSDT",
|
|
434
|
+
// "side":"Sell",
|
|
435
|
+
// "price":0.206,
|
|
436
|
+
// "leavesQty":340
|
|
437
|
+
// }
|
|
438
|
+
// ]
|
|
439
|
+
// }
|
|
440
|
+
//
|
|
441
|
+
const rawLiquidations = this.safeValue(message, 'data', []);
|
|
442
|
+
const newLiquidations = [];
|
|
443
|
+
for (let i = 0; i < rawLiquidations.length; i++) {
|
|
444
|
+
const rawLiquidation = rawLiquidations[i];
|
|
445
|
+
const liquidation = this.parseLiquidation(rawLiquidation);
|
|
446
|
+
const symbol = liquidation['symbol'];
|
|
447
|
+
let liquidations = this.safeValue(this.liquidations, symbol);
|
|
448
|
+
if (liquidations === undefined) {
|
|
449
|
+
const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
|
|
450
|
+
liquidations = new ArrayCache(limit);
|
|
451
|
+
}
|
|
452
|
+
liquidations.append(liquidation);
|
|
453
|
+
this.liquidations[symbol] = liquidations;
|
|
454
|
+
newLiquidations.push(liquidation);
|
|
455
|
+
}
|
|
456
|
+
client.resolve(newLiquidations, 'liquidations');
|
|
457
|
+
const liquidationsBySymbol = this.indexBy(newLiquidations, 'symbol');
|
|
458
|
+
const symbols = Object.keys(liquidationsBySymbol);
|
|
459
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
460
|
+
const symbol = symbols[i];
|
|
461
|
+
client.resolve(liquidationsBySymbol[symbol], 'liquidations::' + symbol);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
357
464
|
async watchBalance(params = {}) {
|
|
358
465
|
/**
|
|
359
466
|
* @method
|
|
@@ -1613,6 +1720,7 @@ export default class bitmex extends bitmexRest {
|
|
|
1613
1720
|
'order': this.handleOrders,
|
|
1614
1721
|
'execution': this.handleMyTrades,
|
|
1615
1722
|
'margin': this.handleBalance,
|
|
1723
|
+
'liquidation': this.handleLiquidation,
|
|
1616
1724
|
'position': this.handlePositions,
|
|
1617
1725
|
};
|
|
1618
1726
|
const method = this.safeValue(methods, table);
|
package/js/src/pro/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import bybitRest from '../bybit.js';
|
|
2
|
-
import type { Int, OHLCV, Str, Strings, Ticker, OrderBook, Order, Trade, Tickers, Position, Balances, OrderType, OrderSide, Num } from '../base/types.js';
|
|
2
|
+
import type { Int, OHLCV, Str, Strings, Ticker, OrderBook, Order, Trade, Tickers, Position, Balances, OrderType, OrderSide, Num, Liquidation } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class bybit extends bybitRest {
|
|
5
5
|
describe(): any;
|
|
@@ -31,6 +31,9 @@ export default class bybit extends bybitRest {
|
|
|
31
31
|
setPositionsCache(client: Client, symbols?: Strings): void;
|
|
32
32
|
loadPositionsSnapshot(client: any, messageHash: any): Promise<void>;
|
|
33
33
|
handlePositions(client: any, message: any): void;
|
|
34
|
+
watchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
35
|
+
handleLiquidation(client: Client, message: any): void;
|
|
36
|
+
parseWsLiquidation(liquidation: any, market?: any): Liquidation;
|
|
34
37
|
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
35
38
|
handleOrderWs(client: Client, message: any): void;
|
|
36
39
|
handleOrder(client: Client, message: any): void;
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -25,6 +25,10 @@ export default class bybit extends bybitRest {
|
|
|
25
25
|
'fetchTradesWs': false,
|
|
26
26
|
'fetchBalanceWs': false,
|
|
27
27
|
'watchBalance': true,
|
|
28
|
+
'watchLiquidations': true,
|
|
29
|
+
'watchLiquidationsForSymbols': false,
|
|
30
|
+
'watchMyLiquidations': false,
|
|
31
|
+
'watchMyLiquidationsForSymbols': false,
|
|
28
32
|
'watchMyTrades': true,
|
|
29
33
|
'watchOHLCV': true,
|
|
30
34
|
'watchOHLCVForSymbols': false,
|
|
@@ -1202,6 +1206,86 @@ export default class bybit extends bybitRest {
|
|
|
1202
1206
|
}
|
|
1203
1207
|
client.resolve(newPositions, 'positions');
|
|
1204
1208
|
}
|
|
1209
|
+
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1210
|
+
/**
|
|
1211
|
+
* @method
|
|
1212
|
+
* @name bybit#watchLiquidations
|
|
1213
|
+
* @description watch the public liquidations of a trading pair
|
|
1214
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/liquidation
|
|
1215
|
+
* @param {string} symbol unified CCXT market symbol
|
|
1216
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
1217
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
1218
|
+
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
1219
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
1220
|
+
*/
|
|
1221
|
+
await this.loadMarkets();
|
|
1222
|
+
const market = this.market(symbol);
|
|
1223
|
+
symbol = market['symbol'];
|
|
1224
|
+
const url = this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
|
|
1225
|
+
params = this.cleanParams(params);
|
|
1226
|
+
const messageHash = 'liquidations::' + symbol;
|
|
1227
|
+
const topic = 'liquidation.' + market['id'];
|
|
1228
|
+
const newLiquidation = await this.watchTopics(url, [messageHash], [topic], params);
|
|
1229
|
+
if (this.newUpdates) {
|
|
1230
|
+
return [newLiquidation];
|
|
1231
|
+
}
|
|
1232
|
+
return this.filterBySymbolsSinceLimit(this.liquidations, [symbol], since, limit, true);
|
|
1233
|
+
}
|
|
1234
|
+
handleLiquidation(client, message) {
|
|
1235
|
+
//
|
|
1236
|
+
// {
|
|
1237
|
+
// "data": {
|
|
1238
|
+
// "price": "0.03803",
|
|
1239
|
+
// "side": "Buy",
|
|
1240
|
+
// "size": "1637",
|
|
1241
|
+
// "symbol": "GALAUSDT",
|
|
1242
|
+
// "updatedTime": 1673251091822
|
|
1243
|
+
// },
|
|
1244
|
+
// "topic": "liquidation.GALAUSDT",
|
|
1245
|
+
// "ts": 1673251091822,
|
|
1246
|
+
// "type": "snapshot"
|
|
1247
|
+
// }
|
|
1248
|
+
//
|
|
1249
|
+
const rawLiquidation = this.safeDict(message, 'data', {});
|
|
1250
|
+
const marketId = this.safeString(rawLiquidation, 'symbol');
|
|
1251
|
+
const market = this.safeMarket(marketId, undefined, '', 'contract');
|
|
1252
|
+
const symbol = this.safeSymbol(marketId);
|
|
1253
|
+
const liquidation = this.parseWsLiquidation(rawLiquidation, market);
|
|
1254
|
+
let liquidations = this.safeValue(this.liquidations, symbol);
|
|
1255
|
+
if (liquidations === undefined) {
|
|
1256
|
+
const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
|
|
1257
|
+
liquidations = new ArrayCache(limit);
|
|
1258
|
+
}
|
|
1259
|
+
liquidations.append(liquidation);
|
|
1260
|
+
this.liquidations[symbol] = liquidations;
|
|
1261
|
+
client.resolve([liquidation], 'liquidations');
|
|
1262
|
+
client.resolve([liquidation], 'liquidations::' + symbol);
|
|
1263
|
+
}
|
|
1264
|
+
parseWsLiquidation(liquidation, market = undefined) {
|
|
1265
|
+
//
|
|
1266
|
+
// {
|
|
1267
|
+
// "price": "0.03803",
|
|
1268
|
+
// "side": "Buy",
|
|
1269
|
+
// "size": "1637",
|
|
1270
|
+
// "symbol": "GALAUSDT",
|
|
1271
|
+
// "updatedTime": 1673251091822
|
|
1272
|
+
// }
|
|
1273
|
+
//
|
|
1274
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
1275
|
+
market = this.safeMarket(marketId, market, '', 'contract');
|
|
1276
|
+
const timestamp = this.safeInteger(liquidation, 'updatedTime');
|
|
1277
|
+
return this.safeLiquidation({
|
|
1278
|
+
'info': liquidation,
|
|
1279
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
1280
|
+
'contracts': this.safeNumber(liquidation, 'size'),
|
|
1281
|
+
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
1282
|
+
'price': this.safeNumber(liquidation, 'price'),
|
|
1283
|
+
'baseValue': undefined,
|
|
1284
|
+
'quoteValue': undefined,
|
|
1285
|
+
'timestamp': timestamp,
|
|
1286
|
+
'datetime': this.iso8601(timestamp),
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1205
1289
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1206
1290
|
/**
|
|
1207
1291
|
* @method
|
|
@@ -1962,6 +2046,7 @@ export default class bybit extends bybitRest {
|
|
|
1962
2046
|
'ticketInfo': this.handleMyTrades,
|
|
1963
2047
|
'user.openapi.perp.trade': this.handleMyTrades,
|
|
1964
2048
|
'position': this.handlePositions,
|
|
2049
|
+
'liquidation': this.handleLiquidation,
|
|
1965
2050
|
'pong': this.handlePong,
|
|
1966
2051
|
'order.create': this.handleOrderWs,
|
|
1967
2052
|
'order.amend': this.handleOrderWs,
|