ccxt 4.2.29 → 4.2.31
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 +5 -6
- package/dist/ccxt.browser.js +2196 -601
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/ascendex.js +5 -5
- package/dist/cjs/src/base/Exchange.js +33 -25
- package/dist/cjs/src/base/errors.js +3 -3
- package/dist/cjs/src/base/functions/type.js +12 -0
- package/dist/cjs/src/bigone.js +2 -2
- package/dist/cjs/src/binance.js +897 -218
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitfinex2.js +457 -93
- package/dist/cjs/src/bitforex.js +3 -0
- package/dist/cjs/src/bitget.js +8 -4
- package/dist/cjs/src/bitmart.js +3 -3
- package/dist/cjs/src/bitmex.js +4 -4
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitteam.js +2 -2
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/bybit.js +3 -3
- package/dist/cjs/src/coinbase.js +22 -5
- package/dist/cjs/src/coincheck.js +1 -1
- package/dist/cjs/src/coinex.js +2 -2
- package/dist/cjs/src/coinlist.js +1 -1
- package/dist/cjs/src/coinmate.js +1 -1
- package/dist/cjs/src/coinmetro.js +2 -2
- package/dist/cjs/src/coinsph.js +1 -1
- package/dist/cjs/src/cryptocom.js +3 -3
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +6 -4
- package/dist/cjs/src/exmo.js +2 -2
- package/dist/cjs/src/gate.js +5 -5
- package/dist/cjs/src/gemini.js +3 -3
- package/dist/cjs/src/hitbtc.js +14 -20
- package/dist/cjs/src/hollaex.js +2 -2
- package/dist/cjs/src/htx.js +6 -6
- package/dist/cjs/src/huobijp.js +1 -1
- package/dist/cjs/src/kraken.js +3 -1
- package/dist/cjs/src/krakenfutures.js +4 -1
- package/dist/cjs/src/kucoin.js +17 -17
- package/dist/cjs/src/kucoinfutures.js +3 -3
- package/dist/cjs/src/lbank.js +28 -27
- package/dist/cjs/src/mexc.js +7 -7
- package/dist/cjs/src/novadax.js +1 -1
- package/dist/cjs/src/okcoin.js +2 -2
- package/dist/cjs/src/okx.js +23 -8
- package/dist/cjs/src/p2b.js +1 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/poloniexfutures.js +6 -3
- package/dist/cjs/src/pro/alpaca.js +1 -1
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bitmex.js +49 -6
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/bybit.js +2 -2
- package/dist/cjs/src/pro/cex.js +2 -2
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/onetrading.js +2 -2
- package/dist/cjs/src/pro/p2b.js +432 -0
- package/dist/cjs/src/pro/probit.js +5 -5
- package/dist/cjs/src/pro/whitebit.js +1 -1
- package/dist/cjs/src/probit.js +1 -1
- package/dist/cjs/src/timex.js +2 -2
- package/dist/cjs/src/tokocrypto.js +3 -3
- package/dist/cjs/src/wavesexchange.js +2 -2
- package/dist/cjs/src/whitebit.js +3 -3
- package/dist/cjs/src/woo.js +3 -3
- package/dist/cjs/src/yobit.js +1 -1
- package/dist/cjs/src/zaif.js +1 -1
- package/dist/cjs/src/zonda.js +3 -3
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/bybit.d.ts +2 -2
- package/js/src/abstract/coinbase.d.ts +10 -0
- package/js/src/abstract/okx.d.ts +12 -1
- package/js/src/ascendex.js +5 -5
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +33 -25
- package/js/src/base/errorHierarchy.d.ts +7 -6
- package/js/src/base/errorHierarchy.js +7 -6
- package/js/src/base/errors.d.ts +3 -3
- package/js/src/base/errors.js +3 -3
- package/js/src/base/functions/type.js +12 -0
- package/js/src/bigone.js +2 -2
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +898 -219
- package/js/src/bingx.js +1 -1
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitfinex2.d.ts +6 -1
- package/js/src/bitfinex2.js +457 -93
- package/js/src/bitforex.js +3 -0
- package/js/src/bitget.js +8 -4
- package/js/src/bitmart.js +3 -3
- package/js/src/bitmex.js +4 -4
- package/js/src/bitrue.js +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitteam.js +2 -2
- package/js/src/btcalpha.js +1 -1
- package/js/src/bybit.js +3 -3
- package/js/src/coinbase.js +22 -5
- package/js/src/coincheck.js +1 -1
- package/js/src/coinex.js +2 -2
- package/js/src/coinlist.js +1 -1
- package/js/src/coinmate.js +1 -1
- package/js/src/coinmetro.d.ts +1 -1
- package/js/src/coinmetro.js +2 -2
- package/js/src/coinsph.js +1 -1
- package/js/src/cryptocom.js +3 -3
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.js +6 -4
- package/js/src/exmo.js +2 -2
- package/js/src/gate.js +5 -5
- package/js/src/gemini.d.ts +1 -1
- package/js/src/gemini.js +3 -3
- package/js/src/hitbtc.js +14 -20
- package/js/src/hollaex.js +2 -2
- package/js/src/htx.js +6 -6
- package/js/src/huobijp.js +1 -1
- package/js/src/kraken.js +3 -1
- package/js/src/krakenfutures.js +4 -1
- package/js/src/kucoin.js +17 -17
- package/js/src/kucoinfutures.js +3 -3
- package/js/src/lbank.d.ts +1 -1
- package/js/src/lbank.js +28 -27
- package/js/src/mexc.js +7 -7
- package/js/src/novadax.js +1 -1
- package/js/src/okcoin.js +2 -2
- package/js/src/okx.js +23 -8
- package/js/src/p2b.js +1 -0
- package/js/src/phemex.js +3 -3
- package/js/src/poloniexfutures.js +6 -3
- package/js/src/pro/alpaca.js +1 -1
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bitmex.d.ts +2 -1
- package/js/src/pro/bitmex.js +49 -6
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/bybit.js +2 -2
- package/js/src/pro/cex.js +2 -2
- package/js/src/pro/independentreserve.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/onetrading.js +2 -2
- package/js/src/pro/p2b.d.ts +23 -0
- package/js/src/pro/p2b.js +433 -0
- package/js/src/pro/probit.js +5 -5
- package/js/src/pro/whitebit.js +1 -1
- package/js/src/probit.js +1 -1
- package/js/src/timex.js +2 -2
- package/js/src/tokocrypto.js +3 -3
- package/js/src/wavesexchange.js +2 -2
- package/js/src/whitebit.js +3 -3
- package/js/src/woo.js +3 -3
- package/js/src/yobit.js +1 -1
- package/js/src/zaif.js +1 -1
- package/js/src/zonda.d.ts +1 -1
- package/js/src/zonda.js +3 -3
- package/package.json +1 -1
- package/skip-tests.json +3 -10
package/dist/cjs/src/okx.js
CHANGED
|
@@ -341,9 +341,11 @@ class okx extends okx$1 {
|
|
|
341
341
|
'tradingBot/grid/sub-orders': 1,
|
|
342
342
|
'tradingBot/grid/positions': 1,
|
|
343
343
|
'tradingBot/grid/ai-param': 1,
|
|
344
|
-
'tradingBot/
|
|
344
|
+
'tradingBot/signal/signals': 1,
|
|
345
345
|
'tradingBot/signal/orders-algo-details': 1,
|
|
346
|
+
'tradingBot/signal/orders-algo-history': 1,
|
|
346
347
|
'tradingBot/signal/positions': 1,
|
|
348
|
+
'tradingBot/signal/positions-history': 1,
|
|
347
349
|
'tradingBot/signal/sub-orders': 1,
|
|
348
350
|
'tradingBot/signal/event-history': 1,
|
|
349
351
|
'tradingBot/recurring/orders-algo-pending': 1,
|
|
@@ -463,6 +465,15 @@ class okx extends okx$1 {
|
|
|
463
465
|
'tradingBot/grid/compute-margin-balance': 1,
|
|
464
466
|
'tradingBot/grid/margin-balance': 1,
|
|
465
467
|
'tradingBot/grid/min-investment': 1,
|
|
468
|
+
'tradingBot/signal/create-signal': 1,
|
|
469
|
+
'tradingBot/signal/order-algo': 1,
|
|
470
|
+
'tradingBot/signal/stop-order-algo': 1,
|
|
471
|
+
'tradingBot/signal/margin-balance': 1,
|
|
472
|
+
'tradingBot/signal/amendTPSL': 1,
|
|
473
|
+
'tradingBot/signal/set-instruments': 1,
|
|
474
|
+
'tradingBot/signal/close-position': 1,
|
|
475
|
+
'tradingBot/signal/sub-order': 1,
|
|
476
|
+
'tradingBot/signal/cancel-sub-order': 1,
|
|
466
477
|
'tradingBot/recurring/order-algo': 1,
|
|
467
478
|
'tradingBot/recurring/amend-order-algo': 1,
|
|
468
479
|
'tradingBot/recurring/stop-order-algo': 1,
|
|
@@ -2138,7 +2149,8 @@ class okx extends okx$1 {
|
|
|
2138
2149
|
if (since < historyBorder) {
|
|
2139
2150
|
defaultType = 'HistoryCandles';
|
|
2140
2151
|
}
|
|
2141
|
-
|
|
2152
|
+
const startTime = Math.max(since - 1, 0);
|
|
2153
|
+
request['before'] = startTime;
|
|
2142
2154
|
request['after'] = this.sum(since, durationInMilliseconds * limit);
|
|
2143
2155
|
}
|
|
2144
2156
|
const until = this.safeInteger(params, 'until');
|
|
@@ -3103,7 +3115,7 @@ class okx extends okx$1 {
|
|
|
3103
3115
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
3104
3116
|
}
|
|
3105
3117
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3106
|
-
const trailing = this.
|
|
3118
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
3107
3119
|
if (stop || trailing) {
|
|
3108
3120
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
3109
3121
|
return this.safeValue(orderInner, 0);
|
|
@@ -3171,7 +3183,7 @@ class okx extends okx$1 {
|
|
|
3171
3183
|
const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
|
|
3172
3184
|
const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
|
|
3173
3185
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3174
|
-
const trailing = this.
|
|
3186
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
3175
3187
|
if (stop || trailing) {
|
|
3176
3188
|
method = 'privatePostTradeCancelAlgos';
|
|
3177
3189
|
}
|
|
@@ -3670,7 +3682,7 @@ class okx extends okx$1 {
|
|
|
3670
3682
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3671
3683
|
const ordType = this.safeString(params, 'ordType');
|
|
3672
3684
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3673
|
-
const trailing = this.
|
|
3685
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
3674
3686
|
if (trailing || stop || (ordType in algoOrderTypes)) {
|
|
3675
3687
|
method = 'privateGetTradeOrdersAlgoPending';
|
|
3676
3688
|
}
|
|
@@ -3839,7 +3851,7 @@ class okx extends okx$1 {
|
|
|
3839
3851
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3840
3852
|
const ordType = this.safeString(params, 'ordType');
|
|
3841
3853
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3842
|
-
const trailing = this.
|
|
3854
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
3843
3855
|
if (trailing) {
|
|
3844
3856
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3845
3857
|
request['ordType'] = 'move_order_stop';
|
|
@@ -4033,7 +4045,7 @@ class okx extends okx$1 {
|
|
|
4033
4045
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
4034
4046
|
const ordType = this.safeString(params, 'ordType');
|
|
4035
4047
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
4036
|
-
const trailing = this.
|
|
4048
|
+
const trailing = this.safeBool(params, 'trailing', false);
|
|
4037
4049
|
if (trailing || stop || (ordType in algoOrderTypes)) {
|
|
4038
4050
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
4039
4051
|
request['state'] = 'effective';
|
|
@@ -4202,10 +4214,13 @@ class okx extends okx$1 {
|
|
|
4202
4214
|
market = this.market(symbol);
|
|
4203
4215
|
request['instId'] = market['id'];
|
|
4204
4216
|
}
|
|
4217
|
+
if (since !== undefined) {
|
|
4218
|
+
request['begin'] = since;
|
|
4219
|
+
}
|
|
4205
4220
|
[request, params] = this.handleUntilOption('end', request, params);
|
|
4206
4221
|
const [type, query] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
4207
4222
|
request['instType'] = this.convertToInstrumentType(type);
|
|
4208
|
-
if (limit !== undefined) {
|
|
4223
|
+
if ((limit !== undefined) && (since === undefined)) { // let limit = n, okx will return the n most recent results, instead of the n results after limit, so limit should only be sent when since is undefined
|
|
4209
4224
|
request['limit'] = limit; // default 100, max 100
|
|
4210
4225
|
}
|
|
4211
4226
|
const response = await this.privateGetTradeFillsHistory(this.extend(request, query));
|
package/dist/cjs/src/p2b.js
CHANGED
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -2417,7 +2417,7 @@ class phemex extends phemex$1 {
|
|
|
2417
2417
|
});
|
|
2418
2418
|
}
|
|
2419
2419
|
parseOrder(order, market = undefined) {
|
|
2420
|
-
const isSwap = this.
|
|
2420
|
+
const isSwap = this.safeBool(market, 'swap', false);
|
|
2421
2421
|
const hasPnl = ('closedPnl' in order);
|
|
2422
2422
|
if (isSwap || hasPnl) {
|
|
2423
2423
|
return this.parseSwapOrder(order, market);
|
|
@@ -4329,7 +4329,7 @@ class phemex extends phemex$1 {
|
|
|
4329
4329
|
throw new errors.BadRequest(this.id + ' setLeverage() leverage should be between -100 and 100');
|
|
4330
4330
|
}
|
|
4331
4331
|
await this.loadMarkets();
|
|
4332
|
-
const isHedged = this.
|
|
4332
|
+
const isHedged = this.safeBool(params, 'hedged', false);
|
|
4333
4333
|
const longLeverageRr = this.safeInteger(params, 'longLeverageRr');
|
|
4334
4334
|
const shortLeverageRr = this.safeInteger(params, 'shortLeverageRr');
|
|
4335
4335
|
const market = this.market(symbol);
|
|
@@ -4425,7 +4425,7 @@ class phemex extends phemex$1 {
|
|
|
4425
4425
|
transfer = this.parseTransfer(response);
|
|
4426
4426
|
}
|
|
4427
4427
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
4428
|
-
const fillResponseFromRequest = this.
|
|
4428
|
+
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
4429
4429
|
if (fillResponseFromRequest) {
|
|
4430
4430
|
if (transfer['fromAccount'] === undefined) {
|
|
4431
4431
|
transfer['fromAccount'] = fromAccount;
|
|
@@ -34,6 +34,9 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
34
34
|
'fetchBalance': true,
|
|
35
35
|
'fetchClosedOrders': true,
|
|
36
36
|
'fetchCurrencies': false,
|
|
37
|
+
'fetchDepositAddress': false,
|
|
38
|
+
'fetchDepositAddresses': false,
|
|
39
|
+
'fetchDepositAddressesByNetwork': false,
|
|
37
40
|
'fetchFundingRate': true,
|
|
38
41
|
'fetchFundingRateHistory': false,
|
|
39
42
|
'fetchL3OrderBook': true,
|
|
@@ -861,7 +864,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
861
864
|
request['timeInForce'] = timeInForce;
|
|
862
865
|
}
|
|
863
866
|
}
|
|
864
|
-
const postOnly = this.
|
|
867
|
+
const postOnly = this.safeBool(params, 'postOnly', false);
|
|
865
868
|
const hidden = this.safeValue(params, 'hidden');
|
|
866
869
|
if (postOnly && (hidden !== undefined)) {
|
|
867
870
|
throw new errors.BadRequest(this.id + ' createOrder() does not support the postOnly parameter together with a hidden parameter');
|
|
@@ -1552,8 +1555,8 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
1552
1555
|
// precision reported by their api is 8 d.p.
|
|
1553
1556
|
// const average = Precise.stringDiv (rawCost, Precise.stringMul (filled, market['contractSize']));
|
|
1554
1557
|
// bool
|
|
1555
|
-
const isActive = this.
|
|
1556
|
-
const cancelExist = this.
|
|
1558
|
+
const isActive = this.safeBool(order, 'isActive', false);
|
|
1559
|
+
const cancelExist = this.safeBool(order, 'cancelExist', false);
|
|
1557
1560
|
const status = isActive ? 'open' : 'closed';
|
|
1558
1561
|
let id = this.safeString(order, 'id');
|
|
1559
1562
|
if ('cancelledOrderIds' in order) {
|
|
@@ -224,7 +224,7 @@ class alpaca extends alpaca$1 {
|
|
|
224
224
|
const symbol = this.safeSymbol(marketId);
|
|
225
225
|
const datetime = this.safeString(message, 't');
|
|
226
226
|
const timestamp = this.parse8601(datetime);
|
|
227
|
-
const isSnapshot = this.
|
|
227
|
+
const isSnapshot = this.safeBool(message, 'r', false);
|
|
228
228
|
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
229
229
|
if (orderbook === undefined) {
|
|
230
230
|
orderbook = this.orderBook();
|
|
@@ -1270,7 +1270,7 @@ class binance extends binance$1 {
|
|
|
1270
1270
|
return undefined;
|
|
1271
1271
|
}
|
|
1272
1272
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
1273
|
-
const fetchBalanceSnapshot = this.
|
|
1273
|
+
const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
|
|
1274
1274
|
if (fetchBalanceSnapshot) {
|
|
1275
1275
|
const messageHash = type + ':fetchBalanceSnapshot';
|
|
1276
1276
|
if (!(messageHash in client.futures)) {
|
|
@@ -1396,8 +1396,8 @@ class binance extends binance$1 {
|
|
|
1396
1396
|
this.setBalanceCache(client, type);
|
|
1397
1397
|
this.setPositionsCache(client, type);
|
|
1398
1398
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
1399
|
-
const fetchBalanceSnapshot = this.
|
|
1400
|
-
const awaitBalanceSnapshot = this.
|
|
1399
|
+
const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
|
|
1400
|
+
const awaitBalanceSnapshot = this.safeBool(options, 'awaitBalanceSnapshot', true);
|
|
1401
1401
|
if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
|
|
1402
1402
|
await client.future(type + ':fetchBalanceSnapshot');
|
|
1403
1403
|
}
|
|
@@ -1558,7 +1558,7 @@ class binance extends binance$1 {
|
|
|
1558
1558
|
let returnRateLimits = false;
|
|
1559
1559
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
|
|
1560
1560
|
payload['returnRateLimits'] = returnRateLimits;
|
|
1561
|
-
const test = this.
|
|
1561
|
+
const test = this.safeBool(params, 'test', false);
|
|
1562
1562
|
params = this.omit(params, 'test');
|
|
1563
1563
|
const message = {
|
|
1564
1564
|
'id': messageHash,
|
|
@@ -892,7 +892,7 @@ class bitget extends bitget$1 {
|
|
|
892
892
|
await this.loadMarkets();
|
|
893
893
|
let market = undefined;
|
|
894
894
|
let marketId = undefined;
|
|
895
|
-
const isStop = this.
|
|
895
|
+
const isStop = this.safeBool(params, 'stop', false);
|
|
896
896
|
params = this.omit(params, 'stop');
|
|
897
897
|
let messageHash = (isStop) ? 'triggerOrder' : 'order';
|
|
898
898
|
let subscriptionHash = 'order:trades';
|
|
@@ -143,7 +143,7 @@ class bitmart extends bitmart$1 {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
146
|
-
const snapshot = this.
|
|
146
|
+
const snapshot = this.safeBool(options, 'fetchBalanceSnapshot', true);
|
|
147
147
|
if (snapshot) {
|
|
148
148
|
const messageHash = type + ':' + 'fetchBalanceSnapshot';
|
|
149
149
|
if (!(messageHash in client.futures)) {
|
|
@@ -20,7 +20,7 @@ class bitmex extends bitmex$1 {
|
|
|
20
20
|
'watchOrders': true,
|
|
21
21
|
'watchPostions': true,
|
|
22
22
|
'watchTicker': true,
|
|
23
|
-
'watchTickers':
|
|
23
|
+
'watchTickers': true,
|
|
24
24
|
'watchTrades': true,
|
|
25
25
|
'watchTradesForSymbols': true,
|
|
26
26
|
},
|
|
@@ -72,6 +72,46 @@ class bitmex extends bitmex$1 {
|
|
|
72
72
|
};
|
|
73
73
|
return await this.watch(url, messageHash, this.extend(request, params), messageHash);
|
|
74
74
|
}
|
|
75
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
76
|
+
/**
|
|
77
|
+
* @method
|
|
78
|
+
* @name bitmex#watchTickers
|
|
79
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
80
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
81
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
82
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
83
|
+
*/
|
|
84
|
+
await this.loadMarkets();
|
|
85
|
+
symbols = this.marketSymbols(symbols, undefined, true);
|
|
86
|
+
const name = 'instrument';
|
|
87
|
+
const url = this.urls['api']['ws'];
|
|
88
|
+
const messageHashes = [];
|
|
89
|
+
if (symbols !== undefined) {
|
|
90
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
91
|
+
const symbol = symbols[i];
|
|
92
|
+
const market = this.market(symbol);
|
|
93
|
+
const hash = name + ':' + market['id'];
|
|
94
|
+
messageHashes.push(hash);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
messageHashes.push(name);
|
|
99
|
+
}
|
|
100
|
+
const request = {
|
|
101
|
+
'op': 'subscribe',
|
|
102
|
+
'args': messageHashes,
|
|
103
|
+
};
|
|
104
|
+
const ticker = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
105
|
+
if (this.newUpdates) {
|
|
106
|
+
if (symbols === undefined) {
|
|
107
|
+
return ticker;
|
|
108
|
+
}
|
|
109
|
+
const result = {};
|
|
110
|
+
result[ticker['symbol']] = ticker;
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
114
|
+
}
|
|
75
115
|
handleTicker(client, message) {
|
|
76
116
|
//
|
|
77
117
|
// {
|
|
@@ -300,19 +340,22 @@ class bitmex extends bitmex$1 {
|
|
|
300
340
|
// }
|
|
301
341
|
//
|
|
302
342
|
const table = this.safeString(message, 'table');
|
|
303
|
-
const data = this.
|
|
343
|
+
const data = this.safeList(message, 'data', []);
|
|
344
|
+
const tickers = {};
|
|
304
345
|
for (let i = 0; i < data.length; i++) {
|
|
305
346
|
const update = data[i];
|
|
306
|
-
const marketId = this.
|
|
347
|
+
const marketId = this.safeString(update, 'symbol');
|
|
307
348
|
const market = this.safeMarket(marketId);
|
|
308
349
|
const symbol = market['symbol'];
|
|
309
350
|
const messageHash = table + ':' + marketId;
|
|
310
|
-
let ticker = this.
|
|
311
|
-
const info = this.
|
|
351
|
+
let ticker = this.safeDict(this.tickers, symbol, {});
|
|
352
|
+
const info = this.safeDict(ticker, 'info', {});
|
|
312
353
|
ticker = this.parseTicker(this.extend(info, update), market);
|
|
354
|
+
tickers[symbol] = ticker;
|
|
313
355
|
this.tickers[symbol] = ticker;
|
|
314
356
|
client.resolve(ticker, messageHash);
|
|
315
357
|
}
|
|
358
|
+
client.resolve(tickers, 'instrument');
|
|
316
359
|
return message;
|
|
317
360
|
}
|
|
318
361
|
async watchBalance(params = {}) {
|
|
@@ -576,7 +619,7 @@ class bitmex extends bitmex$1 {
|
|
|
576
619
|
return future;
|
|
577
620
|
}
|
|
578
621
|
handleAuthenticationMessage(client, message) {
|
|
579
|
-
const authenticated = this.
|
|
622
|
+
const authenticated = this.safeBool(message, 'success', false);
|
|
580
623
|
const messageHash = 'authenticated';
|
|
581
624
|
if (authenticated) {
|
|
582
625
|
// we resolve the future here permanently so authentication only happens once
|
|
@@ -1225,7 +1225,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1225
1225
|
// }
|
|
1226
1226
|
//
|
|
1227
1227
|
const messageHash = 'authenticated';
|
|
1228
|
-
const authenticated = this.
|
|
1228
|
+
const authenticated = this.safeBool(message, 'authenticated', false);
|
|
1229
1229
|
if (authenticated) {
|
|
1230
1230
|
// we resolve the future here permanently so authentication only happens once
|
|
1231
1231
|
client.resolve(message, messageHash);
|
|
@@ -1342,8 +1342,8 @@ class bybit extends bybit$1 {
|
|
|
1342
1342
|
let subType = undefined;
|
|
1343
1343
|
[subType, params] = this.handleSubTypeAndParams('watchBalance', undefined, params);
|
|
1344
1344
|
const unified = await this.isUnifiedEnabled();
|
|
1345
|
-
const isUnifiedMargin = this.
|
|
1346
|
-
const isUnifiedAccount = this.
|
|
1345
|
+
const isUnifiedMargin = this.safeBool(unified, 0, false);
|
|
1346
|
+
const isUnifiedAccount = this.safeBool(unified, 1, false);
|
|
1347
1347
|
const url = this.getUrlByMarketType(undefined, true, method, params);
|
|
1348
1348
|
await this.authenticate(url);
|
|
1349
1349
|
const topicByMarket = {
|
package/dist/cjs/src/pro/cex.js
CHANGED
|
@@ -717,7 +717,7 @@ class cex extends cex$1 {
|
|
|
717
717
|
order = this.parseWsOrderUpdate(data, market);
|
|
718
718
|
}
|
|
719
719
|
order['remaining'] = remains;
|
|
720
|
-
const canceled = this.
|
|
720
|
+
const canceled = this.safeBool(data, 'cancel', false);
|
|
721
721
|
if (canceled) {
|
|
722
722
|
order['status'] = 'canceled';
|
|
723
723
|
}
|
|
@@ -806,7 +806,7 @@ class cex extends cex$1 {
|
|
|
806
806
|
if (isTransaction) {
|
|
807
807
|
timestamp = this.parse8601(time);
|
|
808
808
|
}
|
|
809
|
-
const canceled = this.
|
|
809
|
+
const canceled = this.safeBool(order, 'cancel', false);
|
|
810
810
|
let status = 'open';
|
|
811
811
|
if (canceled) {
|
|
812
812
|
status = 'canceled';
|
|
@@ -176,7 +176,7 @@ class independentreserve extends independentreserve$1 {
|
|
|
176
176
|
const orderBook = this.safeValue(message, 'Data', {});
|
|
177
177
|
const messageHash = 'orderbook:' + symbol + ':' + depth;
|
|
178
178
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
179
|
-
const receivedSnapshot = this.
|
|
179
|
+
const receivedSnapshot = this.safeBool(subscription, 'receivedSnapshot', false);
|
|
180
180
|
const timestamp = this.safeInteger(message, 'Time');
|
|
181
181
|
let storedOrderBook = this.safeValue(this.orderbooks, symbol);
|
|
182
182
|
if (storedOrderBook === undefined) {
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -864,7 +864,7 @@ class okx extends okx$1 {
|
|
|
864
864
|
// By default, receive order updates from any instrument type
|
|
865
865
|
let type = undefined;
|
|
866
866
|
[type, params] = this.handleOptionAndParams(params, 'watchMyTrades', 'type', 'ANY');
|
|
867
|
-
const isStop = this.
|
|
867
|
+
const isStop = this.safeBool(params, 'stop', false);
|
|
868
868
|
params = this.omit(params, ['stop']);
|
|
869
869
|
await this.loadMarkets();
|
|
870
870
|
await this.authenticate({ 'access': isStop ? 'business' : 'private' });
|
|
@@ -1057,7 +1057,7 @@ class onetrading extends onetrading$1 {
|
|
|
1057
1057
|
subscription = this.safeValue(client.subscriptions, subscriptionHash);
|
|
1058
1058
|
if (subscription !== undefined) {
|
|
1059
1059
|
const ohlcvMarket = this.safeValue(subscription, marketId, {});
|
|
1060
|
-
const marketSubscribed = this.
|
|
1060
|
+
const marketSubscribed = this.safeBool(ohlcvMarket, timeframe, false);
|
|
1061
1061
|
if (!marketSubscribed) {
|
|
1062
1062
|
type = 'UPDATE_SUBSCRIPTION';
|
|
1063
1063
|
client.subscriptions[subscriptionHash] = undefined;
|
|
@@ -1298,7 +1298,7 @@ class onetrading extends onetrading$1 {
|
|
|
1298
1298
|
if (subscription !== undefined) {
|
|
1299
1299
|
for (let i = 0; i < marketIds.length; i++) {
|
|
1300
1300
|
const marketId = marketIds[i];
|
|
1301
|
-
const marketSubscribed = this.
|
|
1301
|
+
const marketSubscribed = this.safeBool(subscription, marketId, false);
|
|
1302
1302
|
if (!marketSubscribed) {
|
|
1303
1303
|
type = 'UPDATE_SUBSCRIPTION';
|
|
1304
1304
|
client.subscriptions[subscriptionHash] = undefined;
|