ccxt 4.5.0 → 4.5.2
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 +110 -112
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -9
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +13 -0
- package/dist/cjs/src/binance.js +20 -14
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/coinbase.js +46 -34
- package/dist/cjs/src/gate.js +39 -18
- package/dist/cjs/src/gemini.js +1 -1
- package/dist/cjs/src/hibachi.js +1 -1
- package/dist/cjs/src/hyperliquid.js +16 -2
- package/dist/cjs/src/indodax.js +11 -12
- package/dist/cjs/src/kraken.js +1 -12
- package/dist/cjs/src/krakenfutures.js +25 -25
- package/dist/cjs/src/mexc.js +2 -1
- package/dist/cjs/src/okx.js +2 -2
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/bitget.js +352 -75
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bybit.js +8 -15
- package/dist/cjs/src/pro/gate.js +6 -1
- package/dist/cjs/src/pro/gemini.js +7 -2
- package/dist/cjs/src/pro/hyperliquid.js +9 -1
- package/dist/cjs/src/pro/kraken.js +5 -6
- package/dist/cjs/src/pro/lbank.js +55 -1
- package/dist/cjs/src/pro/mexc.js +1 -1
- package/dist/cjs/src/timex.js +35 -0
- package/dist/cjs/src/tradeogre.js +32 -0
- package/dist/cjs/src/wavesexchange.js +33 -0
- package/dist/cjs/src/zonda.js +12 -0
- package/js/ccxt.d.ts +2 -11
- package/js/ccxt.js +2 -8
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +14 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +20 -14
- package/js/src/bitget.js +1 -1
- package/js/src/coinbase.js +46 -34
- package/js/src/gate.d.ts +2 -1
- package/js/src/gate.js +39 -18
- package/js/src/gemini.js +1 -1
- package/js/src/hibachi.js +1 -1
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +16 -2
- package/js/src/indodax.js +11 -12
- package/js/src/kraken.d.ts +0 -1
- package/js/src/kraken.js +1 -12
- package/js/src/krakenfutures.d.ts +24 -24
- package/js/src/krakenfutures.js +25 -25
- package/js/src/mexc.js +2 -1
- package/js/src/okx.js +2 -2
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/bitget.d.ts +12 -2
- package/js/src/pro/bitget.js +358 -75
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bybit.js +8 -15
- package/js/src/pro/gate.d.ts +5 -0
- package/js/src/pro/gate.js +6 -1
- package/js/src/pro/gemini.d.ts +1 -1
- package/js/src/pro/gemini.js +7 -2
- package/js/src/pro/hyperliquid.js +9 -1
- package/js/src/pro/kraken.js +5 -6
- package/js/src/pro/lbank.d.ts +11 -1
- package/js/src/pro/lbank.js +55 -1
- package/js/src/pro/mexc.js +1 -1
- package/js/src/timex.js +35 -0
- package/js/src/tradeogre.js +32 -0
- package/js/src/wavesexchange.js +33 -0
- package/js/src/zonda.js +12 -0
- package/package.json +2 -1
- package/js/src/abstract/ellipx.d.ts +0 -28
- package/js/src/abstract/ellipx.js +0 -11
- package/js/src/abstract/vertex.d.ts +0 -22
- package/js/src/abstract/vertex.js +0 -11
- package/js/src/ellipx.d.ts +0 -237
- package/js/src/ellipx.js +0 -2071
- package/js/src/pro/vertex.d.ts +0 -104
- package/js/src/pro/vertex.js +0 -999
- package/js/src/vertex.d.ts +0 -346
- package/js/src/vertex.js +0 -3146
|
@@ -46,10 +46,14 @@ class bitget extends bitget$1["default"] {
|
|
|
46
46
|
'ws': {
|
|
47
47
|
'public': 'wss://ws.bitget.com/v2/ws/public',
|
|
48
48
|
'private': 'wss://ws.bitget.com/v2/ws/private',
|
|
49
|
+
'utaPublic': 'wss://ws.bitget.com/v3/ws/public',
|
|
50
|
+
'utaPrivate': 'wss://ws.bitget.com/v3/ws/private',
|
|
49
51
|
},
|
|
50
52
|
'demo': {
|
|
51
53
|
'public': 'wss://wspap.bitget.com/v2/ws/public',
|
|
52
54
|
'private': 'wss://wspap.bitget.com/v2/ws/private',
|
|
55
|
+
'utaPublic': 'wss://wspap.bitget.com/v3/ws/public',
|
|
56
|
+
'utaPrivate': 'wss://wspap.bitget.com/v3/ws/private',
|
|
53
57
|
},
|
|
54
58
|
},
|
|
55
59
|
},
|
|
@@ -59,6 +63,7 @@ class bitget extends bitget$1["default"] {
|
|
|
59
63
|
// WS timeframes differ from REST timeframes
|
|
60
64
|
'timeframes': {
|
|
61
65
|
'1m': '1m',
|
|
66
|
+
'3m': '3m',
|
|
62
67
|
'5m': '5m',
|
|
63
68
|
'15m': '15m',
|
|
64
69
|
'30m': '30m',
|
|
@@ -101,7 +106,10 @@ class bitget extends bitget$1["default"] {
|
|
|
101
106
|
},
|
|
102
107
|
});
|
|
103
108
|
}
|
|
104
|
-
getInstType(market, params = {}) {
|
|
109
|
+
getInstType(market, uta = false, params = {}) {
|
|
110
|
+
if ((uta === undefined) || !uta) {
|
|
111
|
+
[uta, params] = this.handleOptionAndParams(params, 'getInstType', 'uta', false);
|
|
112
|
+
}
|
|
105
113
|
let instType = undefined;
|
|
106
114
|
if (market === undefined) {
|
|
107
115
|
[instType, params] = this.handleProductTypeAndParams(undefined, params);
|
|
@@ -115,6 +123,9 @@ class bitget extends bitget$1["default"] {
|
|
|
115
123
|
let instypeAux = undefined;
|
|
116
124
|
[instypeAux, params] = this.handleOptionAndParams(params, 'getInstType', 'instType', instType);
|
|
117
125
|
instType = instypeAux;
|
|
126
|
+
if (uta) {
|
|
127
|
+
instType = instType.toLowerCase();
|
|
128
|
+
}
|
|
118
129
|
return [instType, params];
|
|
119
130
|
}
|
|
120
131
|
/**
|
|
@@ -123,8 +134,10 @@ class bitget extends bitget$1["default"] {
|
|
|
123
134
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
124
135
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
|
125
136
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
|
137
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
|
|
126
138
|
* @param {string} symbol unified symbol of the market to watch the ticker for
|
|
127
139
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
140
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
128
141
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
129
142
|
*/
|
|
130
143
|
async watchTicker(symbol, params = {}) {
|
|
@@ -133,12 +146,16 @@ class bitget extends bitget$1["default"] {
|
|
|
133
146
|
symbol = market['symbol'];
|
|
134
147
|
const messageHash = 'ticker:' + symbol;
|
|
135
148
|
let instType = undefined;
|
|
136
|
-
|
|
149
|
+
let uta = undefined;
|
|
150
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchTicker', 'uta', false);
|
|
151
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
137
152
|
const args = {
|
|
138
153
|
'instType': instType,
|
|
139
|
-
'channel': 'ticker',
|
|
140
|
-
'instId': market['id'],
|
|
141
154
|
};
|
|
155
|
+
const topicOrChannel = uta ? 'topic' : 'channel';
|
|
156
|
+
const symbolOrInstId = uta ? 'symbol' : 'instId';
|
|
157
|
+
args[topicOrChannel] = 'ticker';
|
|
158
|
+
args[symbolOrInstId] = market['id'];
|
|
142
159
|
return await this.watchPublic(messageHash, args, params);
|
|
143
160
|
}
|
|
144
161
|
/**
|
|
@@ -161,8 +178,10 @@ class bitget extends bitget$1["default"] {
|
|
|
161
178
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
162
179
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
|
163
180
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
|
181
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
|
|
164
182
|
* @param {string[]} symbols unified symbol of the market to watch the tickers for
|
|
165
183
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
184
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
166
185
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
167
186
|
*/
|
|
168
187
|
async watchTickers(symbols = undefined, params = {}) {
|
|
@@ -170,7 +189,9 @@ class bitget extends bitget$1["default"] {
|
|
|
170
189
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
171
190
|
const market = this.market(symbols[0]);
|
|
172
191
|
let instType = undefined;
|
|
173
|
-
|
|
192
|
+
let uta = undefined;
|
|
193
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchTickers', 'uta', false);
|
|
194
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
174
195
|
const topics = [];
|
|
175
196
|
const messageHashes = [];
|
|
176
197
|
for (let i = 0; i < symbols.length; i++) {
|
|
@@ -178,9 +199,11 @@ class bitget extends bitget$1["default"] {
|
|
|
178
199
|
const marketInner = this.market(symbol);
|
|
179
200
|
const args = {
|
|
180
201
|
'instType': instType,
|
|
181
|
-
'channel': 'ticker',
|
|
182
|
-
'instId': marketInner['id'],
|
|
183
202
|
};
|
|
203
|
+
const topicOrChannel = uta ? 'topic' : 'channel';
|
|
204
|
+
const symbolOrInstId = uta ? 'symbol' : 'instId';
|
|
205
|
+
args[topicOrChannel] = 'ticker';
|
|
206
|
+
args[symbolOrInstId] = marketInner['id'];
|
|
184
207
|
topics.push(args);
|
|
185
208
|
messageHashes.push('ticker:' + symbol);
|
|
186
209
|
}
|
|
@@ -193,6 +216,8 @@ class bitget extends bitget$1["default"] {
|
|
|
193
216
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
194
217
|
}
|
|
195
218
|
handleTicker(client, message) {
|
|
219
|
+
//
|
|
220
|
+
// default
|
|
196
221
|
//
|
|
197
222
|
// {
|
|
198
223
|
// "action": "snapshot",
|
|
@@ -223,6 +248,29 @@ class bitget extends bitget$1["default"] {
|
|
|
223
248
|
// "ts": 1701842994341
|
|
224
249
|
// }
|
|
225
250
|
//
|
|
251
|
+
// uta
|
|
252
|
+
//
|
|
253
|
+
// {
|
|
254
|
+
// "action": "snapshot",
|
|
255
|
+
// "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
|
|
256
|
+
// "data": [
|
|
257
|
+
// {
|
|
258
|
+
// "highPrice24h": "120255.61",
|
|
259
|
+
// "lowPrice24h": "116145.88",
|
|
260
|
+
// "openPrice24h": "118919.38",
|
|
261
|
+
// "lastPrice": "119818.83",
|
|
262
|
+
// "turnover24h": "215859996.272276",
|
|
263
|
+
// "volume24h": "1819.756798",
|
|
264
|
+
// "bid1Price": "119811.26",
|
|
265
|
+
// "ask1Price": "119831.18",
|
|
266
|
+
// "bid1Size": "0.008732",
|
|
267
|
+
// "ask1Size": "0.004297",
|
|
268
|
+
// "price24hPcnt": "0.02002"
|
|
269
|
+
// }
|
|
270
|
+
// ],
|
|
271
|
+
// "ts": 1753230479687
|
|
272
|
+
// }
|
|
273
|
+
//
|
|
226
274
|
this.handleBidAsk(client, message);
|
|
227
275
|
const ticker = this.parseWsTicker(message);
|
|
228
276
|
const symbol = ticker['symbol'];
|
|
@@ -301,48 +349,75 @@ class bitget extends bitget$1["default"] {
|
|
|
301
349
|
// "ts": 1701843962812
|
|
302
350
|
// }
|
|
303
351
|
//
|
|
352
|
+
// uta
|
|
353
|
+
//
|
|
354
|
+
// {
|
|
355
|
+
// "action": "snapshot",
|
|
356
|
+
// "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
|
|
357
|
+
// "data": [
|
|
358
|
+
// {
|
|
359
|
+
// "highPrice24h": "120255.61",
|
|
360
|
+
// "lowPrice24h": "116145.88",
|
|
361
|
+
// "openPrice24h": "118919.38",
|
|
362
|
+
// "lastPrice": "119818.83",
|
|
363
|
+
// "turnover24h": "215859996.272276",
|
|
364
|
+
// "volume24h": "1819.756798",
|
|
365
|
+
// "bid1Price": "119811.26",
|
|
366
|
+
// "ask1Price": "119831.18",
|
|
367
|
+
// "bid1Size": "0.008732",
|
|
368
|
+
// "ask1Size": "0.004297",
|
|
369
|
+
// "price24hPcnt": "0.02002"
|
|
370
|
+
// }
|
|
371
|
+
// ],
|
|
372
|
+
// "ts": 1753230479687
|
|
373
|
+
// }
|
|
374
|
+
//
|
|
304
375
|
const arg = this.safeValue(message, 'arg', {});
|
|
305
376
|
const data = this.safeValue(message, 'data', []);
|
|
306
377
|
const ticker = this.safeValue(data, 0, {});
|
|
307
|
-
const
|
|
308
|
-
const
|
|
309
|
-
const
|
|
310
|
-
const
|
|
378
|
+
const utaTimestamp = this.safeInteger(message, 'ts');
|
|
379
|
+
const timestamp = this.safeInteger(ticker, 'ts', utaTimestamp);
|
|
380
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
381
|
+
const marketType = (instType === 'spot') ? 'spot' : 'contract';
|
|
382
|
+
const utaMarketId = this.safeString(arg, 'symbol');
|
|
383
|
+
const marketId = this.safeString(ticker, 'instId', utaMarketId);
|
|
311
384
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
312
|
-
const close = this.
|
|
313
|
-
const changeDecimal = this.safeString(ticker, 'change24h');
|
|
314
|
-
const change = Precise["default"].stringMul(changeDecimal, '100');
|
|
385
|
+
const close = this.safeString2(ticker, 'lastPr', 'lastPrice');
|
|
386
|
+
const changeDecimal = this.safeString(ticker, 'change24h', '');
|
|
387
|
+
const change = this.safeString(ticker, 'price24hPcnt', Precise["default"].stringMul(changeDecimal, '100'));
|
|
315
388
|
return this.safeTicker({
|
|
316
389
|
'symbol': market['symbol'],
|
|
317
390
|
'timestamp': timestamp,
|
|
318
391
|
'datetime': this.iso8601(timestamp),
|
|
319
|
-
'high': this.
|
|
320
|
-
'low': this.
|
|
321
|
-
'bid': this.
|
|
322
|
-
'bidVolume': this.
|
|
323
|
-
'ask': this.
|
|
324
|
-
'askVolume': this.
|
|
392
|
+
'high': this.safeString2(ticker, 'high24h', 'highPrice24h'),
|
|
393
|
+
'low': this.safeString2(ticker, 'low24h', 'lowPrice24h'),
|
|
394
|
+
'bid': this.safeString2(ticker, 'bidPr', 'bid1Price'),
|
|
395
|
+
'bidVolume': this.safeString2(ticker, 'bidSz', 'bid1Size'),
|
|
396
|
+
'ask': this.safeString2(ticker, 'askPr', 'ask1Price'),
|
|
397
|
+
'askVolume': this.safeString2(ticker, 'askSz', 'ask1Size'),
|
|
325
398
|
'vwap': undefined,
|
|
326
|
-
'open': this.
|
|
399
|
+
'open': this.safeString2(ticker, 'open24h', 'openPrice24h'),
|
|
327
400
|
'close': close,
|
|
328
401
|
'last': close,
|
|
329
402
|
'previousClose': undefined,
|
|
330
403
|
'change': undefined,
|
|
331
404
|
'percentage': change,
|
|
332
405
|
'average': undefined,
|
|
333
|
-
'baseVolume': this.
|
|
334
|
-
'quoteVolume': this.
|
|
406
|
+
'baseVolume': this.safeString2(ticker, 'baseVolume', 'volume24h'),
|
|
407
|
+
'quoteVolume': this.safeString2(ticker, 'quoteVolume', 'turnover24h'),
|
|
335
408
|
'info': ticker,
|
|
336
409
|
}, market);
|
|
337
410
|
}
|
|
338
411
|
/**
|
|
339
412
|
* @method
|
|
340
413
|
* @name bitget#watchBidsAsks
|
|
414
|
+
* @description watches best bid & ask for symbols
|
|
341
415
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
|
342
416
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
|
343
|
-
* @
|
|
417
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
|
|
344
418
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
345
419
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
420
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
346
421
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
347
422
|
*/
|
|
348
423
|
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
@@ -350,7 +425,9 @@ class bitget extends bitget$1["default"] {
|
|
|
350
425
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
351
426
|
const market = this.market(symbols[0]);
|
|
352
427
|
let instType = undefined;
|
|
353
|
-
|
|
428
|
+
let uta = undefined;
|
|
429
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchBidsAsks', 'uta', false);
|
|
430
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
354
431
|
const topics = [];
|
|
355
432
|
const messageHashes = [];
|
|
356
433
|
for (let i = 0; i < symbols.length; i++) {
|
|
@@ -358,9 +435,11 @@ class bitget extends bitget$1["default"] {
|
|
|
358
435
|
const marketInner = this.market(symbol);
|
|
359
436
|
const args = {
|
|
360
437
|
'instType': instType,
|
|
361
|
-
'channel': 'ticker',
|
|
362
|
-
'instId': marketInner['id'],
|
|
363
438
|
};
|
|
439
|
+
const topicOrChannel = uta ? 'topic' : 'channel';
|
|
440
|
+
const symbolOrInstId = uta ? 'symbol' : 'instId';
|
|
441
|
+
args[topicOrChannel] = 'ticker';
|
|
442
|
+
args[symbolOrInstId] = marketInner['id'];
|
|
364
443
|
topics.push(args);
|
|
365
444
|
messageHashes.push('bidask:' + symbol);
|
|
366
445
|
}
|
|
@@ -383,19 +462,21 @@ class bitget extends bitget$1["default"] {
|
|
|
383
462
|
const arg = this.safeValue(message, 'arg', {});
|
|
384
463
|
const data = this.safeValue(message, 'data', []);
|
|
385
464
|
const ticker = this.safeValue(data, 0, {});
|
|
386
|
-
const
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
const
|
|
465
|
+
const utaTimestamp = this.safeInteger(message, 'ts');
|
|
466
|
+
const timestamp = this.safeInteger(ticker, 'ts', utaTimestamp);
|
|
467
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
468
|
+
const marketType = (instType === 'spot') ? 'spot' : 'contract';
|
|
469
|
+
const utaMarketId = this.safeString(arg, 'symbol');
|
|
470
|
+
const marketId = this.safeString(ticker, 'instId', utaMarketId);
|
|
390
471
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
391
472
|
return this.safeTicker({
|
|
392
473
|
'symbol': market['symbol'],
|
|
393
474
|
'timestamp': timestamp,
|
|
394
475
|
'datetime': this.iso8601(timestamp),
|
|
395
|
-
'ask': this.
|
|
396
|
-
'askVolume': this.
|
|
397
|
-
'bid': this.
|
|
398
|
-
'bidVolume': this.
|
|
476
|
+
'ask': this.safeString2(ticker, 'askPr', 'ask1Price'),
|
|
477
|
+
'askVolume': this.safeString2(ticker, 'askSz', 'ask1Size'),
|
|
478
|
+
'bid': this.safeString2(ticker, 'bidPr', 'bid1Price'),
|
|
479
|
+
'bidVolume': this.safeString2(ticker, 'bidSz', 'bid1Size'),
|
|
399
480
|
'info': ticker,
|
|
400
481
|
}, market);
|
|
401
482
|
}
|
|
@@ -405,11 +486,13 @@ class bitget extends bitget$1["default"] {
|
|
|
405
486
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
406
487
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
407
488
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
489
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
|
408
490
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
409
491
|
* @param {string} timeframe the length of time each candle represents
|
|
410
492
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
411
493
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
412
494
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
495
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
413
496
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
414
497
|
*/
|
|
415
498
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -418,14 +501,26 @@ class bitget extends bitget$1["default"] {
|
|
|
418
501
|
symbol = market['symbol'];
|
|
419
502
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
420
503
|
const interval = this.safeString(timeframes, timeframe);
|
|
421
|
-
|
|
504
|
+
let messageHash = undefined;
|
|
422
505
|
let instType = undefined;
|
|
423
|
-
|
|
506
|
+
let uta = undefined;
|
|
507
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchOHLCV', 'uta', false);
|
|
508
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
424
509
|
const args = {
|
|
425
510
|
'instType': instType,
|
|
426
|
-
'channel': 'candle' + interval,
|
|
427
|
-
'instId': market['id'],
|
|
428
511
|
};
|
|
512
|
+
if (uta) {
|
|
513
|
+
args['topic'] = 'kline';
|
|
514
|
+
args['symbol'] = market['id'];
|
|
515
|
+
args['interval'] = interval;
|
|
516
|
+
params['uta'] = true;
|
|
517
|
+
messageHash = 'kline:' + symbol;
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
args['channel'] = 'candle' + interval;
|
|
521
|
+
args['instId'] = market['id'];
|
|
522
|
+
messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
523
|
+
}
|
|
429
524
|
const ohlcv = await this.watchPublic(messageHash, args, params);
|
|
430
525
|
if (this.newUpdates) {
|
|
431
526
|
limit = ohlcv.getLimit(symbol, limit);
|
|
@@ -438,17 +533,40 @@ class bitget extends bitget$1["default"] {
|
|
|
438
533
|
* @description unsubscribe from the ohlcv channel
|
|
439
534
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
440
535
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
536
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
|
441
537
|
* @param {string} symbol unified symbol of the market to unwatch the ohlcv for
|
|
442
538
|
* @param {string} [timeframe] the period for the ratio, default is 1 minute
|
|
443
539
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
540
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
444
541
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
445
542
|
*/
|
|
446
543
|
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
447
544
|
await this.loadMarkets();
|
|
448
545
|
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
449
546
|
const interval = this.safeString(timeframes, timeframe);
|
|
450
|
-
|
|
451
|
-
|
|
547
|
+
let channel = undefined;
|
|
548
|
+
let market = undefined;
|
|
549
|
+
if (symbol !== undefined) {
|
|
550
|
+
market = this.market(symbol);
|
|
551
|
+
}
|
|
552
|
+
let instType = undefined;
|
|
553
|
+
let messageHash = undefined;
|
|
554
|
+
let uta = undefined;
|
|
555
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchOHLCV', 'uta', false);
|
|
556
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
557
|
+
if (uta) {
|
|
558
|
+
channel = 'kline';
|
|
559
|
+
market['id'];
|
|
560
|
+
params['uta'] = true;
|
|
561
|
+
params['interval'] = interval;
|
|
562
|
+
messageHash = channel + symbol;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
channel = 'candle' + interval;
|
|
566
|
+
market['id'];
|
|
567
|
+
messageHash = 'candles:' + interval;
|
|
568
|
+
}
|
|
569
|
+
return await this.unWatchChannel(symbol, channel, messageHash, params);
|
|
452
570
|
}
|
|
453
571
|
handleOHLCV(client, message) {
|
|
454
572
|
//
|
|
@@ -484,15 +602,47 @@ class bitget extends bitget$1["default"] {
|
|
|
484
602
|
// "ts": 1701901610417
|
|
485
603
|
// }
|
|
486
604
|
//
|
|
605
|
+
// uta
|
|
606
|
+
//
|
|
607
|
+
// {
|
|
608
|
+
// "action": "snapshot",
|
|
609
|
+
// "arg": {
|
|
610
|
+
// "instType": "usdt-futures",
|
|
611
|
+
// "topic": "kline",
|
|
612
|
+
// "symbol": "BTCUSDT",
|
|
613
|
+
// "interval": "1m"
|
|
614
|
+
// },
|
|
615
|
+
// "data": [
|
|
616
|
+
// {
|
|
617
|
+
// "start": "1755564480000",
|
|
618
|
+
// "open": "116286",
|
|
619
|
+
// "close": "116256.2",
|
|
620
|
+
// "high": "116310.2",
|
|
621
|
+
// "low": "116232.8",
|
|
622
|
+
// "volume": "39.7062",
|
|
623
|
+
// "turnover": "4616746.46654"
|
|
624
|
+
// },
|
|
625
|
+
// ],
|
|
626
|
+
// "ts": 1755594421877
|
|
627
|
+
// }
|
|
628
|
+
//
|
|
487
629
|
const arg = this.safeValue(message, 'arg', {});
|
|
488
|
-
const instType = this.
|
|
489
|
-
const marketType = (instType === '
|
|
490
|
-
const marketId = this.
|
|
630
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
631
|
+
const marketType = (instType === 'spot') ? 'spot' : 'contract';
|
|
632
|
+
const marketId = this.safeString2(arg, 'instId', 'symbol');
|
|
491
633
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
492
634
|
const symbol = market['symbol'];
|
|
493
635
|
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
|
494
|
-
const channel = this.
|
|
495
|
-
|
|
636
|
+
const channel = this.safeString2(arg, 'channel', 'topic');
|
|
637
|
+
let interval = this.safeString(arg, 'interval');
|
|
638
|
+
let isUta = undefined;
|
|
639
|
+
if (interval === undefined) {
|
|
640
|
+
isUta = false;
|
|
641
|
+
interval = channel.replace('candle', '');
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
isUta = true;
|
|
645
|
+
}
|
|
496
646
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
497
647
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
498
648
|
let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
|
|
@@ -506,7 +656,13 @@ class bitget extends bitget$1["default"] {
|
|
|
506
656
|
const parsed = this.parseWsOHLCV(data[i], market);
|
|
507
657
|
stored.append(parsed);
|
|
508
658
|
}
|
|
509
|
-
|
|
659
|
+
let messageHash = undefined;
|
|
660
|
+
if (isUta) {
|
|
661
|
+
messageHash = 'kline:' + symbol;
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
665
|
+
}
|
|
510
666
|
client.resolve(stored, messageHash);
|
|
511
667
|
}
|
|
512
668
|
parseWsOHLCV(ohlcv, market = undefined) {
|
|
@@ -522,14 +678,26 @@ class bitget extends bitget$1["default"] {
|
|
|
522
678
|
// "437404.105512" // USDT volume
|
|
523
679
|
// ]
|
|
524
680
|
//
|
|
681
|
+
// uta
|
|
682
|
+
//
|
|
683
|
+
// {
|
|
684
|
+
// "start": "1755564480000",
|
|
685
|
+
// "open": "116286",
|
|
686
|
+
// "close": "116256.2",
|
|
687
|
+
// "high": "116310.2",
|
|
688
|
+
// "low": "116232.8",
|
|
689
|
+
// "volume": "39.7062",
|
|
690
|
+
// "turnover": "4616746.46654"
|
|
691
|
+
// }
|
|
692
|
+
//
|
|
525
693
|
const volumeIndex = (market['inverse']) ? 6 : 5;
|
|
526
694
|
return [
|
|
527
|
-
this.
|
|
528
|
-
this.
|
|
529
|
-
this.
|
|
530
|
-
this.
|
|
531
|
-
this.
|
|
532
|
-
this.
|
|
695
|
+
this.safeInteger2(ohlcv, 'start', 0),
|
|
696
|
+
this.safeNumber2(ohlcv, 'open', 1),
|
|
697
|
+
this.safeNumber2(ohlcv, 'high', 2),
|
|
698
|
+
this.safeNumber2(ohlcv, 'low', 3),
|
|
699
|
+
this.safeNumber2(ohlcv, 'close', 4),
|
|
700
|
+
this.safeNumber2(ohlcv, 'volume', volumeIndex),
|
|
533
701
|
];
|
|
534
702
|
}
|
|
535
703
|
/**
|
|
@@ -572,12 +740,23 @@ class bitget extends bitget$1["default"] {
|
|
|
572
740
|
const market = this.market(symbol);
|
|
573
741
|
const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
|
|
574
742
|
let instType = undefined;
|
|
575
|
-
|
|
743
|
+
let uta = undefined;
|
|
744
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchChannel', 'uta', false);
|
|
745
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
576
746
|
const args = {
|
|
577
747
|
'instType': instType,
|
|
578
|
-
'channel': channel,
|
|
579
|
-
'instId': market['id'],
|
|
580
748
|
};
|
|
749
|
+
if (uta) {
|
|
750
|
+
args['topic'] = channel;
|
|
751
|
+
args['symbol'] = market['id'];
|
|
752
|
+
args['interval'] = this.safeString(params, 'interval', '1m');
|
|
753
|
+
params['uta'] = true;
|
|
754
|
+
params = this.omit(params, 'interval');
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
args['channel'] = channel;
|
|
758
|
+
args['instId'] = market['id'];
|
|
759
|
+
}
|
|
581
760
|
return await this.unWatchPublic(messageHash, args, params);
|
|
582
761
|
}
|
|
583
762
|
/**
|
|
@@ -606,7 +785,7 @@ class bitget extends bitget$1["default"] {
|
|
|
606
785
|
const symbol = symbols[i];
|
|
607
786
|
const market = this.market(symbol);
|
|
608
787
|
let instType = undefined;
|
|
609
|
-
[instType, params] = this.getInstType(market, params);
|
|
788
|
+
[instType, params] = this.getInstType(market, false, params);
|
|
610
789
|
const args = {
|
|
611
790
|
'instType': instType,
|
|
612
791
|
'channel': channel,
|
|
@@ -777,7 +956,7 @@ class bitget extends bitget$1["default"] {
|
|
|
777
956
|
const symbol = symbols[i];
|
|
778
957
|
const market = this.market(symbol);
|
|
779
958
|
let instType = undefined;
|
|
780
|
-
[instType, params] = this.getInstType(market, params);
|
|
959
|
+
[instType, params] = this.getInstType(market, false, params);
|
|
781
960
|
const args = {
|
|
782
961
|
'instType': instType,
|
|
783
962
|
'channel': 'trade',
|
|
@@ -968,7 +1147,7 @@ class bitget extends bitget$1["default"] {
|
|
|
968
1147
|
symbols = this.marketSymbols(symbols);
|
|
969
1148
|
if (!this.isEmpty(symbols)) {
|
|
970
1149
|
market = this.getMarketFromSymbols(symbols);
|
|
971
|
-
[instType, params] = this.getInstType(market, params);
|
|
1150
|
+
[instType, params] = this.getInstType(market, false, params);
|
|
972
1151
|
}
|
|
973
1152
|
messageHash = instType + ':positions' + messageHash;
|
|
974
1153
|
const args = {
|
|
@@ -1178,7 +1357,7 @@ class bitget extends bitget$1["default"] {
|
|
|
1178
1357
|
instType = 'SPOT';
|
|
1179
1358
|
}
|
|
1180
1359
|
else {
|
|
1181
|
-
[instType, params] = this.getInstType(market, params);
|
|
1360
|
+
[instType, params] = this.getInstType(market, false, params);
|
|
1182
1361
|
}
|
|
1183
1362
|
if (type === 'spot' && (symbol !== undefined)) {
|
|
1184
1363
|
subscriptionHash = subscriptionHash + ':' + symbol;
|
|
@@ -1562,7 +1741,7 @@ class bitget extends bitget$1["default"] {
|
|
|
1562
1741
|
instType = 'spot';
|
|
1563
1742
|
}
|
|
1564
1743
|
else {
|
|
1565
|
-
[instType, params] = this.getInstType(market, params);
|
|
1744
|
+
[instType, params] = this.getInstType(market, false, params);
|
|
1566
1745
|
}
|
|
1567
1746
|
const subscriptionHash = 'fill:' + instType;
|
|
1568
1747
|
const args = {
|
|
@@ -1794,12 +1973,25 @@ class bitget extends bitget$1["default"] {
|
|
|
1794
1973
|
client.resolve(this.balance, messageHash);
|
|
1795
1974
|
}
|
|
1796
1975
|
async watchPublic(messageHash, args, params = {}) {
|
|
1797
|
-
let
|
|
1976
|
+
let uta = undefined;
|
|
1977
|
+
let url = undefined;
|
|
1978
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchPublic', 'uta', false);
|
|
1979
|
+
if (uta) {
|
|
1980
|
+
url = this.urls['api']['ws']['utaPublic'];
|
|
1981
|
+
}
|
|
1982
|
+
else {
|
|
1983
|
+
url = this.urls['api']['ws']['public'];
|
|
1984
|
+
}
|
|
1798
1985
|
const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
|
|
1799
1986
|
if (sandboxMode) {
|
|
1800
1987
|
const instType = this.safeString(args, 'instType');
|
|
1801
1988
|
if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
|
|
1802
|
-
|
|
1989
|
+
if (uta) {
|
|
1990
|
+
url = this.urls['api']['demo']['utaPublic'];
|
|
1991
|
+
}
|
|
1992
|
+
else {
|
|
1993
|
+
url = this.urls['api']['demo']['public'];
|
|
1994
|
+
}
|
|
1803
1995
|
}
|
|
1804
1996
|
}
|
|
1805
1997
|
const request = {
|
|
@@ -1810,12 +2002,25 @@ class bitget extends bitget$1["default"] {
|
|
|
1810
2002
|
return await this.watch(url, messageHash, message, messageHash);
|
|
1811
2003
|
}
|
|
1812
2004
|
async unWatchPublic(messageHash, args, params = {}) {
|
|
1813
|
-
let
|
|
2005
|
+
let uta = undefined;
|
|
2006
|
+
let url = undefined;
|
|
2007
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchPublic', 'uta', false);
|
|
2008
|
+
if (uta) {
|
|
2009
|
+
url = this.urls['api']['ws']['utaPublic'];
|
|
2010
|
+
}
|
|
2011
|
+
else {
|
|
2012
|
+
url = this.urls['api']['ws']['public'];
|
|
2013
|
+
}
|
|
1814
2014
|
const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
|
|
1815
2015
|
if (sandboxMode) {
|
|
1816
2016
|
const instType = this.safeString(args, 'instType');
|
|
1817
2017
|
if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
|
|
1818
|
-
|
|
2018
|
+
if (uta) {
|
|
2019
|
+
url = this.urls['api']['demo']['utaPublic'];
|
|
2020
|
+
}
|
|
2021
|
+
else {
|
|
2022
|
+
url = this.urls['api']['demo']['public'];
|
|
2023
|
+
}
|
|
1819
2024
|
}
|
|
1820
2025
|
}
|
|
1821
2026
|
const request = {
|
|
@@ -1826,13 +2031,26 @@ class bitget extends bitget$1["default"] {
|
|
|
1826
2031
|
return await this.watch(url, messageHash, message, messageHash);
|
|
1827
2032
|
}
|
|
1828
2033
|
async watchPublicMultiple(messageHashes, argsArray, params = {}) {
|
|
1829
|
-
let
|
|
2034
|
+
let uta = undefined;
|
|
2035
|
+
let url = undefined;
|
|
2036
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchPublicMultiple', 'uta', false);
|
|
2037
|
+
if (uta) {
|
|
2038
|
+
url = this.urls['api']['ws']['utaPublic'];
|
|
2039
|
+
}
|
|
2040
|
+
else {
|
|
2041
|
+
url = this.urls['api']['ws']['public'];
|
|
2042
|
+
}
|
|
1830
2043
|
const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
|
|
1831
2044
|
if (sandboxMode) {
|
|
1832
2045
|
const argsArrayFirst = this.safeDict(argsArray, 0, {});
|
|
1833
2046
|
const instType = this.safeString(argsArrayFirst, 'instType');
|
|
1834
2047
|
if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
|
|
1835
|
-
|
|
2048
|
+
if (uta) {
|
|
2049
|
+
url = this.urls['api']['demo']['utaPublic'];
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
url = this.urls['api']['demo']['public'];
|
|
2053
|
+
}
|
|
1836
2054
|
}
|
|
1837
2055
|
}
|
|
1838
2056
|
const request = {
|
|
@@ -1972,6 +2190,41 @@ class bitget extends bitget$1["default"] {
|
|
|
1972
2190
|
// ]
|
|
1973
2191
|
// }
|
|
1974
2192
|
//
|
|
2193
|
+
// uta
|
|
2194
|
+
//
|
|
2195
|
+
// {
|
|
2196
|
+
// "action": "snapshot",
|
|
2197
|
+
// "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
|
|
2198
|
+
// "data": [
|
|
2199
|
+
// {
|
|
2200
|
+
// "highPrice24h": "120255.61",
|
|
2201
|
+
// "lowPrice24h": "116145.88",
|
|
2202
|
+
// "openPrice24h": "118919.38",
|
|
2203
|
+
// "lastPrice": "119818.83",
|
|
2204
|
+
// "turnover24h": "215859996.272276",
|
|
2205
|
+
// "volume24h": "1819.756798",
|
|
2206
|
+
// "bid1Price": "119811.26",
|
|
2207
|
+
// "ask1Price": "119831.18",
|
|
2208
|
+
// "bid1Size": "0.008732",
|
|
2209
|
+
// "ask1Size": "0.004297",
|
|
2210
|
+
// "price24hPcnt": "0.02002"
|
|
2211
|
+
// }
|
|
2212
|
+
// ],
|
|
2213
|
+
// "ts": 1753230479687
|
|
2214
|
+
// }
|
|
2215
|
+
//
|
|
2216
|
+
// unsubscribe
|
|
2217
|
+
//
|
|
2218
|
+
// {
|
|
2219
|
+
// "event": "unsubscribe",
|
|
2220
|
+
// "arg": {
|
|
2221
|
+
// "instType": "spot",
|
|
2222
|
+
// "topic": "kline",
|
|
2223
|
+
// "symbol": "BTCUSDT",
|
|
2224
|
+
// "interval": "1m"
|
|
2225
|
+
// }
|
|
2226
|
+
// }
|
|
2227
|
+
//
|
|
1975
2228
|
if (this.handleErrorMessage(client, message)) {
|
|
1976
2229
|
return;
|
|
1977
2230
|
}
|
|
@@ -2010,9 +2263,10 @@ class bitget extends bitget$1["default"] {
|
|
|
2010
2263
|
'positions': this.handlePositions,
|
|
2011
2264
|
'account-isolated': this.handleBalance,
|
|
2012
2265
|
'account-crossed': this.handleBalance,
|
|
2266
|
+
'kline': this.handleOHLCV,
|
|
2013
2267
|
};
|
|
2014
2268
|
const arg = this.safeValue(message, 'arg', {});
|
|
2015
|
-
const topic = this.
|
|
2269
|
+
const topic = this.safeValue2(arg, 'channel', 'topic', '');
|
|
2016
2270
|
const method = this.safeValue(methods, topic);
|
|
2017
2271
|
if (method !== undefined) {
|
|
2018
2272
|
method.call(this, client, message);
|
|
@@ -2097,7 +2351,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2097
2351
|
const arg = this.safeDict(message, 'arg', {});
|
|
2098
2352
|
const instType = this.safeStringLower(arg, 'instType');
|
|
2099
2353
|
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2100
|
-
const instId = this.
|
|
2354
|
+
const instId = this.safeString2(arg, 'instId', 'symbol');
|
|
2101
2355
|
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2102
2356
|
const symbol = market['symbol'];
|
|
2103
2357
|
const messageHash = 'unsubscribe:ticker:' + market['symbol'];
|
|
@@ -2119,18 +2373,38 @@ class bitget extends bitget$1["default"] {
|
|
|
2119
2373
|
//
|
|
2120
2374
|
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
|
2121
2375
|
//
|
|
2376
|
+
// UTA
|
|
2377
|
+
//
|
|
2378
|
+
// {"event":"unsubscribe","arg":{"instType":"spot","topic":"kline","symbol":"BTCUSDT","interval":"1m"}}
|
|
2379
|
+
//
|
|
2122
2380
|
const arg = this.safeDict(message, 'arg', {});
|
|
2123
2381
|
const instType = this.safeStringLower(arg, 'instType');
|
|
2124
2382
|
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2125
|
-
const instId = this.
|
|
2126
|
-
const channel = this.
|
|
2127
|
-
|
|
2383
|
+
const instId = this.safeString2(arg, 'instId', 'symbol');
|
|
2384
|
+
const channel = this.safeString2(arg, 'channel', 'topic');
|
|
2385
|
+
let interval = this.safeString(arg, 'interval');
|
|
2386
|
+
let isUta = undefined;
|
|
2387
|
+
if (interval === undefined) {
|
|
2388
|
+
isUta = false;
|
|
2389
|
+
interval = channel.replace('candle', '');
|
|
2390
|
+
}
|
|
2391
|
+
else {
|
|
2392
|
+
isUta = true;
|
|
2393
|
+
}
|
|
2128
2394
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
2129
2395
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
2130
2396
|
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2131
2397
|
const symbol = market['symbol'];
|
|
2132
|
-
|
|
2133
|
-
|
|
2398
|
+
let messageHash = undefined;
|
|
2399
|
+
let subMessageHash = undefined;
|
|
2400
|
+
if (isUta) {
|
|
2401
|
+
messageHash = 'unsubscribe:kline:' + symbol;
|
|
2402
|
+
subMessageHash = 'kline:' + symbol;
|
|
2403
|
+
}
|
|
2404
|
+
else {
|
|
2405
|
+
messageHash = 'unsubscribe:candles:' + timeframe + ':' + symbol;
|
|
2406
|
+
subMessageHash = 'candles:' + timeframe + ':' + symbol;
|
|
2407
|
+
}
|
|
2134
2408
|
if (symbol in this.ohlcvs) {
|
|
2135
2409
|
if (timeframe in this.ohlcvs[symbol]) {
|
|
2136
2410
|
delete this.ohlcvs[symbol][timeframe];
|
|
@@ -2164,7 +2438,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2164
2438
|
}
|
|
2165
2439
|
for (let i = 0; i < argsList.length; i++) {
|
|
2166
2440
|
const arg = argsList[i];
|
|
2167
|
-
const channel = this.
|
|
2441
|
+
const channel = this.safeString2(arg, 'channel', 'topic');
|
|
2168
2442
|
if (channel === 'books') {
|
|
2169
2443
|
// for now only unWatchOrderBook is supporteod
|
|
2170
2444
|
this.handleOrderBookUnSubscription(client, message);
|
|
@@ -2178,6 +2452,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2178
2452
|
else if (channel.startsWith('candle')) {
|
|
2179
2453
|
this.handleOHLCVUnSubscription(client, message);
|
|
2180
2454
|
}
|
|
2455
|
+
else if (channel.startsWith('kline')) {
|
|
2456
|
+
this.handleOHLCVUnSubscription(client, message);
|
|
2457
|
+
}
|
|
2181
2458
|
}
|
|
2182
2459
|
return message;
|
|
2183
2460
|
}
|