ccxt 4.4.90 → 4.4.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -4
- package/dist/cjs/src/base/Exchange.js +23 -33
- package/dist/cjs/src/base/ws/Client.js +4 -34
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitmart.js +7 -0
- package/dist/cjs/src/bitmex.js +2 -1
- package/dist/cjs/src/bitvavo.js +10 -1
- package/dist/cjs/src/cex.js +61 -0
- package/dist/cjs/src/cryptocom.js +21 -2
- package/dist/cjs/src/cryptomus.js +1 -1
- package/dist/cjs/src/exmo.js +25 -10
- package/dist/cjs/src/fmfwio.js +1 -1
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/hyperliquid.js +115 -59
- package/dist/cjs/src/kraken.js +29 -1
- package/dist/cjs/src/krakenfutures.js +1 -1
- package/dist/cjs/src/lbank.js +116 -32
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/modetrade.js +2 -2
- package/dist/cjs/src/okx.js +2 -2
- package/dist/cjs/src/paradex.js +1 -1
- package/dist/cjs/src/pro/bitstamp.js +1 -1
- package/dist/cjs/src/pro/bybit.js +10 -149
- package/dist/cjs/src/pro/kraken.js +251 -264
- package/dist/cjs/src/pro/mexc.js +0 -1
- package/js/ccxt.d.ts +2 -5
- package/js/ccxt.js +2 -4
- package/js/src/abstract/lbank.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +4 -1
- package/js/src/base/Exchange.js +24 -34
- package/js/src/base/ws/Client.d.ts +0 -2
- package/js/src/base/ws/Client.js +4 -34
- package/js/src/binance.js +1 -1
- package/js/src/bitmart.d.ts +7 -0
- package/js/src/bitmart.js +7 -0
- package/js/src/bitmex.js +2 -1
- package/js/src/bitvavo.js +10 -1
- package/js/src/cex.js +61 -0
- package/js/src/cryptocom.js +21 -2
- package/js/src/cryptomus.js +1 -1
- package/js/src/exmo.js +25 -10
- package/js/src/fmfwio.js +2 -2
- package/js/src/gate.js +2 -2
- package/js/src/htx.js +1 -1
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +115 -59
- package/js/src/kraken.js +29 -1
- package/js/src/krakenfutures.js +1 -1
- package/js/src/lbank.d.ts +9 -1
- package/js/src/lbank.js +116 -32
- package/js/src/mexc.js +1 -0
- package/js/src/modetrade.js +2 -2
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +2 -2
- package/js/src/p2b.d.ts +1 -2
- package/js/src/paradex.js +1 -1
- package/js/src/pro/bitstamp.js +1 -1
- package/js/src/pro/bybit.d.ts +0 -1
- package/js/src/pro/bybit.js +11 -150
- package/js/src/pro/kraken.d.ts +17 -17
- package/js/src/pro/kraken.js +251 -264
- package/js/src/pro/mexc.js +0 -1
- package/js/src/tradeogre.d.ts +1 -2
- package/package.json +1 -1
- package/js/src/abstract/coinlist.d.ts +0 -60
- package/js/src/abstract/coinlist.js +0 -11
- package/js/src/coinlist.d.ts +0 -384
- package/js/src/coinlist.js +0 -2610
package/js/src/lbank.js
CHANGED
|
@@ -52,6 +52,7 @@ export default class lbank extends Exchange {
|
|
|
52
52
|
'fetchClosedOrders': false,
|
|
53
53
|
'fetchCrossBorrowRate': false,
|
|
54
54
|
'fetchCrossBorrowRates': false,
|
|
55
|
+
'fetchCurrencies': true,
|
|
55
56
|
'fetchDepositAddress': true,
|
|
56
57
|
'fetchDepositAddresses': false,
|
|
57
58
|
'fetchDepositAddressesByNetwork': false,
|
|
@@ -126,6 +127,7 @@ export default class lbank extends Exchange {
|
|
|
126
127
|
'currencyPairs': 2.5,
|
|
127
128
|
'accuracy': 2.5,
|
|
128
129
|
'usdToCny': 2.5,
|
|
130
|
+
'assetConfigs': 2.5,
|
|
129
131
|
'withdrawConfigs': 2.5,
|
|
130
132
|
'timestamp': 2.5,
|
|
131
133
|
'ticker/24hr': 2.5,
|
|
@@ -212,6 +214,7 @@ export default class lbank extends Exchange {
|
|
|
212
214
|
},
|
|
213
215
|
},
|
|
214
216
|
'commonCurrencies': {
|
|
217
|
+
'XBT': 'XBT',
|
|
215
218
|
'HIT': 'Hiver',
|
|
216
219
|
'VET_ERC20': 'VEN',
|
|
217
220
|
'PNT': 'Penta',
|
|
@@ -279,21 +282,12 @@ export default class lbank extends Exchange {
|
|
|
279
282
|
// ptx: 1
|
|
280
283
|
// }
|
|
281
284
|
},
|
|
282
|
-
'
|
|
285
|
+
'networksById': {
|
|
283
286
|
'erc20': 'ERC20',
|
|
284
287
|
'trc20': 'TRC20',
|
|
285
|
-
'
|
|
286
|
-
'
|
|
287
|
-
'bep20
|
|
288
|
-
'bep20': 'BSC',
|
|
289
|
-
'heco': 'HT',
|
|
290
|
-
'bep2': 'BNB',
|
|
291
|
-
'btc': 'BTC',
|
|
292
|
-
'dogecoin': 'DOGE',
|
|
293
|
-
'matic': 'MATIC',
|
|
294
|
-
'oec': 'OEC',
|
|
295
|
-
'btctron': 'BTCTRON',
|
|
296
|
-
'xrp': 'XRP',
|
|
288
|
+
'TRX': 'TRC20',
|
|
289
|
+
'bep20(bsc)': 'BEP20',
|
|
290
|
+
'bep20': 'BEP20',
|
|
297
291
|
},
|
|
298
292
|
'defaultNetworks': {
|
|
299
293
|
'USDT': 'TRC20',
|
|
@@ -416,6 +410,108 @@ export default class lbank extends Exchange {
|
|
|
416
410
|
//
|
|
417
411
|
return this.safeInteger(response, 'data');
|
|
418
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* @method
|
|
415
|
+
* @name lbank#fetchCurrencies
|
|
416
|
+
* @description fetches all available currencies on an exchange
|
|
417
|
+
* @param {dict} [params] extra parameters specific to the exchange API endpoint
|
|
418
|
+
* @returns {dict} an associative dictionary of currencies
|
|
419
|
+
*/
|
|
420
|
+
async fetchCurrencies(params = {}) {
|
|
421
|
+
const response = await this.spotPublicGetWithdrawConfigs(params);
|
|
422
|
+
//
|
|
423
|
+
// {
|
|
424
|
+
// "msg": "Success",
|
|
425
|
+
// "result": "true",
|
|
426
|
+
// "data": [
|
|
427
|
+
// {
|
|
428
|
+
// "amountScale": "4",
|
|
429
|
+
// "chain": "bep20(bsc)",
|
|
430
|
+
// "assetCode": "usdt",
|
|
431
|
+
// "min": "10",
|
|
432
|
+
// "transferAmtScale": "4",
|
|
433
|
+
// "canWithDraw": true,
|
|
434
|
+
// "fee": "0.0000",
|
|
435
|
+
// "minTransfer": "0.0001",
|
|
436
|
+
// "type": "1"
|
|
437
|
+
// },
|
|
438
|
+
// {
|
|
439
|
+
// "amountScale": "4",
|
|
440
|
+
// "chain": "trc20",
|
|
441
|
+
// "assetCode": "usdt",
|
|
442
|
+
// "min": "1",
|
|
443
|
+
// "transferAmtScale": "4",
|
|
444
|
+
// "canWithDraw": true,
|
|
445
|
+
// "fee": "1.0000",
|
|
446
|
+
// "minTransfer": "0.0001",
|
|
447
|
+
// "type": "1"
|
|
448
|
+
// },
|
|
449
|
+
// ...
|
|
450
|
+
// ],
|
|
451
|
+
// "error_code": "0",
|
|
452
|
+
// "ts": "1747973911431"
|
|
453
|
+
// }
|
|
454
|
+
//
|
|
455
|
+
const currenciesData = this.safeList(response, 'data', []);
|
|
456
|
+
const grouped = this.groupBy(currenciesData, 'assetCode');
|
|
457
|
+
const groupedKeys = Object.keys(grouped);
|
|
458
|
+
const result = {};
|
|
459
|
+
for (let i = 0; i < groupedKeys.length; i++) {
|
|
460
|
+
const id = (groupedKeys[i]).toString(); // some currencies are numeric
|
|
461
|
+
const code = this.safeCurrencyCode(id);
|
|
462
|
+
const networksRaw = grouped[id];
|
|
463
|
+
const networks = {};
|
|
464
|
+
for (let j = 0; j < networksRaw.length; j++) {
|
|
465
|
+
const networkEntry = networksRaw[j];
|
|
466
|
+
const networkId = this.safeString(networkEntry, 'chain');
|
|
467
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
468
|
+
networks[networkCode] = {
|
|
469
|
+
'id': networkId,
|
|
470
|
+
'network': networkCode,
|
|
471
|
+
'limits': {
|
|
472
|
+
'withdraw': {
|
|
473
|
+
'min': this.safeNumber(networkEntry, 'min'),
|
|
474
|
+
'max': undefined,
|
|
475
|
+
},
|
|
476
|
+
'deposit': {
|
|
477
|
+
'min': this.safeNumber(networkEntry, 'minTransfer'),
|
|
478
|
+
'max': undefined,
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
'active': undefined,
|
|
482
|
+
'deposit': undefined,
|
|
483
|
+
'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
|
|
484
|
+
'fee': this.safeNumber(networkEntry, 'fee'),
|
|
485
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
|
|
486
|
+
'info': networkEntry,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
result[code] = this.safeCurrencyStructure({
|
|
490
|
+
'id': id,
|
|
491
|
+
'code': code,
|
|
492
|
+
'precision': undefined,
|
|
493
|
+
'type': undefined,
|
|
494
|
+
'name': undefined,
|
|
495
|
+
'active': undefined,
|
|
496
|
+
'deposit': undefined,
|
|
497
|
+
'withdraw': undefined,
|
|
498
|
+
'fee': undefined,
|
|
499
|
+
'limits': {
|
|
500
|
+
'withdraw': {
|
|
501
|
+
'min': undefined,
|
|
502
|
+
'max': undefined,
|
|
503
|
+
},
|
|
504
|
+
'deposit': {
|
|
505
|
+
'min': undefined,
|
|
506
|
+
'max': undefined,
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
'networks': networks,
|
|
510
|
+
'info': networksRaw,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
419
515
|
/**
|
|
420
516
|
* @method
|
|
421
517
|
* @name lbank#fetchMarkets
|
|
@@ -2171,13 +2267,10 @@ export default class lbank extends Exchange {
|
|
|
2171
2267
|
const result = this.safeValue(response, 'data');
|
|
2172
2268
|
const address = this.safeString(result, 'address');
|
|
2173
2269
|
const tag = this.safeString(result, 'memo');
|
|
2174
|
-
const networkId = this.safeString(result, 'netWork');
|
|
2175
|
-
const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2176
|
-
const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId);
|
|
2177
2270
|
return {
|
|
2178
2271
|
'info': response,
|
|
2179
2272
|
'currency': code,
|
|
2180
|
-
'network':
|
|
2273
|
+
'network': this.networkIdToCode(this.safeString(result, 'netWork')),
|
|
2181
2274
|
'address': address,
|
|
2182
2275
|
'tag': tag,
|
|
2183
2276
|
};
|
|
@@ -2212,12 +2305,10 @@ export default class lbank extends Exchange {
|
|
|
2212
2305
|
const result = this.safeValue(response, 'data');
|
|
2213
2306
|
const address = this.safeString(result, 'address');
|
|
2214
2307
|
const tag = this.safeString(result, 'memo');
|
|
2215
|
-
const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2216
|
-
const networkCode = this.safeStringUpper(inverseNetworks, network, network);
|
|
2217
2308
|
return {
|
|
2218
2309
|
'info': response,
|
|
2219
2310
|
'currency': code,
|
|
2220
|
-
'network':
|
|
2311
|
+
'network': undefined,
|
|
2221
2312
|
'address': address,
|
|
2222
2313
|
'tag': tag,
|
|
2223
2314
|
};
|
|
@@ -2341,9 +2432,6 @@ export default class lbank extends Exchange {
|
|
|
2341
2432
|
}
|
|
2342
2433
|
const txid = this.safeString(transaction, 'txId');
|
|
2343
2434
|
const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
|
|
2344
|
-
const networks = this.safeValue(this.options, 'inverse-networks', {});
|
|
2345
|
-
const networkId = this.safeString(transaction, 'networkName');
|
|
2346
|
-
const network = this.safeString(networks, networkId, networkId);
|
|
2347
2435
|
const address = this.safeString(transaction, 'address');
|
|
2348
2436
|
let addressFrom = undefined;
|
|
2349
2437
|
let addressTo = undefined;
|
|
@@ -2371,7 +2459,7 @@ export default class lbank extends Exchange {
|
|
|
2371
2459
|
'txid': txid,
|
|
2372
2460
|
'timestamp': timestamp,
|
|
2373
2461
|
'datetime': this.iso8601(timestamp),
|
|
2374
|
-
'network':
|
|
2462
|
+
'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
|
|
2375
2463
|
'address': address,
|
|
2376
2464
|
'addressTo': addressTo,
|
|
2377
2465
|
'addressFrom': addressFrom,
|
|
@@ -2574,10 +2662,9 @@ export default class lbank extends Exchange {
|
|
|
2574
2662
|
withdrawFees[code] = {};
|
|
2575
2663
|
for (let j = 0; j < networkList.length; j++) {
|
|
2576
2664
|
const networkEntry = networkList[j];
|
|
2577
|
-
const networkId = this.safeString(networkEntry, 'name');
|
|
2578
|
-
const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId);
|
|
2579
2665
|
const fee = this.safeNumber(networkEntry, 'withdrawFee');
|
|
2580
2666
|
if (fee !== undefined) {
|
|
2667
|
+
const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
|
|
2581
2668
|
withdrawFees[code][networkCode] = fee;
|
|
2582
2669
|
}
|
|
2583
2670
|
}
|
|
@@ -2629,8 +2716,7 @@ export default class lbank extends Exchange {
|
|
|
2629
2716
|
if (canWithdraw === 'true') {
|
|
2630
2717
|
const currencyId = this.safeString(item, 'assetCode');
|
|
2631
2718
|
const codeInner = this.safeCurrencyCode(currencyId);
|
|
2632
|
-
|
|
2633
|
-
let network = this.safeString(this.options['inverse-networks'], chain, chain);
|
|
2719
|
+
let network = this.networkIdToCode(this.safeString(item, 'chain'));
|
|
2634
2720
|
if (network === undefined) {
|
|
2635
2721
|
network = codeInner;
|
|
2636
2722
|
}
|
|
@@ -2781,8 +2867,7 @@ export default class lbank extends Exchange {
|
|
|
2781
2867
|
const resultCodeInfo = result[code]['info'];
|
|
2782
2868
|
resultCodeInfo.push(fee);
|
|
2783
2869
|
}
|
|
2784
|
-
const
|
|
2785
|
-
const networkCode = this.safeString(this.options['inverse-networks'], chain, chain);
|
|
2870
|
+
const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
|
|
2786
2871
|
if (networkCode !== undefined) {
|
|
2787
2872
|
result[code]['networks'][networkCode] = {
|
|
2788
2873
|
'withdraw': {
|
|
@@ -2838,8 +2923,7 @@ export default class lbank extends Exchange {
|
|
|
2838
2923
|
const networkList = this.safeValue(fee, 'networkList', []);
|
|
2839
2924
|
for (let j = 0; j < networkList.length; j++) {
|
|
2840
2925
|
const networkEntry = networkList[j];
|
|
2841
|
-
const
|
|
2842
|
-
const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId);
|
|
2926
|
+
const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
|
|
2843
2927
|
const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
|
|
2844
2928
|
const isDefault = this.safeValue(networkEntry, 'isDefault');
|
|
2845
2929
|
if (withdrawFee !== undefined) {
|
package/js/src/mexc.js
CHANGED
package/js/src/modetrade.js
CHANGED
|
@@ -1705,7 +1705,7 @@ export default class modetrade extends Exchange {
|
|
|
1705
1705
|
//
|
|
1706
1706
|
// {
|
|
1707
1707
|
// "success": true,
|
|
1708
|
-
// "timestamp":
|
|
1708
|
+
// "timestamp": 1702989203988,
|
|
1709
1709
|
// "data": {
|
|
1710
1710
|
// "status": "CANCEL_SENT"
|
|
1711
1711
|
// }
|
|
@@ -1713,7 +1713,7 @@ export default class modetrade extends Exchange {
|
|
|
1713
1713
|
//
|
|
1714
1714
|
// {
|
|
1715
1715
|
// "success": true,
|
|
1716
|
-
// "timestamp":
|
|
1716
|
+
// "timestamp": 1702989203988,
|
|
1717
1717
|
// "status": "CANCEL_SENT"
|
|
1718
1718
|
// }
|
|
1719
1719
|
//
|
package/js/src/okx.d.ts
CHANGED
|
@@ -807,7 +807,7 @@ export default class okx extends Exchange {
|
|
|
807
807
|
/**
|
|
808
808
|
* @method
|
|
809
809
|
* @name okx#fetchBorrowInterest
|
|
810
|
-
* @description fetch the interest owed
|
|
810
|
+
* @description fetch the interest owed b the user for borrowing currency for margin trading
|
|
811
811
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
812
812
|
* @param {string} code the unified currency code for the currency of the interest
|
|
813
813
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
package/js/src/okx.js
CHANGED
|
@@ -5145,7 +5145,7 @@ export default class okx extends Exchange {
|
|
|
5145
5145
|
let fee = this.safeString(params, 'fee');
|
|
5146
5146
|
if (fee === undefined) {
|
|
5147
5147
|
const currencies = await this.fetchCurrencies();
|
|
5148
|
-
this.currencies = this.deepExtend(this.currencies, currencies);
|
|
5148
|
+
this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
|
|
5149
5149
|
const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
|
|
5150
5150
|
fee = this.safeString(targetNetwork, 'fee');
|
|
5151
5151
|
if (fee === undefined) {
|
|
@@ -7200,7 +7200,7 @@ export default class okx extends Exchange {
|
|
|
7200
7200
|
/**
|
|
7201
7201
|
* @method
|
|
7202
7202
|
* @name okx#fetchBorrowInterest
|
|
7203
|
-
* @description fetch the interest owed
|
|
7203
|
+
* @description fetch the interest owed b the user for borrowing currency for margin trading
|
|
7204
7204
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7205
7205
|
* @param {string} code the unified currency code for the currency of the interest
|
|
7206
7206
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
package/js/src/p2b.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Market } from '../ccxt.js';
|
|
2
1
|
import Exchange from './abstract/p2b.js';
|
|
3
|
-
import type { Dict, Int, Num, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, int } from './base/types.js';
|
|
2
|
+
import type { Dict, Int, Num, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, int, Market } from './base/types.js';
|
|
4
3
|
/**
|
|
5
4
|
* @class p2b
|
|
6
5
|
* @augments Exchange
|
package/js/src/paradex.js
CHANGED
|
@@ -792,7 +792,7 @@ export default class paradex extends Exchange {
|
|
|
792
792
|
// "ask": "69578.2",
|
|
793
793
|
// "volume_24h": "5815541.397939004",
|
|
794
794
|
// "total_volume": "584031465.525259686",
|
|
795
|
-
// "created_at":
|
|
795
|
+
// "created_at": 1718170156581,
|
|
796
796
|
// "underlying_price": "67367.37268422",
|
|
797
797
|
// "open_interest": "162.272",
|
|
798
798
|
// "funding_rate": "0.01629574927887",
|
package/js/src/pro/bitstamp.js
CHANGED
|
@@ -523,7 +523,7 @@ export default class bitstamp extends bitstampRest {
|
|
|
523
523
|
//
|
|
524
524
|
const sessionToken = this.safeString(response, 'token');
|
|
525
525
|
if (sessionToken !== undefined) {
|
|
526
|
-
const userId = this.
|
|
526
|
+
const userId = this.safeString(response, 'user_id');
|
|
527
527
|
const validity = this.safeIntegerProduct(response, 'valid_sec', 1000);
|
|
528
528
|
this.options['expiresIn'] = this.sum(time, validity);
|
|
529
529
|
this.options['userId'] = userId;
|
package/js/src/pro/bybit.d.ts
CHANGED
|
@@ -360,7 +360,6 @@ export default class bybit extends bybitRest {
|
|
|
360
360
|
unWatchOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
361
361
|
handleOrderWs(client: Client, message: any): void;
|
|
362
362
|
handleOrder(client: Client, message: any): void;
|
|
363
|
-
parseWsSpotOrder(order: any, market?: any): Order;
|
|
364
363
|
/**
|
|
365
364
|
* @method
|
|
366
365
|
* @name bybit#watchBalance
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import bybitRest from '../bybit.js';
|
|
9
|
-
import { ArgumentsRequired, AuthenticationError, ExchangeError, BadRequest } from '../base/errors.js';
|
|
9
|
+
import { ArgumentsRequired, AuthenticationError, ExchangeError, BadRequest, NotSupported } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
|
|
11
11
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -1282,11 +1282,10 @@ export default class bybit extends bybitRest {
|
|
|
1282
1282
|
async unWatchMyTrades(symbol = undefined, params = {}) {
|
|
1283
1283
|
const method = 'watchMyTrades';
|
|
1284
1284
|
const messageHash = 'unsubscribe:myTrades';
|
|
1285
|
-
|
|
1285
|
+
const subHash = 'myTrades';
|
|
1286
1286
|
await this.loadMarkets();
|
|
1287
1287
|
if (symbol !== undefined) {
|
|
1288
|
-
|
|
1289
|
-
subHash += ':' + symbol;
|
|
1288
|
+
throw new NotSupported(this.id + ' unWatchMyTrades() does not support a symbol parameter, you must unwatch all my trades');
|
|
1290
1289
|
}
|
|
1291
1290
|
const url = await this.getUrlByMarketType(symbol, true, method, params);
|
|
1292
1291
|
await this.authenticate(url);
|
|
@@ -1731,10 +1730,9 @@ export default class bybit extends bybitRest {
|
|
|
1731
1730
|
await this.loadMarkets();
|
|
1732
1731
|
const method = 'watchOrders';
|
|
1733
1732
|
const messageHash = 'unsubscribe:orders';
|
|
1734
|
-
|
|
1733
|
+
const subHash = 'orders';
|
|
1735
1734
|
if (symbol !== undefined) {
|
|
1736
|
-
|
|
1737
|
-
subHash += ':' + symbol;
|
|
1735
|
+
throw new NotSupported(this.id + ' unWatchOrders() does not support a symbol parameter, you must unwatch all orders');
|
|
1738
1736
|
}
|
|
1739
1737
|
const url = await this.getUrlByMarketType(symbol, true, method, params);
|
|
1740
1738
|
await this.authenticate(url);
|
|
@@ -1870,13 +1868,12 @@ export default class bybit extends bybitRest {
|
|
|
1870
1868
|
}
|
|
1871
1869
|
const symbols = {};
|
|
1872
1870
|
for (let i = 0; i < rawOrders.length; i++) {
|
|
1873
|
-
|
|
1874
|
-
if (isSpot) {
|
|
1875
|
-
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}
|
|
1871
|
+
const parsed = this.parseOrder(rawOrders[i]);
|
|
1872
|
+
// if (isSpot) {
|
|
1873
|
+
// parsed = this.parseWsSpotOrder (rawOrders[i]);
|
|
1874
|
+
// } else {
|
|
1875
|
+
// parsed = this.parseOrder (rawOrders[i]);
|
|
1876
|
+
// }
|
|
1880
1877
|
const symbol = parsed['symbol'];
|
|
1881
1878
|
symbols[symbol] = true;
|
|
1882
1879
|
orders.append(parsed);
|
|
@@ -1889,142 +1886,6 @@ export default class bybit extends bybitRest {
|
|
|
1889
1886
|
const messageHash = 'orders';
|
|
1890
1887
|
client.resolve(orders, messageHash);
|
|
1891
1888
|
}
|
|
1892
|
-
parseWsSpotOrder(order, market = undefined) {
|
|
1893
|
-
//
|
|
1894
|
-
// {
|
|
1895
|
-
// "e": "executionReport",
|
|
1896
|
-
// "E": "1653297251061", // timestamp
|
|
1897
|
-
// "s": "LTCUSDT", // symbol
|
|
1898
|
-
// "c": "1653297250740", // user id
|
|
1899
|
-
// "S": "SELL", // side
|
|
1900
|
-
// "o": "MARKET_OF_BASE", // order type
|
|
1901
|
-
// "f": "GTC", // time in force
|
|
1902
|
-
// "q": "0.16233", // quantity
|
|
1903
|
-
// "p": "0", // price
|
|
1904
|
-
// "X": "NEW", // status
|
|
1905
|
-
// "i": "1162336018974750208", // order id
|
|
1906
|
-
// "M": "0",
|
|
1907
|
-
// "l": "0", // last filled
|
|
1908
|
-
// "z": "0", // total filled
|
|
1909
|
-
// "L": "0", // last traded price
|
|
1910
|
-
// "n": "0", // trading fee
|
|
1911
|
-
// "N": '', // fee asset
|
|
1912
|
-
// "u": true,
|
|
1913
|
-
// "w": true,
|
|
1914
|
-
// "m": false, // is limit_maker
|
|
1915
|
-
// "O": "1653297251042", // order creation
|
|
1916
|
-
// "Z": "0", // total filled
|
|
1917
|
-
// "A": "0", // account id
|
|
1918
|
-
// "C": false, // is close
|
|
1919
|
-
// "v": "0", // leverage
|
|
1920
|
-
// "d": "NO_LIQ"
|
|
1921
|
-
// }
|
|
1922
|
-
// v5
|
|
1923
|
-
// {
|
|
1924
|
-
// "category":"spot",
|
|
1925
|
-
// "symbol":"LTCUSDT",
|
|
1926
|
-
// "orderId":"1474764674982492160",
|
|
1927
|
-
// "orderLinkId":"1690541649154749",
|
|
1928
|
-
// "blockTradeId":"",
|
|
1929
|
-
// "side":"Buy",
|
|
1930
|
-
// "positionIdx":0,
|
|
1931
|
-
// "orderStatus":"Cancelled",
|
|
1932
|
-
// "cancelType":"UNKNOWN",
|
|
1933
|
-
// "rejectReason":"EC_NoError",
|
|
1934
|
-
// "timeInForce":"GTC",
|
|
1935
|
-
// "isLeverage":"0",
|
|
1936
|
-
// "price":"0",
|
|
1937
|
-
// "qty":"5.00000",
|
|
1938
|
-
// "avgPrice":"0",
|
|
1939
|
-
// "leavesQty":"0.00000",
|
|
1940
|
-
// "leavesValue":"5.0000000",
|
|
1941
|
-
// "cumExecQty":"0.00000",
|
|
1942
|
-
// "cumExecValue":"0.0000000",
|
|
1943
|
-
// "cumExecFee":"",
|
|
1944
|
-
// "orderType":"Market",
|
|
1945
|
-
// "stopOrderType":"",
|
|
1946
|
-
// "orderIv":"",
|
|
1947
|
-
// "triggerPrice":"0.000",
|
|
1948
|
-
// "takeProfit":"",
|
|
1949
|
-
// "stopLoss":"",
|
|
1950
|
-
// "triggerBy":"",
|
|
1951
|
-
// "tpTriggerBy":"",
|
|
1952
|
-
// "slTriggerBy":"",
|
|
1953
|
-
// "triggerDirection":0,
|
|
1954
|
-
// "placeType":"",
|
|
1955
|
-
// "lastPriceOnCreated":"0.000",
|
|
1956
|
-
// "closeOnTrigger":false,
|
|
1957
|
-
// "reduceOnly":false,
|
|
1958
|
-
// "smpGroup":0,
|
|
1959
|
-
// "smpType":"None",
|
|
1960
|
-
// "smpOrderId":"",
|
|
1961
|
-
// "createdTime":"1690541649160",
|
|
1962
|
-
// "updatedTime":"1690541649168"
|
|
1963
|
-
// }
|
|
1964
|
-
//
|
|
1965
|
-
const id = this.safeString2(order, 'i', 'orderId');
|
|
1966
|
-
const marketId = this.safeString2(order, 's', 'symbol');
|
|
1967
|
-
const symbol = this.safeSymbol(marketId, market, undefined, 'spot');
|
|
1968
|
-
const timestamp = this.safeInteger2(order, 'O', 'createdTime');
|
|
1969
|
-
let price = this.safeString2(order, 'p', 'price');
|
|
1970
|
-
if (price === '0') {
|
|
1971
|
-
price = undefined; // market orders
|
|
1972
|
-
}
|
|
1973
|
-
const filled = this.safeString2(order, 'z', 'cumExecQty');
|
|
1974
|
-
const status = this.parseOrderStatus(this.safeString2(order, 'X', 'orderStatus'));
|
|
1975
|
-
const side = this.safeStringLower2(order, 'S', 'side');
|
|
1976
|
-
const lastTradeTimestamp = this.safeString2(order, 'E', 'updatedTime');
|
|
1977
|
-
const timeInForce = this.safeString2(order, 'f', 'timeInForce');
|
|
1978
|
-
let amount = undefined;
|
|
1979
|
-
const cost = this.safeString2(order, 'Z', 'cumExecValue');
|
|
1980
|
-
let type = this.safeStringLower2(order, 'o', 'orderType');
|
|
1981
|
-
if ((type !== undefined) && (type.indexOf('market') >= 0)) {
|
|
1982
|
-
type = 'market';
|
|
1983
|
-
}
|
|
1984
|
-
if (type === 'market' && side === 'buy') {
|
|
1985
|
-
amount = filled;
|
|
1986
|
-
}
|
|
1987
|
-
else {
|
|
1988
|
-
amount = this.safeString2(order, 'orderQty', 'qty');
|
|
1989
|
-
}
|
|
1990
|
-
let fee = undefined;
|
|
1991
|
-
const feeCost = this.safeString2(order, 'n', 'cumExecFee');
|
|
1992
|
-
if (feeCost !== undefined && feeCost !== '0') {
|
|
1993
|
-
const feeCurrencyId = this.safeString(order, 'N');
|
|
1994
|
-
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1995
|
-
fee = {
|
|
1996
|
-
'cost': feeCost,
|
|
1997
|
-
'currency': feeCurrencyCode,
|
|
1998
|
-
};
|
|
1999
|
-
}
|
|
2000
|
-
const triggerPrice = this.omitZero(this.safeString(order, 'triggerPrice'));
|
|
2001
|
-
return this.safeOrder({
|
|
2002
|
-
'info': order,
|
|
2003
|
-
'id': id,
|
|
2004
|
-
'clientOrderId': this.safeString2(order, 'c', 'orderLinkId'),
|
|
2005
|
-
'timestamp': timestamp,
|
|
2006
|
-
'datetime': this.iso8601(timestamp),
|
|
2007
|
-
'lastTradeTimestamp': lastTradeTimestamp,
|
|
2008
|
-
'symbol': symbol,
|
|
2009
|
-
'type': type,
|
|
2010
|
-
'timeInForce': timeInForce,
|
|
2011
|
-
'postOnly': undefined,
|
|
2012
|
-
'side': side,
|
|
2013
|
-
'price': price,
|
|
2014
|
-
'stopPrice': triggerPrice,
|
|
2015
|
-
'triggerPrice': triggerPrice,
|
|
2016
|
-
'takeProfitPrice': this.safeString(order, 'takeProfit'),
|
|
2017
|
-
'stopLossPrice': this.safeString(order, 'stopLoss'),
|
|
2018
|
-
'reduceOnly': this.safeValue(order, 'reduceOnly'),
|
|
2019
|
-
'amount': amount,
|
|
2020
|
-
'cost': cost,
|
|
2021
|
-
'average': this.safeString(order, 'avgPrice'),
|
|
2022
|
-
'filled': filled,
|
|
2023
|
-
'remaining': undefined,
|
|
2024
|
-
'status': status,
|
|
2025
|
-
'fee': fee,
|
|
2026
|
-
}, market);
|
|
2027
|
-
}
|
|
2028
1889
|
/**
|
|
2029
1890
|
* @method
|
|
2030
1891
|
* @name bybit#watchBalance
|