ccxt 4.3.1 → 4.3.3
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/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +25 -0
- package/dist/cjs/src/binance.js +320 -21
- package/dist/cjs/src/bingx.js +2 -2
- package/dist/cjs/src/bitget.js +81 -4
- package/dist/cjs/src/coinbase.js +11 -2
- package/dist/cjs/src/coinbasepro.js +1 -1
- package/dist/cjs/src/coinex.js +109 -146
- package/dist/cjs/src/cryptocom.js +5 -5
- package/dist/cjs/src/hyperliquid.js +161 -13
- package/dist/cjs/src/okx.js +116 -0
- package/dist/cjs/src/poloniexfutures.js +12 -2
- package/dist/cjs/src/pro/hyperliquid.js +8 -7
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/wazirx.js +2 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -2
- package/dist/cjs/src/woo.js +110 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +25 -0
- package/js/src/base/types.d.ts +5 -0
- package/js/src/binance.d.ts +3 -0
- package/js/src/binance.js +320 -21
- package/js/src/bingx.js +3 -3
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +81 -4
- package/js/src/coinbase.js +11 -2
- package/js/src/coinbasepro.js +1 -1
- package/js/src/coinex.js +109 -146
- package/js/src/cryptocom.js +5 -5
- package/js/src/hyperliquid.d.ts +3 -1
- package/js/src/hyperliquid.js +162 -14
- package/js/src/okx.d.ts +2 -0
- package/js/src/okx.js +116 -0
- package/js/src/poloniexfutures.js +12 -2
- package/js/src/pro/hyperliquid.js +8 -7
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/wazirx.js +2 -1
- package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +24 -357
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -0
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +110 -6
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
37
37
|
'cancelAllOrders': false,
|
|
38
38
|
'cancelOrder': true,
|
|
39
39
|
'cancelOrders': true,
|
|
40
|
+
'cancelOrdersForSymbols': true,
|
|
40
41
|
'closeAllPositions': false,
|
|
41
42
|
'closePosition': false,
|
|
42
43
|
'createMarketBuyOrderWithCost': false,
|
|
@@ -311,6 +312,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
311
312
|
// ]
|
|
312
313
|
// ]
|
|
313
314
|
//
|
|
315
|
+
//
|
|
314
316
|
let meta = this.safeDict(response, 0, {});
|
|
315
317
|
meta = this.safeList(meta, 'universe', []);
|
|
316
318
|
const assetCtxs = this.safeDict(response, 1, {});
|
|
@@ -369,10 +371,70 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
369
371
|
// },
|
|
370
372
|
// ],
|
|
371
373
|
// ];
|
|
374
|
+
// mainnet
|
|
375
|
+
// [
|
|
376
|
+
// {
|
|
377
|
+
// "canonical_tokens2":[
|
|
378
|
+
// 0,
|
|
379
|
+
// 1
|
|
380
|
+
// ],
|
|
381
|
+
// "spot_infos":[
|
|
382
|
+
// {
|
|
383
|
+
// "name":"PURR/USDC",
|
|
384
|
+
// "tokens":[
|
|
385
|
+
// 1,
|
|
386
|
+
// 0
|
|
387
|
+
// ]
|
|
388
|
+
// }
|
|
389
|
+
// ],
|
|
390
|
+
// "token_id_to_token":[
|
|
391
|
+
// [
|
|
392
|
+
// "0x6d1e7cde53ba9467b783cb7c530ce054",
|
|
393
|
+
// 0
|
|
394
|
+
// ],
|
|
395
|
+
// [
|
|
396
|
+
// "0xc1fb593aeffbeb02f85e0308e9956a90",
|
|
397
|
+
// 1
|
|
398
|
+
// ]
|
|
399
|
+
// ],
|
|
400
|
+
// "token_infos":[
|
|
401
|
+
// {
|
|
402
|
+
// "deployer":null,
|
|
403
|
+
// "spec":{
|
|
404
|
+
// "name":"USDC",
|
|
405
|
+
// "szDecimals":"8",
|
|
406
|
+
// "weiDecimals":"8"
|
|
407
|
+
// },
|
|
408
|
+
// "spots":[
|
|
409
|
+
// ]
|
|
410
|
+
// },
|
|
411
|
+
// {
|
|
412
|
+
// "deployer":null,
|
|
413
|
+
// "spec":{
|
|
414
|
+
// "name":"PURR",
|
|
415
|
+
// "szDecimals":"0",
|
|
416
|
+
// "weiDecimals":"5"
|
|
417
|
+
// },
|
|
418
|
+
// "spots":[
|
|
419
|
+
// 0
|
|
420
|
+
// ]
|
|
421
|
+
// }
|
|
422
|
+
// ]
|
|
423
|
+
// },
|
|
424
|
+
// [
|
|
425
|
+
// {
|
|
426
|
+
// "dayNtlVlm":"35001170.16631",
|
|
427
|
+
// "markPx":"0.15743",
|
|
428
|
+
// "midPx":"0.157555",
|
|
429
|
+
// "prevDayPx":"0.158"
|
|
430
|
+
// }
|
|
431
|
+
// ]
|
|
432
|
+
// ]
|
|
372
433
|
//
|
|
434
|
+
// response differs depending on the environment (mainnet vs sandbox)
|
|
373
435
|
const first = this.safeDict(response, 0, {});
|
|
374
|
-
const meta = this.
|
|
375
|
-
const tokens = this.
|
|
436
|
+
const meta = this.safeList2(first, 'universe', 'spot_infos', []);
|
|
437
|
+
const tokens = this.safeList2(first, 'tokens', 'token_infos', []);
|
|
376
438
|
const markets = [];
|
|
377
439
|
for (let i = 0; i < meta.length; i++) {
|
|
378
440
|
const market = this.safeDict(meta, i, {});
|
|
@@ -388,14 +450,16 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
388
450
|
const maker = this.safeNumber(fees, 'maker');
|
|
389
451
|
const tokensPos = this.safeList(market, 'tokens', []);
|
|
390
452
|
const baseTokenPos = this.safeInteger(tokensPos, 0);
|
|
391
|
-
const quoteTokenPos = this.safeInteger(tokensPos, 1);
|
|
453
|
+
// const quoteTokenPos = this.safeInteger (tokensPos, 1);
|
|
392
454
|
const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
|
|
393
|
-
const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
|
|
394
|
-
const
|
|
395
|
-
const
|
|
455
|
+
// const quoteTokenInfo = this.safeDict (tokens, quoteTokenPos, {});
|
|
456
|
+
const innerBaseTokenInfo = this.safeDict(baseTokenInfo, 'spec', baseTokenInfo);
|
|
457
|
+
// const innerQuoteTokenInfo = this.safeDict (quoteTokenInfo, 'spec', quoteTokenInfo);
|
|
458
|
+
const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(innerBaseTokenInfo, 'szDecimals')));
|
|
459
|
+
// const quotePrecision = this.parseNumber (this.parsePrecision (this.safeString (innerQuoteTokenInfo, 'szDecimals')));
|
|
396
460
|
const baseId = this.numberToString(i + 10000);
|
|
397
461
|
markets.push(this.safeMarketStructure({
|
|
398
|
-
'id':
|
|
462
|
+
'id': marketName,
|
|
399
463
|
'symbol': symbol,
|
|
400
464
|
'base': base,
|
|
401
465
|
'quote': quote,
|
|
@@ -405,14 +469,15 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
405
469
|
'settleId': undefined,
|
|
406
470
|
'type': 'spot',
|
|
407
471
|
'spot': true,
|
|
472
|
+
'subType': undefined,
|
|
408
473
|
'margin': undefined,
|
|
409
474
|
'swap': false,
|
|
410
475
|
'future': false,
|
|
411
476
|
'option': false,
|
|
412
477
|
'active': true,
|
|
413
478
|
'contract': false,
|
|
414
|
-
'linear':
|
|
415
|
-
'inverse':
|
|
479
|
+
'linear': undefined,
|
|
480
|
+
'inverse': undefined,
|
|
416
481
|
'taker': taker,
|
|
417
482
|
'maker': maker,
|
|
418
483
|
'contractSize': undefined,
|
|
@@ -421,8 +486,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
421
486
|
'strike': undefined,
|
|
422
487
|
'optionType': undefined,
|
|
423
488
|
'precision': {
|
|
424
|
-
'amount':
|
|
425
|
-
'price':
|
|
489
|
+
'amount': amountPrecision,
|
|
490
|
+
'price': 5, // significant digits
|
|
426
491
|
},
|
|
427
492
|
'limits': {
|
|
428
493
|
'leverage': {
|
|
@@ -638,7 +703,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
638
703
|
const market = this.market(symbol);
|
|
639
704
|
const request = {
|
|
640
705
|
'type': 'l2Book',
|
|
641
|
-
'coin': market['base'],
|
|
706
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
642
707
|
};
|
|
643
708
|
const response = await this.publicPostInfo(this.extend(request, params));
|
|
644
709
|
//
|
|
@@ -698,7 +763,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
698
763
|
const request = {
|
|
699
764
|
'type': 'candleSnapshot',
|
|
700
765
|
'req': {
|
|
701
|
-
'coin': market['base'],
|
|
766
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
702
767
|
'interval': timeframe,
|
|
703
768
|
'startTime': since,
|
|
704
769
|
'endTime': until,
|
|
@@ -806,6 +871,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
806
871
|
return this.parseTrades(response, market, since, limit);
|
|
807
872
|
}
|
|
808
873
|
amountToPrecision(symbol, amount) {
|
|
874
|
+
const market = this.market(symbol);
|
|
875
|
+
if (market['spot']) {
|
|
876
|
+
return super.amountToPrecision(symbol, amount);
|
|
877
|
+
}
|
|
809
878
|
return this.decimalToPrecision(amount, number.ROUND, this.markets[symbol]['precision']['amount'], this.precisionMode);
|
|
810
879
|
}
|
|
811
880
|
priceToPrecision(symbol, price) {
|
|
@@ -1219,6 +1288,79 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1219
1288
|
//
|
|
1220
1289
|
return response;
|
|
1221
1290
|
}
|
|
1291
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
1292
|
+
/**
|
|
1293
|
+
* @method
|
|
1294
|
+
* @name hyperliquid#cancelOrdersForSymbols
|
|
1295
|
+
* @description cancel multiple orders for multiple symbols
|
|
1296
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
1297
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
1298
|
+
* @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
|
|
1299
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1300
|
+
* @param {string} [params.vaultAddress] the vault address
|
|
1301
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1302
|
+
*/
|
|
1303
|
+
this.checkRequiredCredentials();
|
|
1304
|
+
await this.loadMarkets();
|
|
1305
|
+
const nonce = this.milliseconds();
|
|
1306
|
+
const request = {
|
|
1307
|
+
'nonce': nonce,
|
|
1308
|
+
// 'vaultAddress': vaultAddress,
|
|
1309
|
+
};
|
|
1310
|
+
const cancelReq = [];
|
|
1311
|
+
const cancelAction = {
|
|
1312
|
+
'type': '',
|
|
1313
|
+
'cancels': [],
|
|
1314
|
+
};
|
|
1315
|
+
let cancelByCloid = false;
|
|
1316
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1317
|
+
const order = orders[i];
|
|
1318
|
+
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1319
|
+
if (clientOrderId !== undefined) {
|
|
1320
|
+
cancelByCloid = true;
|
|
1321
|
+
}
|
|
1322
|
+
const id = this.safeString(order, 'id');
|
|
1323
|
+
const symbol = this.safeString(order, 'symbol');
|
|
1324
|
+
if (symbol === undefined) {
|
|
1325
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrdersForSymbols() requires a symbol argument in each order');
|
|
1326
|
+
}
|
|
1327
|
+
if (id !== undefined && cancelByCloid) {
|
|
1328
|
+
throw new errors.BadRequest(this.id + ' cancelOrdersForSymbols() all orders must have either id or clientOrderId');
|
|
1329
|
+
}
|
|
1330
|
+
const assetKey = cancelByCloid ? 'asset' : 'a';
|
|
1331
|
+
const idKey = cancelByCloid ? 'cloid' : 'o';
|
|
1332
|
+
const market = this.market(symbol);
|
|
1333
|
+
const cancelObj = {};
|
|
1334
|
+
cancelObj[assetKey] = this.parseToNumeric(market['baseId']);
|
|
1335
|
+
cancelObj[idKey] = cancelByCloid ? clientOrderId : this.parseToNumeric(id);
|
|
1336
|
+
cancelReq.push(cancelObj);
|
|
1337
|
+
}
|
|
1338
|
+
cancelAction['type'] = cancelByCloid ? 'cancelByCloid' : 'cancel';
|
|
1339
|
+
cancelAction['cancels'] = cancelReq;
|
|
1340
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1341
|
+
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
1342
|
+
request['action'] = cancelAction;
|
|
1343
|
+
request['signature'] = signature;
|
|
1344
|
+
if (vaultAddress !== undefined) {
|
|
1345
|
+
params = this.omit(params, 'vaultAddress');
|
|
1346
|
+
request['vaultAddress'] = vaultAddress;
|
|
1347
|
+
}
|
|
1348
|
+
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1349
|
+
//
|
|
1350
|
+
// {
|
|
1351
|
+
// "status":"ok",
|
|
1352
|
+
// "response":{
|
|
1353
|
+
// "type":"cancel",
|
|
1354
|
+
// "data":{
|
|
1355
|
+
// "statuses":[
|
|
1356
|
+
// "success"
|
|
1357
|
+
// ]
|
|
1358
|
+
// }
|
|
1359
|
+
// }
|
|
1360
|
+
// }
|
|
1361
|
+
//
|
|
1362
|
+
return response;
|
|
1363
|
+
}
|
|
1222
1364
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1223
1365
|
/**
|
|
1224
1366
|
* @method
|
|
@@ -2281,6 +2423,12 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2281
2423
|
}
|
|
2282
2424
|
throw new errors.ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
|
|
2283
2425
|
}
|
|
2426
|
+
coinToMarketId(coin) {
|
|
2427
|
+
if (coin.indexOf('/') > -1) {
|
|
2428
|
+
return coin; // spot
|
|
2429
|
+
}
|
|
2430
|
+
return coin + '/USDC:USDC';
|
|
2431
|
+
}
|
|
2284
2432
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2285
2433
|
if (!response) {
|
|
2286
2434
|
return undefined; // fallback to default error handler
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -63,6 +63,8 @@ class okx extends okx$1 {
|
|
|
63
63
|
'fetchClosedOrders': true,
|
|
64
64
|
'fetchConvertCurrencies': true,
|
|
65
65
|
'fetchConvertQuote': true,
|
|
66
|
+
'fetchConvertTrade': true,
|
|
67
|
+
'fetchConvertTradeHistory': true,
|
|
66
68
|
'fetchCrossBorrowRate': true,
|
|
67
69
|
'fetchCrossBorrowRates': true,
|
|
68
70
|
'fetchCurrencies': true,
|
|
@@ -7712,6 +7714,104 @@ class okx extends okx$1 {
|
|
|
7712
7714
|
const toCurrency = this.currency(toCurrencyId);
|
|
7713
7715
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
7714
7716
|
}
|
|
7717
|
+
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
7718
|
+
/**
|
|
7719
|
+
* @method
|
|
7720
|
+
* @name okx#fetchConvertTrade
|
|
7721
|
+
* @description fetch the data for a conversion trade
|
|
7722
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
7723
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
7724
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
7725
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7726
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7727
|
+
*/
|
|
7728
|
+
await this.loadMarkets();
|
|
7729
|
+
const request = {
|
|
7730
|
+
'clTReqId': id,
|
|
7731
|
+
};
|
|
7732
|
+
const response = await this.privateGetAssetConvertHistory(this.extend(request, params));
|
|
7733
|
+
//
|
|
7734
|
+
// {
|
|
7735
|
+
// "code": "0",
|
|
7736
|
+
// "data": [
|
|
7737
|
+
// {
|
|
7738
|
+
// "clTReqId": "",
|
|
7739
|
+
// "instId": "ETH-USDT",
|
|
7740
|
+
// "side": "buy",
|
|
7741
|
+
// "fillPx": "2932.401044",
|
|
7742
|
+
// "baseCcy": "ETH",
|
|
7743
|
+
// "quoteCcy": "USDT",
|
|
7744
|
+
// "fillBaseSz": "0.01023052",
|
|
7745
|
+
// "state": "fullyFilled",
|
|
7746
|
+
// "tradeId": "trader16461885203381437",
|
|
7747
|
+
// "fillQuoteSz": "30",
|
|
7748
|
+
// "ts": "1646188520000"
|
|
7749
|
+
// }
|
|
7750
|
+
// ],
|
|
7751
|
+
// "msg": ""
|
|
7752
|
+
// }
|
|
7753
|
+
//
|
|
7754
|
+
const data = this.safeList(response, 'data', []);
|
|
7755
|
+
const result = this.safeDict(data, 0, {});
|
|
7756
|
+
const fromCurrencyId = this.safeString(result, 'baseCcy');
|
|
7757
|
+
const toCurrencyId = this.safeString(result, 'quoteCcy');
|
|
7758
|
+
let fromCurrency = undefined;
|
|
7759
|
+
let toCurrency = undefined;
|
|
7760
|
+
if (fromCurrencyId !== undefined) {
|
|
7761
|
+
fromCurrency = this.currency(fromCurrencyId);
|
|
7762
|
+
}
|
|
7763
|
+
if (toCurrencyId !== undefined) {
|
|
7764
|
+
toCurrency = this.currency(toCurrencyId);
|
|
7765
|
+
}
|
|
7766
|
+
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
7767
|
+
}
|
|
7768
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7769
|
+
/**
|
|
7770
|
+
* @method
|
|
7771
|
+
* @name okx#fetchConvertTradeHistory
|
|
7772
|
+
* @description fetch the users history of conversion trades
|
|
7773
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
7774
|
+
* @param {string} [code] the unified currency code
|
|
7775
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
7776
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
7777
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7778
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
7779
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7780
|
+
*/
|
|
7781
|
+
await this.loadMarkets();
|
|
7782
|
+
let request = {};
|
|
7783
|
+
[request, params] = this.handleUntilOption('after', request, params);
|
|
7784
|
+
if (since !== undefined) {
|
|
7785
|
+
request['before'] = since;
|
|
7786
|
+
}
|
|
7787
|
+
if (limit !== undefined) {
|
|
7788
|
+
request['limit'] = limit;
|
|
7789
|
+
}
|
|
7790
|
+
const response = await this.privateGetAssetConvertHistory(this.extend(request, params));
|
|
7791
|
+
//
|
|
7792
|
+
// {
|
|
7793
|
+
// "code": "0",
|
|
7794
|
+
// "data": [
|
|
7795
|
+
// {
|
|
7796
|
+
// "clTReqId": "",
|
|
7797
|
+
// "instId": "ETH-USDT",
|
|
7798
|
+
// "side": "buy",
|
|
7799
|
+
// "fillPx": "2932.401044",
|
|
7800
|
+
// "baseCcy": "ETH",
|
|
7801
|
+
// "quoteCcy": "USDT",
|
|
7802
|
+
// "fillBaseSz": "0.01023052",
|
|
7803
|
+
// "state": "fullyFilled",
|
|
7804
|
+
// "tradeId": "trader16461885203381437",
|
|
7805
|
+
// "fillQuoteSz": "30",
|
|
7806
|
+
// "ts": "1646188520000"
|
|
7807
|
+
// }
|
|
7808
|
+
// ],
|
|
7809
|
+
// "msg": ""
|
|
7810
|
+
// }
|
|
7811
|
+
//
|
|
7812
|
+
const rows = this.safeList(response, 'data', []);
|
|
7813
|
+
return this.parseConversions(rows, 'baseCcy', 'quoteCcy', since, limit);
|
|
7814
|
+
}
|
|
7715
7815
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
7716
7816
|
//
|
|
7717
7817
|
// fetchConvertQuote
|
|
@@ -7749,6 +7849,22 @@ class okx extends okx$1 {
|
|
|
7749
7849
|
// "ts": "1646188520338"
|
|
7750
7850
|
// }
|
|
7751
7851
|
//
|
|
7852
|
+
// fetchConvertTrade, fetchConvertTradeHistory
|
|
7853
|
+
//
|
|
7854
|
+
// {
|
|
7855
|
+
// "clTReqId": "",
|
|
7856
|
+
// "instId": "ETH-USDT",
|
|
7857
|
+
// "side": "buy",
|
|
7858
|
+
// "fillPx": "2932.401044",
|
|
7859
|
+
// "baseCcy": "ETH",
|
|
7860
|
+
// "quoteCcy": "USDT",
|
|
7861
|
+
// "fillBaseSz": "0.01023052",
|
|
7862
|
+
// "state": "fullyFilled",
|
|
7863
|
+
// "tradeId": "trader16461885203381437",
|
|
7864
|
+
// "fillQuoteSz": "30",
|
|
7865
|
+
// "ts": "1646188520000"
|
|
7866
|
+
// }
|
|
7867
|
+
//
|
|
7752
7868
|
const timestamp = this.safeInteger2(conversion, 'quoteTime', 'ts');
|
|
7753
7869
|
const fromCoin = this.safeString(conversion, 'baseCcy');
|
|
7754
7870
|
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
@@ -373,8 +373,18 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
373
373
|
const marketId = this.safeString(ticker, 'symbol');
|
|
374
374
|
const symbol = this.safeSymbol(marketId, market);
|
|
375
375
|
const timestampString = this.safeString(ticker, 'ts');
|
|
376
|
-
// check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011
|
|
377
|
-
|
|
376
|
+
// check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011 and also 17 digits occured
|
|
377
|
+
let multiplier = undefined;
|
|
378
|
+
if (timestampString.length === 17) {
|
|
379
|
+
multiplier = 0.0001;
|
|
380
|
+
}
|
|
381
|
+
else if (timestampString.length === 18) {
|
|
382
|
+
multiplier = 0.00001;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
// 19 length default
|
|
386
|
+
multiplier = 0.000001;
|
|
387
|
+
}
|
|
378
388
|
const timestamp = this.safeIntegerProduct(ticker, 'ts', multiplier);
|
|
379
389
|
const last = this.safeString2(ticker, 'price', 'lastPrice');
|
|
380
390
|
const percentage = Precise["default"].stringMul(this.safeString(ticker, 'priceChgPct'), '100');
|
|
@@ -64,7 +64,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
64
64
|
'method': 'subscribe',
|
|
65
65
|
'subscription': {
|
|
66
66
|
'type': 'l2Book',
|
|
67
|
-
'coin': market['base'],
|
|
67
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
70
|
const message = this.extend(request, params);
|
|
@@ -99,7 +99,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
99
99
|
//
|
|
100
100
|
const entry = this.safeDict(message, 'data', {});
|
|
101
101
|
const coin = this.safeString(entry, 'coin');
|
|
102
|
-
const marketId = coin
|
|
102
|
+
const marketId = this.coinToMarketId(coin);
|
|
103
103
|
const market = this.market(marketId);
|
|
104
104
|
const symbol = market['symbol'];
|
|
105
105
|
const rawData = this.safeList(entry, 'levels', []);
|
|
@@ -230,7 +230,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
230
230
|
'method': 'subscribe',
|
|
231
231
|
'subscription': {
|
|
232
232
|
'type': 'trades',
|
|
233
|
-
'coin': market['base'],
|
|
233
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
234
234
|
},
|
|
235
235
|
};
|
|
236
236
|
const message = this.extend(request, params);
|
|
@@ -260,7 +260,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
260
260
|
const entry = this.safeList(message, 'data', []);
|
|
261
261
|
const first = this.safeDict(entry, 0, {});
|
|
262
262
|
const coin = this.safeString(first, 'coin');
|
|
263
|
-
const marketId = coin
|
|
263
|
+
const marketId = this.coinToMarketId(coin);
|
|
264
264
|
const market = this.market(marketId);
|
|
265
265
|
const symbol = market['symbol'];
|
|
266
266
|
if (!(symbol in this.trades)) {
|
|
@@ -315,7 +315,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
315
315
|
const price = this.safeString(trade, 'px');
|
|
316
316
|
const amount = this.safeString(trade, 'sz');
|
|
317
317
|
const coin = this.safeString(trade, 'coin');
|
|
318
|
-
const marketId = coin
|
|
318
|
+
const marketId = this.coinToMarketId(coin);
|
|
319
319
|
market = this.safeMarket(marketId, undefined);
|
|
320
320
|
const symbol = market['symbol'];
|
|
321
321
|
const id = this.safeString(trade, 'tid');
|
|
@@ -360,7 +360,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
360
360
|
'method': 'subscribe',
|
|
361
361
|
'subscription': {
|
|
362
362
|
'type': 'candle',
|
|
363
|
-
'coin': market['base'],
|
|
363
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
364
364
|
'interval': timeframe,
|
|
365
365
|
},
|
|
366
366
|
};
|
|
@@ -392,7 +392,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
392
392
|
//
|
|
393
393
|
const data = this.safeDict(message, 'data', {});
|
|
394
394
|
const base = this.safeString(data, 's');
|
|
395
|
-
const
|
|
395
|
+
const marketId = this.coinToMarketId(base);
|
|
396
|
+
const symbol = this.safeSymbol(marketId);
|
|
396
397
|
const timeframe = this.safeString(data, 'i');
|
|
397
398
|
if (!(symbol in this.ohlcvs)) {
|
|
398
399
|
this.ohlcvs[symbol] = {};
|
|
@@ -1320,7 +1320,7 @@ class kraken extends kraken$1 {
|
|
|
1320
1320
|
},
|
|
1321
1321
|
};
|
|
1322
1322
|
const url = this.urls['api']['ws']['public'];
|
|
1323
|
-
return await this.watchMultiple(url, messageHashes, this.
|
|
1323
|
+
return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), messageHashes, subscriptionArgs);
|
|
1324
1324
|
}
|
|
1325
1325
|
getMessageHash(unifiedElementName, subChannelName = undefined, symbol = undefined) {
|
|
1326
1326
|
// unifiedElementName can be : orderbook, trade, ticker, bidask ...
|
|
@@ -746,7 +746,8 @@ class wazirx extends wazirx$1 {
|
|
|
746
746
|
};
|
|
747
747
|
const streams = Object.keys(streamHandlers);
|
|
748
748
|
for (let i = 0; i < streams.length; i++) {
|
|
749
|
-
|
|
749
|
+
const streamContains = stream.indexOf(streams[i]) > -1;
|
|
750
|
+
if (streamContains) {
|
|
750
751
|
const handler = streamHandlers[streams[i]];
|
|
751
752
|
handler.call(this, client, message);
|
|
752
753
|
return;
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsbn = require('../jsbn/jsbn.js');
|
|
6
6
|
var yahoo = require('./yahoo.js');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
*/
|
|
8
|
+
// @ts-nocheck
|
|
10
9
|
/**
|
|
11
10
|
* @fileOverview
|
|
12
11
|
* @name asn1-1.0.js
|
|
@@ -30,6 +29,32 @@ var yahoo = require('./yahoo.js');
|
|
|
30
29
|
* @name KJUR
|
|
31
30
|
* @namespace kjur's class library name space
|
|
32
31
|
*/
|
|
32
|
+
// interface kjur_interface {
|
|
33
|
+
// asn1: {
|
|
34
|
+
// ASN1Object: any;
|
|
35
|
+
// ASN1Util: any;
|
|
36
|
+
// DERAbstractString: any;
|
|
37
|
+
// DERAbstractStructured: any;
|
|
38
|
+
// DERAbstractTime: any;
|
|
39
|
+
// DERBitString: any;
|
|
40
|
+
// DERBoolean: any;
|
|
41
|
+
// DEREnumerated: any;
|
|
42
|
+
// DERGeneralizedTime: any;
|
|
43
|
+
// DERIA5String: any;
|
|
44
|
+
// DERInteger: any;
|
|
45
|
+
// DERNull: any;
|
|
46
|
+
// DERNumericString: any;
|
|
47
|
+
// DERObjectIdentifier: any;
|
|
48
|
+
// DEROctetString: any;
|
|
49
|
+
// DERPrintableString: any;
|
|
50
|
+
// DERSequence: any;
|
|
51
|
+
// DERSet: any;
|
|
52
|
+
// DERTaggedObject: any;
|
|
53
|
+
// DERTeletexString: any;
|
|
54
|
+
// DERUTCTime: any;
|
|
55
|
+
// DERUTF8String: any;
|
|
56
|
+
// }
|
|
57
|
+
// };
|
|
33
58
|
var KJUR = {};
|
|
34
59
|
/**
|
|
35
60
|
* kjur's ASN.1 class library name space
|