ccxt 4.2.58 → 4.2.60
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/CHANGELOG.md +83 -0
- package/README.md +3 -3
- package/build.sh +1 -1
- package/cleanup.sh +3 -0
- package/dist/ccxt.browser.js +716 -382
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/base/Exchange.js +2 -0
- package/dist/cjs/src/binance.js +2 -2
- package/dist/cjs/src/bingx.js +41 -3
- package/dist/cjs/src/bitfinex2.js +21 -4
- package/dist/cjs/src/bitget.js +10 -3
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/blofin.js +60 -2
- package/dist/cjs/src/coinbase.js +24 -14
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/kraken.js +42 -39
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/binance.js +17 -4
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +51 -89
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinex.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/deribit.js +201 -84
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/mexc.js +5 -3
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/wazirx.js +6 -1
- package/dist/cjs/src/woo.js +159 -79
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/base/Exchange.js +2 -0
- package/js/src/binance.js +2 -2
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +41 -3
- package/js/src/bitfinex2.js +21 -4
- package/js/src/bitget.js +10 -3
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/bitmex.js +1 -1
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +60 -2
- package/js/src/coinbase.js +24 -14
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/kraken.js +42 -39
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +1 -1
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +1 -1
- package/js/src/pro/binance.js +17 -4
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.d.ts +2 -2
- package/js/src/pro/bitmart.js +51 -89
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinex.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/deribit.d.ts +5 -0
- package/js/src/pro/deribit.js +202 -85
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/independentreserve.js +1 -1
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/mexc.js +6 -4
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/wazirx.js +6 -1
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +159 -79
- package/package.json +1 -1
- package/skip-tests.json +44 -18
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -21,7 +21,10 @@ class kraken extends kraken$1 {
|
|
|
21
21
|
'name': 'Kraken',
|
|
22
22
|
'countries': ['US'],
|
|
23
23
|
'version': '0',
|
|
24
|
-
|
|
24
|
+
// rate-limits: https://support.kraken.com/hc/en-us/articles/206548367-What-are-the-API-rate-limits-#1
|
|
25
|
+
// for public: 1 req/s
|
|
26
|
+
// for private: every second 0.33 weight added to your allowed capacity (some private endpoints need 1 weight, some need 2)
|
|
27
|
+
'rateLimit': 1000,
|
|
25
28
|
'certified': false,
|
|
26
29
|
'pro': true,
|
|
27
30
|
'has': {
|
|
@@ -151,7 +154,7 @@ class kraken extends kraken$1 {
|
|
|
151
154
|
},
|
|
152
155
|
'public': {
|
|
153
156
|
'get': {
|
|
154
|
-
//
|
|
157
|
+
// rate-limits explained in comment in the top of this file
|
|
155
158
|
'Assets': 1,
|
|
156
159
|
'AssetPairs': 1,
|
|
157
160
|
'Depth': 1,
|
|
@@ -167,48 +170,48 @@ class kraken extends kraken$1 {
|
|
|
167
170
|
'post': {
|
|
168
171
|
'AddOrder': 0,
|
|
169
172
|
'AddOrderBatch': 0,
|
|
170
|
-
'AddExport':
|
|
171
|
-
'Balance':
|
|
172
|
-
'CancelAll':
|
|
173
|
-
'CancelAllOrdersAfter':
|
|
173
|
+
'AddExport': 3,
|
|
174
|
+
'Balance': 3,
|
|
175
|
+
'CancelAll': 3,
|
|
176
|
+
'CancelAllOrdersAfter': 3,
|
|
174
177
|
'CancelOrder': 0,
|
|
175
178
|
'CancelOrderBatch': 0,
|
|
176
|
-
'ClosedOrders':
|
|
177
|
-
'DepositAddresses':
|
|
178
|
-
'DepositMethods':
|
|
179
|
-
'DepositStatus':
|
|
179
|
+
'ClosedOrders': 3,
|
|
180
|
+
'DepositAddresses': 3,
|
|
181
|
+
'DepositMethods': 3,
|
|
182
|
+
'DepositStatus': 3,
|
|
180
183
|
'EditOrder': 0,
|
|
181
|
-
'ExportStatus':
|
|
182
|
-
'GetWebSocketsToken':
|
|
183
|
-
'Ledgers':
|
|
184
|
-
'OpenOrders':
|
|
185
|
-
'OpenPositions':
|
|
186
|
-
'QueryLedgers':
|
|
187
|
-
'QueryOrders':
|
|
188
|
-
'QueryTrades':
|
|
189
|
-
'RetrieveExport':
|
|
190
|
-
'RemoveExport':
|
|
191
|
-
'BalanceEx':
|
|
192
|
-
'TradeBalance':
|
|
193
|
-
'TradesHistory':
|
|
194
|
-
'TradeVolume':
|
|
195
|
-
'Withdraw':
|
|
196
|
-
'WithdrawCancel':
|
|
197
|
-
'WithdrawInfo':
|
|
198
|
-
'WithdrawMethods':
|
|
199
|
-
'WithdrawAddresses':
|
|
200
|
-
'WithdrawStatus':
|
|
201
|
-
'WalletTransfer':
|
|
184
|
+
'ExportStatus': 3,
|
|
185
|
+
'GetWebSocketsToken': 3,
|
|
186
|
+
'Ledgers': 6,
|
|
187
|
+
'OpenOrders': 3,
|
|
188
|
+
'OpenPositions': 3,
|
|
189
|
+
'QueryLedgers': 3,
|
|
190
|
+
'QueryOrders': 3,
|
|
191
|
+
'QueryTrades': 3,
|
|
192
|
+
'RetrieveExport': 3,
|
|
193
|
+
'RemoveExport': 3,
|
|
194
|
+
'BalanceEx': 3,
|
|
195
|
+
'TradeBalance': 3,
|
|
196
|
+
'TradesHistory': 6,
|
|
197
|
+
'TradeVolume': 3,
|
|
198
|
+
'Withdraw': 3,
|
|
199
|
+
'WithdrawCancel': 3,
|
|
200
|
+
'WithdrawInfo': 3,
|
|
201
|
+
'WithdrawMethods': 3,
|
|
202
|
+
'WithdrawAddresses': 3,
|
|
203
|
+
'WithdrawStatus': 3,
|
|
204
|
+
'WalletTransfer': 3,
|
|
202
205
|
// sub accounts
|
|
203
|
-
'CreateSubaccount':
|
|
204
|
-
'AccountTransfer':
|
|
206
|
+
'CreateSubaccount': 3,
|
|
207
|
+
'AccountTransfer': 3,
|
|
205
208
|
// earn
|
|
206
|
-
'Earn/Allocate':
|
|
207
|
-
'Earn/Deallocate':
|
|
208
|
-
'Earn/AllocateStatus':
|
|
209
|
-
'Earn/DeallocateStatus':
|
|
210
|
-
'Earn/Strategies':
|
|
211
|
-
'Earn/Allocations':
|
|
209
|
+
'Earn/Allocate': 3,
|
|
210
|
+
'Earn/Deallocate': 3,
|
|
211
|
+
'Earn/AllocateStatus': 3,
|
|
212
|
+
'Earn/DeallocateStatus': 3,
|
|
213
|
+
'Earn/Strategies': 3,
|
|
214
|
+
'Earn/Allocations': 3,
|
|
212
215
|
},
|
|
213
216
|
},
|
|
214
217
|
},
|
package/dist/cjs/src/lbank.js
CHANGED
|
@@ -2691,7 +2691,7 @@ class lbank extends lbank$1 {
|
|
|
2691
2691
|
const uppercaseHash = hash.toUpperCase();
|
|
2692
2692
|
let sign = undefined;
|
|
2693
2693
|
if (signatureMethod === 'RSA') {
|
|
2694
|
-
const cacheSecretAsPem = this.
|
|
2694
|
+
const cacheSecretAsPem = this.safeBool(this.options, 'cacheSecretAsPem', true);
|
|
2695
2695
|
let pem = undefined;
|
|
2696
2696
|
if (cacheSecretAsPem) {
|
|
2697
2697
|
pem = this.safeValue(this.options, 'pem');
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -5496,7 +5496,7 @@ class mexc extends mexc$1 {
|
|
|
5496
5496
|
'source': this.safeString(this.options, 'broker', 'CCXT'),
|
|
5497
5497
|
};
|
|
5498
5498
|
}
|
|
5499
|
-
if ((method === 'POST') || (method === 'PUT')) {
|
|
5499
|
+
if ((method === 'POST') || (method === 'PUT') || (method === 'DELETE')) {
|
|
5500
5500
|
headers['Content-Type'] = 'application/json';
|
|
5501
5501
|
}
|
|
5502
5502
|
}
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1557,7 +1557,7 @@ class okx extends okx$1 {
|
|
|
1557
1557
|
// while fetchCurrencies is a public API method by design
|
|
1558
1558
|
// therefore we check the keys here
|
|
1559
1559
|
// and fallback to generating the currencies from the markets
|
|
1560
|
-
const isSandboxMode = this.
|
|
1560
|
+
const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
1561
1561
|
if (!this.checkRequiredCredentials(false) || isSandboxMode) {
|
|
1562
1562
|
return undefined;
|
|
1563
1563
|
}
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -2419,7 +2419,7 @@ class phemex extends phemex$1 {
|
|
|
2419
2419
|
}
|
|
2420
2420
|
parseOrder(order, market = undefined) {
|
|
2421
2421
|
const isSwap = this.safeBool(market, 'swap', false);
|
|
2422
|
-
const hasPnl = ('closedPnl' in order);
|
|
2422
|
+
const hasPnl = ('closedPnl' in order) || ('closedPnlRv' in order) || ('totalPnlRv' in order);
|
|
2423
2423
|
if (isSwap || hasPnl) {
|
|
2424
2424
|
return this.parseSwapOrder(order, market);
|
|
2425
2425
|
}
|
|
@@ -2465,7 +2465,7 @@ class binance extends binance$1 {
|
|
|
2465
2465
|
this.setBalanceCache(client, type, isPortfolioMargin);
|
|
2466
2466
|
this.setPositionsCache(client, type, symbols, isPortfolioMargin);
|
|
2467
2467
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
2468
|
-
const awaitPositionsSnapshot = this.
|
|
2468
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
2469
2469
|
const cache = this.safeValue(this.positions, type);
|
|
2470
2470
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
2471
2471
|
const snapshot = await client.future(type + ':fetchPositionsSnapshot');
|
|
@@ -2599,8 +2599,21 @@ class binance extends binance$1 {
|
|
|
2599
2599
|
// }
|
|
2600
2600
|
//
|
|
2601
2601
|
const marketId = this.safeString(position, 's');
|
|
2602
|
-
const
|
|
2603
|
-
const
|
|
2602
|
+
const contracts = this.safeString(position, 'pa');
|
|
2603
|
+
const contractsAbs = Precise["default"].stringAbs(this.safeString(position, 'pa'));
|
|
2604
|
+
let positionSide = this.safeStringLower(position, 'ps');
|
|
2605
|
+
let hedged = true;
|
|
2606
|
+
if (positionSide === 'both') {
|
|
2607
|
+
hedged = false;
|
|
2608
|
+
if (!Precise["default"].stringEq(contracts, '0')) {
|
|
2609
|
+
if (Precise["default"].stringLt(contracts, '0')) {
|
|
2610
|
+
positionSide = 'short';
|
|
2611
|
+
}
|
|
2612
|
+
else {
|
|
2613
|
+
positionSide = 'long';
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2604
2617
|
return this.safePosition({
|
|
2605
2618
|
'info': position,
|
|
2606
2619
|
'id': undefined,
|
|
@@ -2611,7 +2624,7 @@ class binance extends binance$1 {
|
|
|
2611
2624
|
'entryPrice': this.safeNumber(position, 'ep'),
|
|
2612
2625
|
'unrealizedPnl': this.safeNumber(position, 'up'),
|
|
2613
2626
|
'percentage': undefined,
|
|
2614
|
-
'contracts': this.
|
|
2627
|
+
'contracts': this.parseNumber(contractsAbs),
|
|
2615
2628
|
'contractSize': undefined,
|
|
2616
2629
|
'markPrice': undefined,
|
|
2617
2630
|
'side': positionSide,
|
|
@@ -53,7 +53,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
53
53
|
'symbol': marketId,
|
|
54
54
|
};
|
|
55
55
|
const result = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash, { 'checksum': false });
|
|
56
|
-
const checksum = this.
|
|
56
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
57
57
|
if (checksum && !client.subscriptions[messageHash]['checksum'] && (channel === 'book')) {
|
|
58
58
|
client.subscriptions[messageHash]['checksum'] = true;
|
|
59
59
|
await client.send({
|
|
@@ -536,7 +536,7 @@ class bitget extends bitget$1 {
|
|
|
536
536
|
this.handleDeltas(storedOrderBook['bids'], bids);
|
|
537
537
|
storedOrderBook['timestamp'] = timestamp;
|
|
538
538
|
storedOrderBook['datetime'] = this.iso8601(timestamp);
|
|
539
|
-
const checksum = this.
|
|
539
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
540
540
|
const isSnapshot = this.safeString(message, 'action') === 'snapshot'; // snapshot does not have a checksum
|
|
541
541
|
if (!isSnapshot && checksum) {
|
|
542
542
|
const storedAsks = storedOrderBook['asks'];
|
|
@@ -107,11 +107,12 @@ class bitmart extends bitmart$1 {
|
|
|
107
107
|
}
|
|
108
108
|
return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
109
109
|
}
|
|
110
|
-
async subscribeMultiple(channel, type, symbols, params = {}) {
|
|
110
|
+
async subscribeMultiple(channel, type, symbols = undefined, params = {}) {
|
|
111
|
+
symbols = this.marketSymbols(symbols, type, false, true);
|
|
111
112
|
const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
|
|
112
113
|
const channelType = (type === 'spot') ? 'spot' : 'futures';
|
|
113
114
|
const actionType = (type === 'spot') ? 'op' : 'action';
|
|
114
|
-
|
|
115
|
+
let rawSubscriptions = [];
|
|
115
116
|
const messageHashes = [];
|
|
116
117
|
for (let i = 0; i < symbols.length; i++) {
|
|
117
118
|
const market = this.market(symbols[i]);
|
|
@@ -119,6 +120,10 @@ class bitmart extends bitmart$1 {
|
|
|
119
120
|
rawSubscriptions.push(message);
|
|
120
121
|
messageHashes.push(channel + ':' + market['symbol']);
|
|
121
122
|
}
|
|
123
|
+
// as an exclusion, futures "tickers" need one generic request for all symbols
|
|
124
|
+
if ((type !== 'spot') && (channel === 'ticker')) {
|
|
125
|
+
rawSubscriptions = [channelType + '/' + channel];
|
|
126
|
+
}
|
|
122
127
|
const request = {
|
|
123
128
|
'args': rawSubscriptions,
|
|
124
129
|
};
|
|
@@ -321,13 +326,8 @@ class bitmart extends bitmart$1 {
|
|
|
321
326
|
*/
|
|
322
327
|
await this.loadMarkets();
|
|
323
328
|
symbol = this.symbol(symbol);
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
[type, params] = this.handleMarketTypeAndParams('watchTicker', market, params);
|
|
327
|
-
if (type === 'swap') {
|
|
328
|
-
throw new errors.NotSupported(this.id + ' watchTicker() does not support ' + type + ' markets. Use watchTickers() instead');
|
|
329
|
-
}
|
|
330
|
-
return await this.subscribe('ticker', symbol, type, params);
|
|
329
|
+
const tickers = await this.watchTickers([symbol], params);
|
|
330
|
+
return tickers[symbol];
|
|
331
331
|
}
|
|
332
332
|
async watchTickers(symbols = undefined, params = {}) {
|
|
333
333
|
/**
|
|
@@ -341,40 +341,12 @@ class bitmart extends bitmart$1 {
|
|
|
341
341
|
*/
|
|
342
342
|
await this.loadMarkets();
|
|
343
343
|
const market = this.getMarketFromSymbols(symbols);
|
|
344
|
-
let
|
|
345
|
-
[
|
|
346
|
-
const
|
|
347
|
-
symbols = this.marketSymbols(symbols);
|
|
348
|
-
let messageHash = 'tickers::' + type;
|
|
349
|
-
if (symbols !== undefined) {
|
|
350
|
-
messageHash += '::' + symbols.join(',');
|
|
351
|
-
}
|
|
352
|
-
let request = undefined;
|
|
353
|
-
let tickers = undefined;
|
|
354
|
-
const isSpot = (type === 'spot');
|
|
355
|
-
if (isSpot) {
|
|
356
|
-
if (symbols === undefined) {
|
|
357
|
-
throw new errors.ArgumentsRequired(this.id + ' watchTickers() for ' + type + ' market type requires symbols argument to be provided');
|
|
358
|
-
}
|
|
359
|
-
const marketIds = this.marketIds(symbols);
|
|
360
|
-
const finalArray = [];
|
|
361
|
-
for (let i = 0; i < marketIds.length; i++) {
|
|
362
|
-
finalArray.push('spot/ticker:' + marketIds[i]);
|
|
363
|
-
}
|
|
364
|
-
request = {
|
|
365
|
-
'op': 'subscribe',
|
|
366
|
-
'args': finalArray,
|
|
367
|
-
};
|
|
368
|
-
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
request = {
|
|
372
|
-
'action': 'subscribe',
|
|
373
|
-
'args': ['futures/ticker'],
|
|
374
|
-
};
|
|
375
|
-
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
376
|
-
}
|
|
344
|
+
let marketType = undefined;
|
|
345
|
+
[marketType, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
|
|
346
|
+
const ticker = await this.subscribeMultiple('ticker', marketType, symbols, params);
|
|
377
347
|
if (this.newUpdates) {
|
|
348
|
+
const tickers = {};
|
|
349
|
+
tickers[ticker['symbol']] = ticker;
|
|
378
350
|
return tickers;
|
|
379
351
|
}
|
|
380
352
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
@@ -850,21 +822,34 @@ class bitmart extends bitmart$1 {
|
|
|
850
822
|
if (data === undefined) {
|
|
851
823
|
return;
|
|
852
824
|
}
|
|
853
|
-
let stored = undefined;
|
|
854
825
|
let symbol = undefined;
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
826
|
+
const length = data.length;
|
|
827
|
+
const isSwap = ('group' in message);
|
|
828
|
+
if (isSwap) {
|
|
829
|
+
// in swap, chronologically decreasing: 1709536849322, 1709536848954,
|
|
830
|
+
const maxLen = Math.max(length - 1, 0);
|
|
831
|
+
for (let i = maxLen; i >= 0; i--) {
|
|
832
|
+
symbol = this.handleTradeLoop(data[i]);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
// in spot, chronologically increasing: 1709536771200, 1709536771226,
|
|
837
|
+
for (let i = 0; i < length; i++) {
|
|
838
|
+
symbol = this.handleTradeLoop(data[i]);
|
|
863
839
|
}
|
|
864
|
-
stored.append(trade);
|
|
865
840
|
}
|
|
866
|
-
|
|
867
|
-
|
|
841
|
+
client.resolve(this.trades[symbol], 'trade:' + symbol);
|
|
842
|
+
}
|
|
843
|
+
handleTradeLoop(entry) {
|
|
844
|
+
const trade = this.parseWsTrade(entry);
|
|
845
|
+
const symbol = trade['symbol'];
|
|
846
|
+
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
847
|
+
if (this.safeValue(this.trades, symbol) === undefined) {
|
|
848
|
+
this.trades[symbol] = new Cache.ArrayCache(tradesLimit);
|
|
849
|
+
}
|
|
850
|
+
const stored = this.trades[symbol];
|
|
851
|
+
stored.append(trade);
|
|
852
|
+
return symbol;
|
|
868
853
|
}
|
|
869
854
|
parseWsTrade(trade, market = undefined) {
|
|
870
855
|
// spot
|
|
@@ -943,45 +928,22 @@ class bitmart extends bitmart$1 {
|
|
|
943
928
|
//
|
|
944
929
|
const table = this.safeString(message, 'table');
|
|
945
930
|
const isSpot = (table !== undefined);
|
|
946
|
-
|
|
947
|
-
if (data === undefined) {
|
|
948
|
-
return;
|
|
949
|
-
}
|
|
931
|
+
let rawTickers = [];
|
|
950
932
|
if (isSpot) {
|
|
951
|
-
|
|
952
|
-
const ticker = this.parseTicker(data[i]);
|
|
953
|
-
const symbol = ticker['symbol'];
|
|
954
|
-
const marketId = this.safeString(ticker['info'], 'symbol');
|
|
955
|
-
const messageHash = table + ':' + marketId;
|
|
956
|
-
this.tickers[symbol] = ticker;
|
|
957
|
-
client.resolve(ticker, messageHash);
|
|
958
|
-
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
959
|
-
}
|
|
933
|
+
rawTickers = this.safeList(message, 'data', []);
|
|
960
934
|
}
|
|
961
935
|
else {
|
|
962
|
-
|
|
963
|
-
const ticker = this.parseWsSwapTicker(data);
|
|
964
|
-
const symbol = this.safeString(ticker, 'symbol');
|
|
965
|
-
this.tickers[symbol] = ticker;
|
|
966
|
-
client.resolve(ticker, 'tickers::swap');
|
|
967
|
-
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
936
|
+
rawTickers = [this.safeValue(message, 'data', {})];
|
|
968
937
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
const symbolsString = parts[length - 1];
|
|
979
|
-
const symbols = symbolsString.split(symbolsSeparator);
|
|
980
|
-
if (this.inArray(symbol, symbols)) {
|
|
981
|
-
const response = {};
|
|
982
|
-
response[symbol] = result;
|
|
983
|
-
client.resolve(response, messageHash);
|
|
984
|
-
}
|
|
938
|
+
if (!rawTickers.length) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
for (let i = 0; i < rawTickers.length; i++) {
|
|
942
|
+
const ticker = isSpot ? this.parseTicker(rawTickers[i]) : this.parseWsSwapTicker(rawTickers[i]);
|
|
943
|
+
const symbol = ticker['symbol'];
|
|
944
|
+
this.tickers[symbol] = ticker;
|
|
945
|
+
const messageHash = 'ticker:' + symbol;
|
|
946
|
+
client.resolve(ticker, messageHash);
|
|
985
947
|
}
|
|
986
948
|
}
|
|
987
949
|
parseWsSwapTicker(ticker, market = undefined) {
|
|
@@ -1084,7 +1084,7 @@ class bitvavo extends bitvavo$1 {
|
|
|
1084
1084
|
return messageHash;
|
|
1085
1085
|
}
|
|
1086
1086
|
checkMessageHashDoesNotExist(messageHash) {
|
|
1087
|
-
const supressMultipleWsRequestsError = this.
|
|
1087
|
+
const supressMultipleWsRequestsError = this.safeBool(this.options, 'supressMultipleWsRequestsError', false);
|
|
1088
1088
|
if (!supressMultipleWsRequestsError) {
|
|
1089
1089
|
const client = this.safeValue(this.clients, this.urls['api']['ws']);
|
|
1090
1090
|
if (client !== undefined) {
|
|
@@ -939,7 +939,7 @@ class bybit extends bybit$1 {
|
|
|
939
939
|
this.setPositionsCache(client, symbols);
|
|
940
940
|
const cache = this.positions;
|
|
941
941
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
942
|
-
const awaitPositionsSnapshot = this.
|
|
942
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
943
943
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
944
944
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
945
945
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
|
@@ -546,7 +546,7 @@ class coinex extends coinex$1 {
|
|
|
546
546
|
}
|
|
547
547
|
const url = this.urls['api']['ws'][type];
|
|
548
548
|
const messageHash = 'ohlcv';
|
|
549
|
-
const watchOHLCVWarning = this.
|
|
549
|
+
const watchOHLCVWarning = this.safeBool(this.options, 'watchOHLCVWarning', true);
|
|
550
550
|
const client = this.safeValue(this.clients, url, {});
|
|
551
551
|
const clientSub = this.safeValue(client, 'subscriptions', {});
|
|
552
552
|
const existingSubscription = this.safeValue(clientSub, messageHash);
|
|
@@ -553,7 +553,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
553
553
|
const client = this.client(url);
|
|
554
554
|
this.setPositionsCache(client, symbols);
|
|
555
555
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
556
|
-
const awaitPositionsSnapshot = this.
|
|
556
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
557
557
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
558
558
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
559
559
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|