ccxt 4.3.52 → 4.3.54
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 +6 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/vertex.js +9 -0
- package/dist/cjs/src/base/Precise.js +10 -0
- package/dist/cjs/src/base/functions/type.js +43 -10
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/hyperliquid.js +27 -26
- package/dist/cjs/src/phemex.js +28 -1
- package/dist/cjs/src/poloniex.js +2 -1
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bybit.js +20 -12
- package/dist/cjs/src/pro/kucoin.js +64 -26
- package/dist/cjs/src/pro/probit.js +8 -3
- package/dist/cjs/src/pro/vertex.js +978 -0
- package/dist/cjs/src/probit.js +10 -5
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +1 -1
- package/dist/cjs/src/vertex.js +2941 -0
- package/dist/cjs/src/woo.js +29 -21
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/vertex.d.ts +22 -0
- package/js/src/abstract/vertex.js +11 -0
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Precise.d.ts +2 -0
- package/js/src/base/Precise.js +10 -0
- package/js/src/base/functions/type.js +43 -10
- package/js/src/binance.d.ts +1 -11
- package/js/src/bingx.js +1 -1
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/coinex.d.ts +1 -1
- package/js/src/htx.d.ts +1 -1
- package/js/src/hyperliquid.js +27 -26
- package/js/src/phemex.d.ts +1 -1
- package/js/src/phemex.js +28 -1
- package/js/src/poloniex.js +2 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bybit.d.ts +1 -1
- package/js/src/pro/bybit.js +20 -12
- package/js/src/pro/kucoin.js +64 -26
- package/js/src/pro/probit.js +8 -3
- package/js/src/pro/vertex.d.ts +39 -0
- package/js/src/pro/vertex.js +979 -0
- package/js/src/probit.js +11 -6
- package/js/src/static_dependencies/ethers/hash/typed-data.js +1 -1
- package/js/src/vertex.d.ts +112 -0
- package/js/src/vertex.js +2942 -0
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +29 -21
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -110,6 +110,7 @@ var timex = require('./src/timex.js');
|
|
|
110
110
|
var tokocrypto = require('./src/tokocrypto.js');
|
|
111
111
|
var tradeogre = require('./src/tradeogre.js');
|
|
112
112
|
var upbit = require('./src/upbit.js');
|
|
113
|
+
var vertex = require('./src/vertex.js');
|
|
113
114
|
var wavesexchange = require('./src/wavesexchange.js');
|
|
114
115
|
var wazirx = require('./src/wazirx.js');
|
|
115
116
|
var whitebit = require('./src/whitebit.js');
|
|
@@ -181,6 +182,7 @@ var poloniex$1 = require('./src/pro/poloniex.js');
|
|
|
181
182
|
var poloniexfutures$1 = require('./src/pro/poloniexfutures.js');
|
|
182
183
|
var probit$1 = require('./src/pro/probit.js');
|
|
183
184
|
var upbit$1 = require('./src/pro/upbit.js');
|
|
185
|
+
var vertex$1 = require('./src/pro/vertex.js');
|
|
184
186
|
var wazirx$1 = require('./src/pro/wazirx.js');
|
|
185
187
|
var whitebit$1 = require('./src/pro/whitebit.js');
|
|
186
188
|
var woo$1 = require('./src/pro/woo.js');
|
|
@@ -188,7 +190,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
188
190
|
|
|
189
191
|
//-----------------------------------------------------------------------------
|
|
190
192
|
// this is updated by vss.js when building
|
|
191
|
-
const version = '4.3.
|
|
193
|
+
const version = '4.3.54';
|
|
192
194
|
Exchange["default"].ccxtVersion = version;
|
|
193
195
|
const exchanges = {
|
|
194
196
|
'ace': ace,
|
|
@@ -289,6 +291,7 @@ const exchanges = {
|
|
|
289
291
|
'tokocrypto': tokocrypto,
|
|
290
292
|
'tradeogre': tradeogre,
|
|
291
293
|
'upbit': upbit,
|
|
294
|
+
'vertex': vertex,
|
|
292
295
|
'wavesexchange': wavesexchange,
|
|
293
296
|
'wazirx': wazirx,
|
|
294
297
|
'whitebit': whitebit,
|
|
@@ -362,6 +365,7 @@ const pro = {
|
|
|
362
365
|
'poloniexfutures': poloniexfutures$1,
|
|
363
366
|
'probit': probit$1,
|
|
364
367
|
'upbit': upbit$1,
|
|
368
|
+
'vertex': vertex$1,
|
|
365
369
|
'wazirx': wazirx$1,
|
|
366
370
|
'whitebit': whitebit$1,
|
|
367
371
|
'woo': woo$1,
|
|
@@ -512,6 +516,7 @@ exports.timex = timex;
|
|
|
512
516
|
exports.tokocrypto = tokocrypto;
|
|
513
517
|
exports.tradeogre = tradeogre;
|
|
514
518
|
exports.upbit = upbit;
|
|
519
|
+
exports.vertex = vertex;
|
|
515
520
|
exports.wavesexchange = wavesexchange;
|
|
516
521
|
exports.wazirx = wazirx;
|
|
517
522
|
exports.whitebit = whitebit;
|
|
@@ -80,6 +80,10 @@ class Precise {
|
|
|
80
80
|
neg() {
|
|
81
81
|
return new Precise(-this.integer, this.decimals);
|
|
82
82
|
}
|
|
83
|
+
or(other) {
|
|
84
|
+
const integerResult = this.integer | other.integer;
|
|
85
|
+
return new Precise(integerResult, this.decimals);
|
|
86
|
+
}
|
|
83
87
|
min(other) {
|
|
84
88
|
return this.lt(other) ? this : other;
|
|
85
89
|
}
|
|
@@ -210,6 +214,12 @@ class Precise {
|
|
|
210
214
|
}
|
|
211
215
|
return (new Precise(string1)).mod(new Precise(string2)).toString();
|
|
212
216
|
}
|
|
217
|
+
static stringOr(string1, string2) {
|
|
218
|
+
if ((string1 === undefined) || (string2 === undefined)) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
return (new Precise(string1)).or(new Precise(string2)).toString();
|
|
222
|
+
}
|
|
213
223
|
static stringEquals(string1, string2) {
|
|
214
224
|
if ((string1 === undefined) || (string2 === undefined)) {
|
|
215
225
|
return undefined;
|
|
@@ -21,7 +21,7 @@ const prop2 = (o, k1, k2) => (!isObject(o)
|
|
|
21
21
|
: (o[k2] !== '' && o[k2] !== null
|
|
22
22
|
? o[k2]
|
|
23
23
|
: undefined)));
|
|
24
|
-
const getValueFromKeysInArray = (object, array) => object[array.find((k) => prop(object, k) !== undefined)];
|
|
24
|
+
const getValueFromKeysInArray = (object, array) => isObject(object) ? object[array.find((k) => prop(object, k) !== undefined)] : undefined;
|
|
25
25
|
/* ............................................. */
|
|
26
26
|
const asFloat = (x) => ((isNumber(x) || (isString(x) && x.length !== 0)) ? parseFloat(x) : NaN);
|
|
27
27
|
const asInteger = (x) => ((isNumber(x) || (isString(x) && x.length !== 0)) ? Math.trunc(Number(x)) : NaN);
|
|
@@ -52,11 +52,23 @@ const safeString = (o, k, $default) => {
|
|
|
52
52
|
};
|
|
53
53
|
const safeStringLower = (o, k, $default) => {
|
|
54
54
|
const x = prop(o, k);
|
|
55
|
-
|
|
55
|
+
if (isStringCoercible(x)) {
|
|
56
|
+
return String(x).toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
else if (isStringCoercible($default)) {
|
|
59
|
+
return String($default).toLowerCase();
|
|
60
|
+
}
|
|
61
|
+
return $default;
|
|
56
62
|
};
|
|
57
63
|
const safeStringUpper = (o, k, $default) => {
|
|
58
64
|
const x = prop(o, k);
|
|
59
|
-
|
|
65
|
+
if (isStringCoercible(x)) {
|
|
66
|
+
return String(x).toUpperCase();
|
|
67
|
+
}
|
|
68
|
+
else if (isStringCoercible($default)) {
|
|
69
|
+
return String($default).toUpperCase();
|
|
70
|
+
}
|
|
71
|
+
return $default;
|
|
60
72
|
};
|
|
61
73
|
/* ............................................. */
|
|
62
74
|
const safeFloat2 = (o, k1, k2, $default) => {
|
|
@@ -85,11 +97,23 @@ const safeString2 = (o, k1, k2, $default) => {
|
|
|
85
97
|
};
|
|
86
98
|
const safeStringLower2 = (o, k1, k2, $default) => {
|
|
87
99
|
const x = prop2(o, k1, k2);
|
|
88
|
-
|
|
100
|
+
if (isStringCoercible(x)) {
|
|
101
|
+
return String(x).toLowerCase();
|
|
102
|
+
}
|
|
103
|
+
else if (isStringCoercible($default)) {
|
|
104
|
+
return String($default).toLowerCase();
|
|
105
|
+
}
|
|
106
|
+
return $default;
|
|
89
107
|
};
|
|
90
108
|
const safeStringUpper2 = (o, k1, k2, $default) => {
|
|
91
109
|
const x = prop2(o, k1, k2);
|
|
92
|
-
|
|
110
|
+
if (isStringCoercible(x)) {
|
|
111
|
+
return String(x).toUpperCase();
|
|
112
|
+
}
|
|
113
|
+
else if (isStringCoercible($default)) {
|
|
114
|
+
return String($default).toUpperCase();
|
|
115
|
+
}
|
|
116
|
+
return $default;
|
|
93
117
|
};
|
|
94
118
|
const safeFloatN = (o, k, $default) => {
|
|
95
119
|
const n = asFloat(getValueFromKeysInArray(o, k));
|
|
@@ -125,15 +149,24 @@ const safeStringN = (o, k, $default) => {
|
|
|
125
149
|
return isStringCoercible(x) ? String(x) : $default;
|
|
126
150
|
};
|
|
127
151
|
const safeStringLowerN = (o, k, $default) => {
|
|
128
|
-
if (o === undefined) {
|
|
129
|
-
return $default;
|
|
130
|
-
}
|
|
131
152
|
const x = getValueFromKeysInArray(o, k);
|
|
132
|
-
|
|
153
|
+
if (isStringCoercible(x)) {
|
|
154
|
+
return String(x).toLowerCase();
|
|
155
|
+
}
|
|
156
|
+
else if (isStringCoercible($default)) {
|
|
157
|
+
return String($default).toLowerCase();
|
|
158
|
+
}
|
|
159
|
+
return $default;
|
|
133
160
|
};
|
|
134
161
|
const safeStringUpperN = (o, k, $default) => {
|
|
135
162
|
const x = getValueFromKeysInArray(o, k);
|
|
136
|
-
|
|
163
|
+
if (isStringCoercible(x)) {
|
|
164
|
+
return String(x).toUpperCase();
|
|
165
|
+
}
|
|
166
|
+
else if (isStringCoercible($default)) {
|
|
167
|
+
return String($default).toUpperCase();
|
|
168
|
+
}
|
|
169
|
+
return $default;
|
|
137
170
|
};
|
|
138
171
|
/* ------------------------------------------------------------------------ */
|
|
139
172
|
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -701,7 +701,7 @@ class bingx extends bingx$1 {
|
|
|
701
701
|
'limits': {
|
|
702
702
|
'leverage': {
|
|
703
703
|
'min': undefined,
|
|
704
|
-
'max':
|
|
704
|
+
'max': undefined,
|
|
705
705
|
},
|
|
706
706
|
'amount': {
|
|
707
707
|
'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
|
|
@@ -442,24 +442,26 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
442
442
|
for (let i = 0; i < meta.length; i++) {
|
|
443
443
|
const market = this.safeDict(meta, i, {});
|
|
444
444
|
const marketName = this.safeString(market, 'name');
|
|
445
|
-
if (marketName.indexOf('/') < 0) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
const marketParts = marketName.split('/');
|
|
450
|
-
const baseName = this.safeString(marketParts, 0);
|
|
451
|
-
const quoteId = this.safeString(marketParts, 1);
|
|
452
|
-
const base = this.safeCurrencyCode(baseName);
|
|
453
|
-
const quote = this.safeCurrencyCode(quoteId);
|
|
454
|
-
const symbol = base + '/' + quote;
|
|
445
|
+
// if (marketName.indexOf ('/') < 0) {
|
|
446
|
+
// // there are some weird spot markets in testnet, eg @2
|
|
447
|
+
// continue;
|
|
448
|
+
// }
|
|
449
|
+
// const marketParts = marketName.split ('/');
|
|
450
|
+
// const baseName = this.safeString (marketParts, 0);
|
|
451
|
+
// const quoteId = this.safeString (marketParts, 1);
|
|
455
452
|
const fees = this.safeDict(this.fees, 'spot', {});
|
|
456
453
|
const taker = this.safeNumber(fees, 'taker');
|
|
457
454
|
const maker = this.safeNumber(fees, 'maker');
|
|
458
455
|
const tokensPos = this.safeList(market, 'tokens', []);
|
|
459
456
|
const baseTokenPos = this.safeInteger(tokensPos, 0);
|
|
460
|
-
|
|
457
|
+
const quoteTokenPos = this.safeInteger(tokensPos, 1);
|
|
461
458
|
const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
|
|
462
|
-
|
|
459
|
+
const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
|
|
460
|
+
const baseName = this.safeString(baseTokenInfo, 'name');
|
|
461
|
+
const quoteId = this.safeString(quoteTokenInfo, 'name');
|
|
462
|
+
const base = this.safeCurrencyCode(baseName);
|
|
463
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
464
|
+
const symbol = base + '/' + quote;
|
|
463
465
|
const innerBaseTokenInfo = this.safeDict(baseTokenInfo, 'spec', baseTokenInfo);
|
|
464
466
|
// const innerQuoteTokenInfo = this.safeDict (quoteTokenInfo, 'spec', quoteTokenInfo);
|
|
465
467
|
const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(innerBaseTokenInfo, 'szDecimals')));
|
|
@@ -1153,7 +1155,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1153
1155
|
if (clientOrderId !== undefined) {
|
|
1154
1156
|
orderObj['c'] = clientOrderId;
|
|
1155
1157
|
}
|
|
1156
|
-
orderReq.push(
|
|
1158
|
+
orderReq.push(orderObj);
|
|
1157
1159
|
}
|
|
1158
1160
|
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1159
1161
|
const orderAction = {
|
|
@@ -1176,7 +1178,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1176
1178
|
params = this.omit(params, 'vaultAddress');
|
|
1177
1179
|
request['vaultAddress'] = vaultAddress;
|
|
1178
1180
|
}
|
|
1179
|
-
const response = await this.privatePostExchange(
|
|
1181
|
+
const response = await this.privatePostExchange(request);
|
|
1180
1182
|
//
|
|
1181
1183
|
// {
|
|
1182
1184
|
// "status": "ok",
|
|
@@ -1279,7 +1281,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1279
1281
|
params = this.omit(params, 'vaultAddress');
|
|
1280
1282
|
request['vaultAddress'] = vaultAddress;
|
|
1281
1283
|
}
|
|
1282
|
-
const response = await this.privatePostExchange(
|
|
1284
|
+
const response = await this.privatePostExchange(request);
|
|
1283
1285
|
//
|
|
1284
1286
|
// {
|
|
1285
1287
|
// "status":"ok",
|
|
@@ -1363,7 +1365,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1363
1365
|
params = this.omit(params, 'vaultAddress');
|
|
1364
1366
|
request['vaultAddress'] = vaultAddress;
|
|
1365
1367
|
}
|
|
1366
|
-
const response = await this.privatePostExchange(
|
|
1368
|
+
const response = await this.privatePostExchange(request);
|
|
1367
1369
|
//
|
|
1368
1370
|
// {
|
|
1369
1371
|
// "status":"ok",
|
|
@@ -1409,7 +1411,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1409
1411
|
params = this.omit(params, 'vaultAddress');
|
|
1410
1412
|
request['vaultAddress'] = vaultAddress;
|
|
1411
1413
|
}
|
|
1412
|
-
const response = await this.privatePostExchange(
|
|
1414
|
+
const response = await this.privatePostExchange(request);
|
|
1413
1415
|
//
|
|
1414
1416
|
// {
|
|
1415
1417
|
// "status":"err",
|
|
@@ -1531,7 +1533,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1531
1533
|
params = this.omit(params, 'vaultAddress');
|
|
1532
1534
|
request['vaultAddress'] = vaultAddress;
|
|
1533
1535
|
}
|
|
1534
|
-
const response = await this.privatePostExchange(
|
|
1536
|
+
const response = await this.privatePostExchange(request);
|
|
1535
1537
|
//
|
|
1536
1538
|
// {
|
|
1537
1539
|
// "status": "ok",
|
|
@@ -2210,10 +2212,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2210
2212
|
vaultAddress = vaultAddress.replace('0x', '');
|
|
2211
2213
|
}
|
|
2212
2214
|
}
|
|
2213
|
-
const
|
|
2214
|
-
const signature = this.signL1Action(extendedAction, nonce, vaultAddress);
|
|
2215
|
+
const signature = this.signL1Action(updateAction, nonce, vaultAddress);
|
|
2215
2216
|
const request = {
|
|
2216
|
-
'action':
|
|
2217
|
+
'action': updateAction,
|
|
2217
2218
|
'nonce': nonce,
|
|
2218
2219
|
'signature': signature,
|
|
2219
2220
|
// 'vaultAddress': vaultAddress,
|
|
@@ -2271,7 +2272,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2271
2272
|
params = this.omit(params, 'vaultAddress');
|
|
2272
2273
|
request['vaultAddress'] = vaultAddress;
|
|
2273
2274
|
}
|
|
2274
|
-
const response = await this.privatePostExchange(
|
|
2275
|
+
const response = await this.privatePostExchange(request);
|
|
2275
2276
|
//
|
|
2276
2277
|
// {
|
|
2277
2278
|
// 'response': {
|
|
@@ -2335,7 +2336,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2335
2336
|
params = this.omit(params, 'vaultAddress');
|
|
2336
2337
|
request['vaultAddress'] = vaultAddress;
|
|
2337
2338
|
}
|
|
2338
|
-
const response = await this.privatePostExchange(
|
|
2339
|
+
const response = await this.privatePostExchange(request);
|
|
2339
2340
|
//
|
|
2340
2341
|
// {
|
|
2341
2342
|
// 'response': {
|
|
@@ -2402,7 +2403,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2402
2403
|
};
|
|
2403
2404
|
const signature = this.signL1Action(action, nonce, vaultAddress);
|
|
2404
2405
|
const innerRequest = {
|
|
2405
|
-
'action':
|
|
2406
|
+
'action': action,
|
|
2406
2407
|
'nonce': nonce,
|
|
2407
2408
|
'signature': signature,
|
|
2408
2409
|
};
|
|
@@ -2439,7 +2440,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2439
2440
|
'nonce': nonce,
|
|
2440
2441
|
'signature': sig,
|
|
2441
2442
|
};
|
|
2442
|
-
const response = await this.privatePostExchange(
|
|
2443
|
+
const response = await this.privatePostExchange(request);
|
|
2443
2444
|
return response;
|
|
2444
2445
|
}
|
|
2445
2446
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
@@ -2485,7 +2486,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2485
2486
|
'nonce': nonce,
|
|
2486
2487
|
'signature': sig,
|
|
2487
2488
|
};
|
|
2488
|
-
const response = await this.privatePostExchange(
|
|
2489
|
+
const response = await this.privatePostExchange(request);
|
|
2489
2490
|
return this.parseTransaction(response);
|
|
2490
2491
|
}
|
|
2491
2492
|
parseTransaction(transaction, currency = undefined) {
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -2941,14 +2941,41 @@ class phemex extends phemex$1 {
|
|
|
2941
2941
|
let response = undefined;
|
|
2942
2942
|
if (market['settle'] === 'USDT') {
|
|
2943
2943
|
response = await this.privateDeleteGOrdersAll(this.extend(request, params));
|
|
2944
|
+
//
|
|
2945
|
+
// {
|
|
2946
|
+
// code: '0',
|
|
2947
|
+
// msg: '',
|
|
2948
|
+
// data: '1'
|
|
2949
|
+
// }
|
|
2950
|
+
//
|
|
2944
2951
|
}
|
|
2945
2952
|
else if (market['swap']) {
|
|
2946
2953
|
response = await this.privateDeleteOrdersAll(this.extend(request, params));
|
|
2954
|
+
//
|
|
2955
|
+
// {
|
|
2956
|
+
// code: '0',
|
|
2957
|
+
// msg: '',
|
|
2958
|
+
// data: '1'
|
|
2959
|
+
// }
|
|
2960
|
+
//
|
|
2947
2961
|
}
|
|
2948
2962
|
else {
|
|
2949
2963
|
response = await this.privateDeleteSpotOrdersAll(this.extend(request, params));
|
|
2964
|
+
//
|
|
2965
|
+
// {
|
|
2966
|
+
// code: '0',
|
|
2967
|
+
// msg: '',
|
|
2968
|
+
// data: {
|
|
2969
|
+
// total: '1'
|
|
2970
|
+
// }
|
|
2971
|
+
// }
|
|
2972
|
+
//
|
|
2950
2973
|
}
|
|
2951
|
-
return
|
|
2974
|
+
return [
|
|
2975
|
+
this.safeOrder({
|
|
2976
|
+
'info': response,
|
|
2977
|
+
}),
|
|
2978
|
+
];
|
|
2952
2979
|
}
|
|
2953
2980
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
2954
2981
|
/**
|
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -3730,7 +3730,7 @@ class binance extends binance$1 {
|
|
|
3730
3730
|
rejected = true;
|
|
3731
3731
|
// private endpoint uses id as messageHash
|
|
3732
3732
|
client.reject(e, id);
|
|
3733
|
-
// public endpoint stores messageHash in
|
|
3733
|
+
// public endpoint stores messageHash in subscriptions
|
|
3734
3734
|
const subscriptionKeys = Object.keys(client.subscriptions);
|
|
3735
3735
|
for (let i = 0; i < subscriptionKeys.length; i++) {
|
|
3736
3736
|
const subscriptionHash = subscriptionKeys[i];
|
|
@@ -132,7 +132,7 @@ class bybit extends bybit$1 {
|
|
|
132
132
|
this.options['requestId'] = requestId;
|
|
133
133
|
return requestId;
|
|
134
134
|
}
|
|
135
|
-
getUrlByMarketType(symbol = undefined, isPrivate = false, method = undefined, params = {}) {
|
|
135
|
+
async getUrlByMarketType(symbol = undefined, isPrivate = false, method = undefined, params = {}) {
|
|
136
136
|
const accessibility = isPrivate ? 'private' : 'public';
|
|
137
137
|
let isUsdcSettled = undefined;
|
|
138
138
|
let isSpot = undefined;
|
|
@@ -152,7 +152,15 @@ class bybit extends bybit$1 {
|
|
|
152
152
|
}
|
|
153
153
|
isSpot = (type === 'spot');
|
|
154
154
|
if (isPrivate) {
|
|
155
|
-
|
|
155
|
+
const unified = await this.isUnifiedEnabled();
|
|
156
|
+
const isUnifiedMargin = this.safeBool(unified, 0, false);
|
|
157
|
+
const isUnifiedAccount = this.safeBool(unified, 1, false);
|
|
158
|
+
if (isUsdcSettled && !isUnifiedMargin && !isUnifiedAccount) {
|
|
159
|
+
url = url[accessibility]['usdc'];
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
url = url[accessibility]['contract'];
|
|
163
|
+
}
|
|
156
164
|
}
|
|
157
165
|
else {
|
|
158
166
|
if (isSpot) {
|
|
@@ -319,7 +327,7 @@ class bybit extends bybit$1 {
|
|
|
319
327
|
const market = this.market(symbol);
|
|
320
328
|
symbol = market['symbol'];
|
|
321
329
|
const messageHash = 'ticker:' + symbol;
|
|
322
|
-
const url = this.getUrlByMarketType(symbol, false, 'watchTicker', params);
|
|
330
|
+
const url = await this.getUrlByMarketType(symbol, false, 'watchTicker', params);
|
|
323
331
|
params = this.cleanParams(params);
|
|
324
332
|
const options = this.safeValue(this.options, 'watchTicker', {});
|
|
325
333
|
let topic = this.safeString(options, 'name', 'tickers');
|
|
@@ -344,7 +352,7 @@ class bybit extends bybit$1 {
|
|
|
344
352
|
await this.loadMarkets();
|
|
345
353
|
symbols = this.marketSymbols(symbols, undefined, false);
|
|
346
354
|
const messageHashes = [];
|
|
347
|
-
const url = this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
|
|
355
|
+
const url = await this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
|
|
348
356
|
params = this.cleanParams(params);
|
|
349
357
|
const options = this.safeValue(this.options, 'watchTickers', {});
|
|
350
358
|
const topic = this.safeString(options, 'name', 'tickers');
|
|
@@ -525,7 +533,7 @@ class bybit extends bybit$1 {
|
|
|
525
533
|
await this.loadMarkets();
|
|
526
534
|
const market = this.market(symbol);
|
|
527
535
|
symbol = market['symbol'];
|
|
528
|
-
const url = this.getUrlByMarketType(symbol, false, 'watchOHLCV', params);
|
|
536
|
+
const url = await this.getUrlByMarketType(symbol, false, 'watchOHLCV', params);
|
|
529
537
|
params = this.cleanParams(params);
|
|
530
538
|
let ohlcv = undefined;
|
|
531
539
|
const timeframeId = this.safeString(this.timeframes, timeframe, timeframe);
|
|
@@ -643,7 +651,7 @@ class bybit extends bybit$1 {
|
|
|
643
651
|
throw new errors.ArgumentsRequired(this.id + ' watchOrderBookForSymbols() requires a non-empty array of symbols');
|
|
644
652
|
}
|
|
645
653
|
symbols = this.marketSymbols(symbols);
|
|
646
|
-
const url = this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
|
|
654
|
+
const url = await this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
|
|
647
655
|
params = this.cleanParams(params);
|
|
648
656
|
const market = this.market(symbols[0]);
|
|
649
657
|
if (limit === undefined) {
|
|
@@ -775,7 +783,7 @@ class bybit extends bybit$1 {
|
|
|
775
783
|
throw new errors.ArgumentsRequired(this.id + ' watchTradesForSymbols() requires a non-empty array of symbols');
|
|
776
784
|
}
|
|
777
785
|
params = this.cleanParams(params);
|
|
778
|
-
const url = this.getUrlByMarketType(symbols[0], false, 'watchTrades', params);
|
|
786
|
+
const url = await this.getUrlByMarketType(symbols[0], false, 'watchTrades', params);
|
|
779
787
|
const topics = [];
|
|
780
788
|
const messageHashes = [];
|
|
781
789
|
for (let i = 0; i < symbols.length; i++) {
|
|
@@ -938,7 +946,7 @@ class bybit extends bybit$1 {
|
|
|
938
946
|
symbol = this.symbol(symbol);
|
|
939
947
|
messageHash += ':' + symbol;
|
|
940
948
|
}
|
|
941
|
-
const url = this.getUrlByMarketType(symbol, true, method, params);
|
|
949
|
+
const url = await this.getUrlByMarketType(symbol, true, method, params);
|
|
942
950
|
await this.authenticate(url);
|
|
943
951
|
const topicByMarket = {
|
|
944
952
|
'spot': 'ticketInfo',
|
|
@@ -1067,7 +1075,7 @@ class bybit extends bybit$1 {
|
|
|
1067
1075
|
messageHash = '::' + symbols.join(',');
|
|
1068
1076
|
}
|
|
1069
1077
|
const firstSymbol = this.safeString(symbols, 0);
|
|
1070
|
-
const url = this.getUrlByMarketType(firstSymbol, true, method, params);
|
|
1078
|
+
const url = await this.getUrlByMarketType(firstSymbol, true, method, params);
|
|
1071
1079
|
messageHash = 'positions' + messageHash;
|
|
1072
1080
|
const client = this.client(url);
|
|
1073
1081
|
await this.authenticate(url);
|
|
@@ -1218,7 +1226,7 @@ class bybit extends bybit$1 {
|
|
|
1218
1226
|
await this.loadMarkets();
|
|
1219
1227
|
const market = this.market(symbol);
|
|
1220
1228
|
symbol = market['symbol'];
|
|
1221
|
-
const url = this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
|
|
1229
|
+
const url = await this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
|
|
1222
1230
|
params = this.cleanParams(params);
|
|
1223
1231
|
const messageHash = 'liquidations::' + symbol;
|
|
1224
1232
|
const topic = 'liquidation.' + market['id'];
|
|
@@ -1302,7 +1310,7 @@ class bybit extends bybit$1 {
|
|
|
1302
1310
|
symbol = this.symbol(symbol);
|
|
1303
1311
|
messageHash += ':' + symbol;
|
|
1304
1312
|
}
|
|
1305
|
-
const url = this.getUrlByMarketType(symbol, true, method, params);
|
|
1313
|
+
const url = await this.getUrlByMarketType(symbol, true, method, params);
|
|
1306
1314
|
await this.authenticate(url);
|
|
1307
1315
|
const topicsByMarket = {
|
|
1308
1316
|
'spot': ['order', 'stopOrder'],
|
|
@@ -1614,7 +1622,7 @@ class bybit extends bybit$1 {
|
|
|
1614
1622
|
const unified = await this.isUnifiedEnabled();
|
|
1615
1623
|
const isUnifiedMargin = this.safeBool(unified, 0, false);
|
|
1616
1624
|
const isUnifiedAccount = this.safeBool(unified, 1, false);
|
|
1617
|
-
const url = this.getUrlByMarketType(undefined, true, method, params);
|
|
1625
|
+
const url = await this.getUrlByMarketType(undefined, true, method, params);
|
|
1618
1626
|
await this.authenticate(url);
|
|
1619
1627
|
const topicByMarket = {
|
|
1620
1628
|
'spot': 'outboundAccountInfo',
|