ccxt 4.5.1 → 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 +3 -3
- package/dist/cjs/ccxt.js +1 -9
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/binance.js +20 -14
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/indodax.js +11 -12
- package/dist/cjs/src/okx.js +2 -2
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/bitget.js +161 -26
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/gemini.js +7 -2
- package/dist/cjs/src/pro/hyperliquid.js +5 -0
- package/dist/cjs/src/pro/kraken.js +4 -6
- 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/binance.d.ts +1 -1
- package/js/src/binance.js +20 -14
- package/js/src/bitget.js +1 -1
- package/js/src/indodax.js +11 -12
- package/js/src/okx.js +2 -2
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/bitget.d.ts +4 -0
- package/js/src/pro/bitget.js +167 -26
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/gemini.d.ts +1 -1
- package/js/src/pro/gemini.js +7 -2
- package/js/src/pro/hyperliquid.js +5 -0
- package/js/src/pro/kraken.js +4 -6
- 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
package/dist/cjs/ccxt.js
CHANGED
|
@@ -65,7 +65,6 @@ var delta = require('./src/delta.js');
|
|
|
65
65
|
var deribit = require('./src/deribit.js');
|
|
66
66
|
var derive = require('./src/derive.js');
|
|
67
67
|
var digifinex = require('./src/digifinex.js');
|
|
68
|
-
var ellipx = require('./src/ellipx.js');
|
|
69
68
|
var exmo = require('./src/exmo.js');
|
|
70
69
|
var fmfwio = require('./src/fmfwio.js');
|
|
71
70
|
var foxbit = require('./src/foxbit.js');
|
|
@@ -110,7 +109,6 @@ var timex = require('./src/timex.js');
|
|
|
110
109
|
var tokocrypto = require('./src/tokocrypto.js');
|
|
111
110
|
var tradeogre = require('./src/tradeogre.js');
|
|
112
111
|
var upbit = require('./src/upbit.js');
|
|
113
|
-
var vertex = require('./src/vertex.js');
|
|
114
112
|
var wavesexchange = require('./src/wavesexchange.js');
|
|
115
113
|
var whitebit = require('./src/whitebit.js');
|
|
116
114
|
var woo = require('./src/woo.js');
|
|
@@ -187,7 +185,6 @@ var poloniex$1 = require('./src/pro/poloniex.js');
|
|
|
187
185
|
var probit$1 = require('./src/pro/probit.js');
|
|
188
186
|
var tradeogre$1 = require('./src/pro/tradeogre.js');
|
|
189
187
|
var upbit$1 = require('./src/pro/upbit.js');
|
|
190
|
-
var vertex$1 = require('./src/pro/vertex.js');
|
|
191
188
|
var whitebit$1 = require('./src/pro/whitebit.js');
|
|
192
189
|
var woo$1 = require('./src/pro/woo.js');
|
|
193
190
|
var woofipro$1 = require('./src/pro/woofipro.js');
|
|
@@ -195,7 +192,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
195
192
|
|
|
196
193
|
//-----------------------------------------------------------------------------
|
|
197
194
|
// this is updated by vss.js when building
|
|
198
|
-
const version = '4.5.
|
|
195
|
+
const version = '4.5.2';
|
|
199
196
|
Exchange["default"].ccxtVersion = version;
|
|
200
197
|
const exchanges = {
|
|
201
198
|
'alpaca': alpaca["default"],
|
|
@@ -251,7 +248,6 @@ const exchanges = {
|
|
|
251
248
|
'deribit': deribit["default"],
|
|
252
249
|
'derive': derive["default"],
|
|
253
250
|
'digifinex': digifinex["default"],
|
|
254
|
-
'ellipx': ellipx["default"],
|
|
255
251
|
'exmo': exmo["default"],
|
|
256
252
|
'fmfwio': fmfwio["default"],
|
|
257
253
|
'foxbit': foxbit["default"],
|
|
@@ -296,7 +292,6 @@ const exchanges = {
|
|
|
296
292
|
'tokocrypto': tokocrypto["default"],
|
|
297
293
|
'tradeogre': tradeogre["default"],
|
|
298
294
|
'upbit': upbit["default"],
|
|
299
|
-
'vertex': vertex["default"],
|
|
300
295
|
'wavesexchange': wavesexchange["default"],
|
|
301
296
|
'whitebit': whitebit["default"],
|
|
302
297
|
'woo': woo["default"],
|
|
@@ -375,7 +370,6 @@ const pro = {
|
|
|
375
370
|
'probit': probit$1["default"],
|
|
376
371
|
'tradeogre': tradeogre$1["default"],
|
|
377
372
|
'upbit': upbit$1["default"],
|
|
378
|
-
'vertex': vertex$1["default"],
|
|
379
373
|
'whitebit': whitebit$1["default"],
|
|
380
374
|
'woo': woo$1["default"],
|
|
381
375
|
'woofipro': woofipro$1["default"],
|
|
@@ -485,7 +479,6 @@ exports.delta = delta["default"];
|
|
|
485
479
|
exports.deribit = deribit["default"];
|
|
486
480
|
exports.derive = derive["default"];
|
|
487
481
|
exports.digifinex = digifinex["default"];
|
|
488
|
-
exports.ellipx = ellipx["default"];
|
|
489
482
|
exports.exmo = exmo["default"];
|
|
490
483
|
exports.fmfwio = fmfwio["default"];
|
|
491
484
|
exports.foxbit = foxbit["default"];
|
|
@@ -530,7 +523,6 @@ exports.timex = timex["default"];
|
|
|
530
523
|
exports.tokocrypto = tokocrypto["default"];
|
|
531
524
|
exports.tradeogre = tradeogre["default"];
|
|
532
525
|
exports.upbit = upbit["default"];
|
|
533
|
-
exports.vertex = vertex["default"];
|
|
534
526
|
exports.wavesexchange = wavesexchange["default"];
|
|
535
527
|
exports.whitebit = whitebit["default"];
|
|
536
528
|
exports.woo = woo["default"];
|
package/dist/cjs/src/ascendex.js
CHANGED
|
@@ -1631,7 +1631,7 @@ class ascendex extends ascendex$1["default"] {
|
|
|
1631
1631
|
// "code": "0",
|
|
1632
1632
|
// "data": {
|
|
1633
1633
|
// "domain": "spot",
|
|
1634
|
-
// "userUID": "
|
|
1634
|
+
// "userUID": "U1479576457",
|
|
1635
1635
|
// "vipLevel": "0",
|
|
1636
1636
|
// "fees": [
|
|
1637
1637
|
// { symbol: 'HT/USDT', fee: { taker: '0.001', maker: "0.001" } },
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -1287,6 +1287,7 @@ class binance extends binance$1["default"] {
|
|
|
1287
1287
|
'defaultSubType': undefined,
|
|
1288
1288
|
'hasAlreadyAuthenticatedSuccessfully': false,
|
|
1289
1289
|
'warnOnFetchOpenOrdersWithoutSymbol': true,
|
|
1290
|
+
'currencyToPrecisionRoundingMode': number.TRUNCATE,
|
|
1290
1291
|
// not an error
|
|
1291
1292
|
// https://github.com/ccxt/ccxt/issues/11268
|
|
1292
1293
|
// https://github.com/ccxt/ccxt/pull/11624
|
|
@@ -2754,15 +2755,6 @@ class binance extends binance$1["default"] {
|
|
|
2754
2755
|
costToPrecision(symbol, cost) {
|
|
2755
2756
|
return this.decimalToPrecision(cost, number.TRUNCATE, this.markets[symbol]['precision']['quote'], this.precisionMode, this.paddingMode);
|
|
2756
2757
|
}
|
|
2757
|
-
currencyToPrecision(code, fee, networkCode = undefined) {
|
|
2758
|
-
// info is available in currencies only if the user has configured his api keys
|
|
2759
|
-
if (this.safeValue(this.currencies[code], 'precision') !== undefined) {
|
|
2760
|
-
return this.decimalToPrecision(fee, number.TRUNCATE, this.currencies[code]['precision'], this.precisionMode, this.paddingMode);
|
|
2761
|
-
}
|
|
2762
|
-
else {
|
|
2763
|
-
return this.numberToString(fee);
|
|
2764
|
-
}
|
|
2765
|
-
}
|
|
2766
2758
|
nonce() {
|
|
2767
2759
|
return this.milliseconds() - this.options['timeDifference'];
|
|
2768
2760
|
}
|
|
@@ -7829,6 +7821,7 @@ class binance extends binance$1["default"] {
|
|
|
7829
7821
|
* @param {string[]} ids order ids
|
|
7830
7822
|
* @param {string} [symbol] unified market symbol
|
|
7831
7823
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7824
|
+
* @param {string[]} [params.clientOrderIds] alternative to ids, array of client order ids
|
|
7832
7825
|
*
|
|
7833
7826
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
7834
7827
|
* @param {string[]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
|
|
@@ -7846,8 +7839,16 @@ class binance extends binance$1["default"] {
|
|
|
7846
7839
|
}
|
|
7847
7840
|
const request = {
|
|
7848
7841
|
'symbol': market['id'],
|
|
7849
|
-
'orderidlist': ids,
|
|
7842
|
+
// 'orderidlist': ids,
|
|
7850
7843
|
};
|
|
7844
|
+
const origClientOrderIdList = this.safeList2(params, 'origClientOrderIdList', 'clientOrderIds');
|
|
7845
|
+
if (origClientOrderIdList !== undefined) {
|
|
7846
|
+
params = this.omit(params, ['clientOrderIds']);
|
|
7847
|
+
request['origClientOrderIdList'] = origClientOrderIdList;
|
|
7848
|
+
}
|
|
7849
|
+
else {
|
|
7850
|
+
request['orderidlist'] = ids;
|
|
7851
|
+
}
|
|
7851
7852
|
let response = undefined;
|
|
7852
7853
|
if (market['linear']) {
|
|
7853
7854
|
response = await this.fapiPrivateDeleteBatchOrders(this.extend(request, params));
|
|
@@ -9433,7 +9434,6 @@ class binance extends binance$1["default"] {
|
|
|
9433
9434
|
const request = {
|
|
9434
9435
|
'coin': currency['id'],
|
|
9435
9436
|
'address': address,
|
|
9436
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
9437
9437
|
// issue sapiGetCapitalConfigGetall () to get networks for withdrawing USDT ERC20 vs USDT Omni
|
|
9438
9438
|
// 'network': 'ETH', // 'BTC', 'TRX', etc, optional
|
|
9439
9439
|
};
|
|
@@ -9447,6 +9447,7 @@ class binance extends binance$1["default"] {
|
|
|
9447
9447
|
request['network'] = network;
|
|
9448
9448
|
params = this.omit(params, 'network');
|
|
9449
9449
|
}
|
|
9450
|
+
request['amount'] = this.currencyToPrecision(code, amount, network);
|
|
9450
9451
|
const response = await this.sapiPostCapitalWithdrawApply(this.extend(request, params));
|
|
9451
9452
|
// { id: '9a67628b16ba4988ae20d329333f16bc' }
|
|
9452
9453
|
return this.parseTransaction(response, currency);
|
|
@@ -12063,8 +12064,8 @@ class binance extends binance$1["default"] {
|
|
|
12063
12064
|
else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0) || (path.indexOf('simple-earn') >= 0)) {
|
|
12064
12065
|
if ((method === 'DELETE') && (path === 'batchOrders')) {
|
|
12065
12066
|
const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
|
|
12066
|
-
const origclientorderidlist = this.
|
|
12067
|
-
extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist']);
|
|
12067
|
+
const origclientorderidlist = this.safeList2(extendedParams, 'origclientorderidlist', 'origClientOrderIdList', []);
|
|
12068
|
+
extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist', 'origClientOrderIdList']);
|
|
12068
12069
|
query = this.rawencode(extendedParams);
|
|
12069
12070
|
const orderidlistLength = orderidlist.length;
|
|
12070
12071
|
const origclientorderidlistLength = origclientorderidlist.length;
|
|
@@ -12072,7 +12073,12 @@ class binance extends binance$1["default"] {
|
|
|
12072
12073
|
query = query + '&' + 'orderidlist=%5B' + orderidlist.join('%2C') + '%5D';
|
|
12073
12074
|
}
|
|
12074
12075
|
if (origclientorderidlistLength > 0) {
|
|
12075
|
-
|
|
12076
|
+
// wrap clientOrderids around ""
|
|
12077
|
+
const newClientOrderIds = [];
|
|
12078
|
+
for (let i = 0; i < origclientorderidlistLength; i++) {
|
|
12079
|
+
newClientOrderIds.push('%22' + origclientorderidlist[i] + '%22');
|
|
12080
|
+
}
|
|
12081
|
+
query = query + '&' + 'origclientorderidlist=%5B' + newClientOrderIds.join('%2C') + '%5D';
|
|
12076
12082
|
}
|
|
12077
12083
|
}
|
|
12078
12084
|
else {
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1918,7 +1918,7 @@ class bitget extends bitget$1["default"] {
|
|
|
1918
1918
|
const res = this.safeDict(results, i);
|
|
1919
1919
|
const data = this.safeList(res, 'data', []);
|
|
1920
1920
|
const firstData = this.safeDict(data, 0, {});
|
|
1921
|
-
const isBorrowable = this.
|
|
1921
|
+
const isBorrowable = this.safeBool(firstData, 'isBorrowable');
|
|
1922
1922
|
if (fetchMargins && isBorrowable !== undefined) {
|
|
1923
1923
|
const keysList = Object.keys(this.indexBy(data, 'symbol'));
|
|
1924
1924
|
this.options['crossMarginPairsData'] = keysList;
|
package/dist/cjs/src/indodax.js
CHANGED
|
@@ -197,6 +197,16 @@ class indodax extends indodax$1["default"] {
|
|
|
197
197
|
'Minimum order': errors.InvalidOrder,
|
|
198
198
|
},
|
|
199
199
|
},
|
|
200
|
+
'timeframes': {
|
|
201
|
+
'1m': '1',
|
|
202
|
+
'15m': '15',
|
|
203
|
+
'30m': '30',
|
|
204
|
+
'1h': '60',
|
|
205
|
+
'4h': '240',
|
|
206
|
+
'1d': '1D',
|
|
207
|
+
'3d': '3D',
|
|
208
|
+
'1w': '1W',
|
|
209
|
+
},
|
|
200
210
|
// exchange-specific options
|
|
201
211
|
'options': {
|
|
202
212
|
'recvWindow': 5 * 1000,
|
|
@@ -220,16 +230,6 @@ class indodax extends indodax$1["default"] {
|
|
|
220
230
|
// 'ETH': 'eth'
|
|
221
231
|
// 'BASE': 'base'
|
|
222
232
|
},
|
|
223
|
-
'timeframes': {
|
|
224
|
-
'1m': '1',
|
|
225
|
-
'15m': '15',
|
|
226
|
-
'30m': '30',
|
|
227
|
-
'1h': '60',
|
|
228
|
-
'4h': '240',
|
|
229
|
-
'1d': '1D',
|
|
230
|
-
'3d': '3D',
|
|
231
|
-
'1w': '1W',
|
|
232
|
-
},
|
|
233
233
|
},
|
|
234
234
|
'features': {
|
|
235
235
|
'spot': {
|
|
@@ -687,8 +687,7 @@ class indodax extends indodax$1["default"] {
|
|
|
687
687
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
688
688
|
await this.loadMarkets();
|
|
689
689
|
const market = this.market(symbol);
|
|
690
|
-
const
|
|
691
|
-
const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
690
|
+
const selectedTimeframe = this.safeString(this.timeframes, timeframe, timeframe);
|
|
692
691
|
const now = this.seconds();
|
|
693
692
|
const until = this.safeInteger(params, 'until', now);
|
|
694
693
|
params = this.omit(params, ['until']);
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1219,7 +1219,7 @@ class okx extends okx$1["default"] {
|
|
|
1219
1219
|
'FUTURES': 'FUTURES',
|
|
1220
1220
|
'OPTION': 'OPTION',
|
|
1221
1221
|
},
|
|
1222
|
-
'brokerId': '
|
|
1222
|
+
'brokerId': '6b9ad766b55dBCDE',
|
|
1223
1223
|
},
|
|
1224
1224
|
'features': {
|
|
1225
1225
|
'default': {
|
|
@@ -6315,7 +6315,7 @@ class okx extends okx$1["default"] {
|
|
|
6315
6315
|
this.checkRequiredCredentials();
|
|
6316
6316
|
// inject id in implicit api call
|
|
6317
6317
|
if (method === 'POST' && (path === 'trade/batch-orders' || path === 'trade/order-algo' || path === 'trade/order')) {
|
|
6318
|
-
const brokerId = this.safeString(this.options, 'brokerId', '
|
|
6318
|
+
const brokerId = this.safeString(this.options, 'brokerId', '6b9ad766b55dBCDE');
|
|
6319
6319
|
if (Array.isArray(params)) {
|
|
6320
6320
|
for (let i = 0; i < params.length; i++) {
|
|
6321
6321
|
const entry = params[i];
|
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -2647,7 +2647,7 @@ class poloniex extends poloniex$1["default"] {
|
|
|
2647
2647
|
// "scale" : "-1",
|
|
2648
2648
|
// "asks" : [ "23139.82", "0.317981", "23140", "0.191091", "23170.06", "0.01", "23200", "0.107758", "23230.55", "0.01", "23247.2", "0.154", "23254", "0.005121", "23263", "0.038", "23285.4", "0.308", "23300", "0.108896" ],
|
|
2649
2649
|
// "bids" : [ "23139.74", "0.432092", "23139.73", "0.198592", "23123.21", "0.000886", "23123.2", "0.308", "23121.4", "0.154", "23105", "0.000789", "23100", "0.078175", "23069.1", "0.026276", "23068.83", "0.001329", "23051", "0.000048" ],
|
|
2650
|
-
// "ts" :
|
|
2650
|
+
// "ts" : 1659695219512
|
|
2651
2651
|
// }
|
|
2652
2652
|
//
|
|
2653
2653
|
const timestamp = this.safeInteger(response, 'time');
|
|
@@ -63,6 +63,7 @@ class bitget extends bitget$1["default"] {
|
|
|
63
63
|
// WS timeframes differ from REST timeframes
|
|
64
64
|
'timeframes': {
|
|
65
65
|
'1m': '1m',
|
|
66
|
+
'3m': '3m',
|
|
66
67
|
'5m': '5m',
|
|
67
68
|
'15m': '15m',
|
|
68
69
|
'30m': '30m',
|
|
@@ -485,11 +486,13 @@ class bitget extends bitget$1["default"] {
|
|
|
485
486
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
486
487
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
487
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
|
|
488
490
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
489
491
|
* @param {string} timeframe the length of time each candle represents
|
|
490
492
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
491
493
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
492
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
|
|
493
496
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
494
497
|
*/
|
|
495
498
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -498,14 +501,26 @@ class bitget extends bitget$1["default"] {
|
|
|
498
501
|
symbol = market['symbol'];
|
|
499
502
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
500
503
|
const interval = this.safeString(timeframes, timeframe);
|
|
501
|
-
|
|
504
|
+
let messageHash = undefined;
|
|
502
505
|
let instType = undefined;
|
|
503
|
-
|
|
506
|
+
let uta = undefined;
|
|
507
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchOHLCV', 'uta', false);
|
|
508
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
504
509
|
const args = {
|
|
505
510
|
'instType': instType,
|
|
506
|
-
'channel': 'candle' + interval,
|
|
507
|
-
'instId': market['id'],
|
|
508
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
|
+
}
|
|
509
524
|
const ohlcv = await this.watchPublic(messageHash, args, params);
|
|
510
525
|
if (this.newUpdates) {
|
|
511
526
|
limit = ohlcv.getLimit(symbol, limit);
|
|
@@ -518,17 +533,40 @@ class bitget extends bitget$1["default"] {
|
|
|
518
533
|
* @description unsubscribe from the ohlcv channel
|
|
519
534
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
520
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
|
|
521
537
|
* @param {string} symbol unified symbol of the market to unwatch the ohlcv for
|
|
522
538
|
* @param {string} [timeframe] the period for the ratio, default is 1 minute
|
|
523
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
|
|
524
541
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
525
542
|
*/
|
|
526
543
|
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
527
544
|
await this.loadMarkets();
|
|
528
545
|
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
529
546
|
const interval = this.safeString(timeframes, timeframe);
|
|
530
|
-
|
|
531
|
-
|
|
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);
|
|
532
570
|
}
|
|
533
571
|
handleOHLCV(client, message) {
|
|
534
572
|
//
|
|
@@ -564,15 +602,47 @@ class bitget extends bitget$1["default"] {
|
|
|
564
602
|
// "ts": 1701901610417
|
|
565
603
|
// }
|
|
566
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
|
+
//
|
|
567
629
|
const arg = this.safeValue(message, 'arg', {});
|
|
568
|
-
const instType = this.
|
|
569
|
-
const marketType = (instType === '
|
|
570
|
-
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');
|
|
571
633
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
572
634
|
const symbol = market['symbol'];
|
|
573
635
|
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
|
574
|
-
const channel = this.
|
|
575
|
-
|
|
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
|
+
}
|
|
576
646
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
577
647
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
578
648
|
let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
|
|
@@ -586,7 +656,13 @@ class bitget extends bitget$1["default"] {
|
|
|
586
656
|
const parsed = this.parseWsOHLCV(data[i], market);
|
|
587
657
|
stored.append(parsed);
|
|
588
658
|
}
|
|
589
|
-
|
|
659
|
+
let messageHash = undefined;
|
|
660
|
+
if (isUta) {
|
|
661
|
+
messageHash = 'kline:' + symbol;
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
665
|
+
}
|
|
590
666
|
client.resolve(stored, messageHash);
|
|
591
667
|
}
|
|
592
668
|
parseWsOHLCV(ohlcv, market = undefined) {
|
|
@@ -602,14 +678,26 @@ class bitget extends bitget$1["default"] {
|
|
|
602
678
|
// "437404.105512" // USDT volume
|
|
603
679
|
// ]
|
|
604
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
|
+
//
|
|
605
693
|
const volumeIndex = (market['inverse']) ? 6 : 5;
|
|
606
694
|
return [
|
|
607
|
-
this.
|
|
608
|
-
this.
|
|
609
|
-
this.
|
|
610
|
-
this.
|
|
611
|
-
this.
|
|
612
|
-
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),
|
|
613
701
|
];
|
|
614
702
|
}
|
|
615
703
|
/**
|
|
@@ -652,12 +740,23 @@ class bitget extends bitget$1["default"] {
|
|
|
652
740
|
const market = this.market(symbol);
|
|
653
741
|
const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
|
|
654
742
|
let instType = undefined;
|
|
655
|
-
|
|
743
|
+
let uta = undefined;
|
|
744
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchChannel', 'uta', false);
|
|
745
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
656
746
|
const args = {
|
|
657
747
|
'instType': instType,
|
|
658
|
-
'channel': channel,
|
|
659
|
-
'instId': market['id'],
|
|
660
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
|
+
}
|
|
661
760
|
return await this.unWatchPublic(messageHash, args, params);
|
|
662
761
|
}
|
|
663
762
|
/**
|
|
@@ -2114,6 +2213,18 @@ class bitget extends bitget$1["default"] {
|
|
|
2114
2213
|
// "ts": 1753230479687
|
|
2115
2214
|
// }
|
|
2116
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
|
+
//
|
|
2117
2228
|
if (this.handleErrorMessage(client, message)) {
|
|
2118
2229
|
return;
|
|
2119
2230
|
}
|
|
@@ -2152,6 +2263,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2152
2263
|
'positions': this.handlePositions,
|
|
2153
2264
|
'account-isolated': this.handleBalance,
|
|
2154
2265
|
'account-crossed': this.handleBalance,
|
|
2266
|
+
'kline': this.handleOHLCV,
|
|
2155
2267
|
};
|
|
2156
2268
|
const arg = this.safeValue(message, 'arg', {});
|
|
2157
2269
|
const topic = this.safeValue2(arg, 'channel', 'topic', '');
|
|
@@ -2261,18 +2373,38 @@ class bitget extends bitget$1["default"] {
|
|
|
2261
2373
|
//
|
|
2262
2374
|
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
|
2263
2375
|
//
|
|
2376
|
+
// UTA
|
|
2377
|
+
//
|
|
2378
|
+
// {"event":"unsubscribe","arg":{"instType":"spot","topic":"kline","symbol":"BTCUSDT","interval":"1m"}}
|
|
2379
|
+
//
|
|
2264
2380
|
const arg = this.safeDict(message, 'arg', {});
|
|
2265
2381
|
const instType = this.safeStringLower(arg, 'instType');
|
|
2266
2382
|
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2267
|
-
const instId = this.
|
|
2268
|
-
const channel = this.
|
|
2269
|
-
|
|
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
|
+
}
|
|
2270
2394
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
2271
2395
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
2272
2396
|
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2273
2397
|
const symbol = market['symbol'];
|
|
2274
|
-
|
|
2275
|
-
|
|
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
|
+
}
|
|
2276
2408
|
if (symbol in this.ohlcvs) {
|
|
2277
2409
|
if (timeframe in this.ohlcvs[symbol]) {
|
|
2278
2410
|
delete this.ohlcvs[symbol][timeframe];
|
|
@@ -2320,6 +2452,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2320
2452
|
else if (channel.startsWith('candle')) {
|
|
2321
2453
|
this.handleOHLCVUnSubscription(client, message);
|
|
2322
2454
|
}
|
|
2455
|
+
else if (channel.startsWith('kline')) {
|
|
2456
|
+
this.handleOHLCVUnSubscription(client, message);
|
|
2457
|
+
}
|
|
2323
2458
|
}
|
|
2324
2459
|
return message;
|
|
2325
2460
|
}
|
|
@@ -490,11 +490,16 @@ class gemini extends gemini$1["default"] {
|
|
|
490
490
|
currentBidAsk['timestamp'] = timestamp;
|
|
491
491
|
currentBidAsk['datetime'] = this.iso8601(timestamp);
|
|
492
492
|
currentBidAsk['info'] = rawBidAskChanges;
|
|
493
|
+
const bidsAsksDict = {};
|
|
494
|
+
bidsAsksDict[symbol] = currentBidAsk;
|
|
493
495
|
this.bidsasks[symbol] = currentBidAsk;
|
|
494
|
-
client.resolve(
|
|
496
|
+
client.resolve(bidsAsksDict, messageHash);
|
|
495
497
|
}
|
|
496
|
-
async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
|
|
498
|
+
async helperForWatchMultipleConstruct(itemHashName, symbols = undefined, params = {}) {
|
|
497
499
|
await this.loadMarkets();
|
|
500
|
+
if (symbols === undefined) {
|
|
501
|
+
throw new errors.NotSupported(this.id + ' watchMultiple requires at least one symbol');
|
|
502
|
+
}
|
|
498
503
|
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
499
504
|
const firstMarket = this.market(symbols[0]);
|
|
500
505
|
if (!firstMarket['spot'] && !firstMarket['linear']) {
|
|
@@ -98,6 +98,11 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
98
98
|
await this.loadMarkets();
|
|
99
99
|
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
100
100
|
const orders = await this.createOrdersWs([order], globalParams);
|
|
101
|
+
const ordersLength = orders.length;
|
|
102
|
+
if (ordersLength === 0) {
|
|
103
|
+
// not sure why but it is happening sometimes
|
|
104
|
+
return this.safeOrder({});
|
|
105
|
+
}
|
|
101
106
|
const parsedOrder = orders[0];
|
|
102
107
|
return parsedOrder;
|
|
103
108
|
}
|
|
@@ -1709,7 +1709,7 @@ class kraken extends kraken$1["default"] {
|
|
|
1709
1709
|
//
|
|
1710
1710
|
const errorMessage = this.safeString2(message, 'errorMessage', 'error');
|
|
1711
1711
|
if (errorMessage !== undefined) {
|
|
1712
|
-
|
|
1712
|
+
const requestId = this.safeString2(message, 'reqid', 'req_id');
|
|
1713
1713
|
const broad = this.exceptions['ws']['broad'];
|
|
1714
1714
|
const broadKey = this.findBroadlyMatchedKey(broad, errorMessage);
|
|
1715
1715
|
let exception = undefined;
|
|
@@ -1719,11 +1719,9 @@ class kraken extends kraken$1["default"] {
|
|
|
1719
1719
|
else {
|
|
1720
1720
|
exception = new broad[broadKey](errorMessage);
|
|
1721
1721
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
client.reject(exception);
|
|
1726
|
-
// }
|
|
1722
|
+
if (requestId !== undefined) {
|
|
1723
|
+
client.reject(exception, requestId);
|
|
1724
|
+
}
|
|
1727
1725
|
return false;
|
|
1728
1726
|
}
|
|
1729
1727
|
return true;
|