ccxt 4.3.2 → 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 +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +22 -0
- package/dist/cjs/src/binance.js +320 -21
- package/dist/cjs/src/bingx.js +2 -2
- package/dist/cjs/src/bitget.js +76 -1
- package/dist/cjs/src/coinbase.js +9 -1
- package/dist/cjs/src/hyperliquid.js +87 -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 +1 -0
- package/js/src/base/Exchange.js +22 -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 +76 -1
- package/js/src/coinbase.js +9 -1
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +87 -13
- 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/jsbn/jsbn.d.ts +1 -1
- 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
|
@@ -312,6 +312,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
312
312
|
// ]
|
|
313
313
|
// ]
|
|
314
314
|
//
|
|
315
|
+
//
|
|
315
316
|
let meta = this.safeDict(response, 0, {});
|
|
316
317
|
meta = this.safeList(meta, 'universe', []);
|
|
317
318
|
const assetCtxs = this.safeDict(response, 1, {});
|
|
@@ -370,10 +371,70 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
370
371
|
// },
|
|
371
372
|
// ],
|
|
372
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
|
+
// ]
|
|
373
433
|
//
|
|
434
|
+
// response differs depending on the environment (mainnet vs sandbox)
|
|
374
435
|
const first = this.safeDict(response, 0, {});
|
|
375
|
-
const meta = this.
|
|
376
|
-
const tokens = this.
|
|
436
|
+
const meta = this.safeList2(first, 'universe', 'spot_infos', []);
|
|
437
|
+
const tokens = this.safeList2(first, 'tokens', 'token_infos', []);
|
|
377
438
|
const markets = [];
|
|
378
439
|
for (let i = 0; i < meta.length; i++) {
|
|
379
440
|
const market = this.safeDict(meta, i, {});
|
|
@@ -389,14 +450,16 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
389
450
|
const maker = this.safeNumber(fees, 'maker');
|
|
390
451
|
const tokensPos = this.safeList(market, 'tokens', []);
|
|
391
452
|
const baseTokenPos = this.safeInteger(tokensPos, 0);
|
|
392
|
-
const quoteTokenPos = this.safeInteger(tokensPos, 1);
|
|
453
|
+
// const quoteTokenPos = this.safeInteger (tokensPos, 1);
|
|
393
454
|
const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
|
|
394
|
-
const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
|
|
395
|
-
const
|
|
396
|
-
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')));
|
|
397
460
|
const baseId = this.numberToString(i + 10000);
|
|
398
461
|
markets.push(this.safeMarketStructure({
|
|
399
|
-
'id':
|
|
462
|
+
'id': marketName,
|
|
400
463
|
'symbol': symbol,
|
|
401
464
|
'base': base,
|
|
402
465
|
'quote': quote,
|
|
@@ -406,14 +469,15 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
406
469
|
'settleId': undefined,
|
|
407
470
|
'type': 'spot',
|
|
408
471
|
'spot': true,
|
|
472
|
+
'subType': undefined,
|
|
409
473
|
'margin': undefined,
|
|
410
474
|
'swap': false,
|
|
411
475
|
'future': false,
|
|
412
476
|
'option': false,
|
|
413
477
|
'active': true,
|
|
414
478
|
'contract': false,
|
|
415
|
-
'linear':
|
|
416
|
-
'inverse':
|
|
479
|
+
'linear': undefined,
|
|
480
|
+
'inverse': undefined,
|
|
417
481
|
'taker': taker,
|
|
418
482
|
'maker': maker,
|
|
419
483
|
'contractSize': undefined,
|
|
@@ -422,8 +486,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
422
486
|
'strike': undefined,
|
|
423
487
|
'optionType': undefined,
|
|
424
488
|
'precision': {
|
|
425
|
-
'amount':
|
|
426
|
-
'price':
|
|
489
|
+
'amount': amountPrecision,
|
|
490
|
+
'price': 5, // significant digits
|
|
427
491
|
},
|
|
428
492
|
'limits': {
|
|
429
493
|
'leverage': {
|
|
@@ -639,7 +703,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
639
703
|
const market = this.market(symbol);
|
|
640
704
|
const request = {
|
|
641
705
|
'type': 'l2Book',
|
|
642
|
-
'coin': market['base'],
|
|
706
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
643
707
|
};
|
|
644
708
|
const response = await this.publicPostInfo(this.extend(request, params));
|
|
645
709
|
//
|
|
@@ -699,7 +763,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
699
763
|
const request = {
|
|
700
764
|
'type': 'candleSnapshot',
|
|
701
765
|
'req': {
|
|
702
|
-
'coin': market['base'],
|
|
766
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
703
767
|
'interval': timeframe,
|
|
704
768
|
'startTime': since,
|
|
705
769
|
'endTime': until,
|
|
@@ -807,6 +871,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
807
871
|
return this.parseTrades(response, market, since, limit);
|
|
808
872
|
}
|
|
809
873
|
amountToPrecision(symbol, amount) {
|
|
874
|
+
const market = this.market(symbol);
|
|
875
|
+
if (market['spot']) {
|
|
876
|
+
return super.amountToPrecision(symbol, amount);
|
|
877
|
+
}
|
|
810
878
|
return this.decimalToPrecision(amount, number.ROUND, this.markets[symbol]['precision']['amount'], this.precisionMode);
|
|
811
879
|
}
|
|
812
880
|
priceToPrecision(symbol, price) {
|
|
@@ -2355,6 +2423,12 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2355
2423
|
}
|
|
2356
2424
|
throw new errors.ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
|
|
2357
2425
|
}
|
|
2426
|
+
coinToMarketId(coin) {
|
|
2427
|
+
if (coin.indexOf('/') > -1) {
|
|
2428
|
+
return coin; // spot
|
|
2429
|
+
}
|
|
2430
|
+
return coin + '/USDC:USDC';
|
|
2431
|
+
}
|
|
2358
2432
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2359
2433
|
if (!response) {
|
|
2360
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
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -60,6 +60,8 @@ class woo extends woo$1 {
|
|
|
60
60
|
'fetchClosedOrders': true,
|
|
61
61
|
'fetchConvertCurrencies': true,
|
|
62
62
|
'fetchConvertQuote': true,
|
|
63
|
+
'fetchConvertTrade': true,
|
|
64
|
+
'fetchConvertTradeHistory': true,
|
|
63
65
|
'fetchCurrencies': true,
|
|
64
66
|
'fetchDepositAddress': true,
|
|
65
67
|
'fetchDeposits': true,
|
|
@@ -3061,6 +3063,96 @@ class woo extends woo$1 {
|
|
|
3061
3063
|
const data = this.safeDict(response, 'data', {});
|
|
3062
3064
|
return this.parseConversion(data);
|
|
3063
3065
|
}
|
|
3066
|
+
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
3067
|
+
/**
|
|
3068
|
+
* @method
|
|
3069
|
+
* @name woo#fetchConvertTrade
|
|
3070
|
+
* @description fetch the data for a conversion trade
|
|
3071
|
+
* @see https://docs.woo.org/#get-quote-trade
|
|
3072
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
3073
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
3074
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3075
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
3076
|
+
*/
|
|
3077
|
+
await this.loadMarkets();
|
|
3078
|
+
const request = {
|
|
3079
|
+
'quoteId': id,
|
|
3080
|
+
};
|
|
3081
|
+
const response = await this.v3PrivateGetConvertTrade(this.extend(request, params));
|
|
3082
|
+
//
|
|
3083
|
+
// {
|
|
3084
|
+
// "success": true,
|
|
3085
|
+
// "data": {
|
|
3086
|
+
// "quoteId": 12,
|
|
3087
|
+
// "buyAsset": "",
|
|
3088
|
+
// "sellAsset": "",
|
|
3089
|
+
// "buyAmount": 12.11,
|
|
3090
|
+
// "sellAmount": 12.11,
|
|
3091
|
+
// "tradeStatus": 12,
|
|
3092
|
+
// "createdTime": ""
|
|
3093
|
+
// }
|
|
3094
|
+
// }
|
|
3095
|
+
//
|
|
3096
|
+
const data = this.safeDict(response, 'data', {});
|
|
3097
|
+
const fromCurrencyId = this.safeString(data, 'sellAsset');
|
|
3098
|
+
const toCurrencyId = this.safeString(data, 'buyAsset');
|
|
3099
|
+
let fromCurrency = undefined;
|
|
3100
|
+
let toCurrency = undefined;
|
|
3101
|
+
if (fromCurrencyId !== undefined) {
|
|
3102
|
+
fromCurrency = this.currency(fromCurrencyId);
|
|
3103
|
+
}
|
|
3104
|
+
if (toCurrencyId !== undefined) {
|
|
3105
|
+
toCurrency = this.currency(toCurrencyId);
|
|
3106
|
+
}
|
|
3107
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
3108
|
+
}
|
|
3109
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3110
|
+
/**
|
|
3111
|
+
* @method
|
|
3112
|
+
* @name woo#fetchConvertTradeHistory
|
|
3113
|
+
* @description fetch the users history of conversion trades
|
|
3114
|
+
* @see https://docs.woo.org/#get-quote-trades
|
|
3115
|
+
* @param {string} [code] the unified currency code
|
|
3116
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
3117
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
3118
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3119
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
3120
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
3121
|
+
*/
|
|
3122
|
+
await this.loadMarkets();
|
|
3123
|
+
let request = {};
|
|
3124
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
3125
|
+
if (since !== undefined) {
|
|
3126
|
+
request['startTime'] = since;
|
|
3127
|
+
}
|
|
3128
|
+
if (limit !== undefined) {
|
|
3129
|
+
request['size'] = limit;
|
|
3130
|
+
}
|
|
3131
|
+
const response = await this.v3PrivateGetConvertTrades(this.extend(request, params));
|
|
3132
|
+
//
|
|
3133
|
+
// {
|
|
3134
|
+
// "success": true,
|
|
3135
|
+
// "data": {
|
|
3136
|
+
// "count": 12,
|
|
3137
|
+
// "tradeVos":[
|
|
3138
|
+
// {
|
|
3139
|
+
// "quoteId": 12,
|
|
3140
|
+
// "buyAsset": "",
|
|
3141
|
+
// "sellAsset": "",
|
|
3142
|
+
// "buyAmount": 12.11,
|
|
3143
|
+
// "sellAmount": 12.11,
|
|
3144
|
+
// "tradeStatus": 12,
|
|
3145
|
+
// "createdTime": ""
|
|
3146
|
+
// }
|
|
3147
|
+
// ...
|
|
3148
|
+
// ]
|
|
3149
|
+
// }
|
|
3150
|
+
// }
|
|
3151
|
+
//
|
|
3152
|
+
const data = this.safeDict(response, 'data', {});
|
|
3153
|
+
const rows = this.safeList(data, 'tradeVos', []);
|
|
3154
|
+
return this.parseConversions(rows, 'sellAsset', 'buyAsset', since, limit);
|
|
3155
|
+
}
|
|
3064
3156
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
3065
3157
|
//
|
|
3066
3158
|
// fetchConvertQuote
|
|
@@ -3085,10 +3177,22 @@ class woo extends woo$1 {
|
|
|
3085
3177
|
// "rftAccepted": 1 // 1 -> success; 2 -> processing; 3 -> fail
|
|
3086
3178
|
// }
|
|
3087
3179
|
//
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3180
|
+
// fetchConvertTrade, fetchConvertTradeHistory
|
|
3181
|
+
//
|
|
3182
|
+
// {
|
|
3183
|
+
// "quoteId": 12,
|
|
3184
|
+
// "buyAsset": "",
|
|
3185
|
+
// "sellAsset": "",
|
|
3186
|
+
// "buyAmount": 12.11,
|
|
3187
|
+
// "sellAmount": 12.11,
|
|
3188
|
+
// "tradeStatus": 12,
|
|
3189
|
+
// "createdTime": ""
|
|
3190
|
+
// }
|
|
3191
|
+
//
|
|
3192
|
+
const timestamp = this.safeInteger2(conversion, 'expireTimestamp', 'createdTime');
|
|
3193
|
+
const fromCurr = this.safeString2(conversion, 'sellToken', 'buyAsset');
|
|
3194
|
+
const fromCode = this.safeCurrencyCode(fromCurr, fromCurrency);
|
|
3195
|
+
const to = this.safeString2(conversion, 'buyToken', 'sellAsset');
|
|
3092
3196
|
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
3093
3197
|
return {
|
|
3094
3198
|
'info': conversion,
|
|
@@ -3096,9 +3200,9 @@ class woo extends woo$1 {
|
|
|
3096
3200
|
'datetime': this.iso8601(timestamp),
|
|
3097
3201
|
'id': this.safeString(conversion, 'quoteId'),
|
|
3098
3202
|
'fromCurrency': fromCode,
|
|
3099
|
-
'fromAmount': this.
|
|
3203
|
+
'fromAmount': this.safeNumber2(conversion, 'sellQuantity', 'sellAmount'),
|
|
3100
3204
|
'toCurrency': toCode,
|
|
3101
|
-
'toAmount': this.
|
|
3205
|
+
'toAmount': this.safeNumber2(conversion, 'buyQuantity', 'buyAmount'),
|
|
3102
3206
|
'price': this.safeNumber(conversion, 'buyPrice'),
|
|
3103
3207
|
'fee': undefined,
|
|
3104
3208
|
};
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.2";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.3';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -1021,6 +1021,7 @@ export default class Exchange {
|
|
|
1021
1021
|
parseMarginMode(marginMode: any, market?: Market): MarginMode;
|
|
1022
1022
|
parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
|
|
1023
1023
|
parseLeverage(leverage: any, market?: Market): Leverage;
|
|
1024
|
+
parseConversions(conversions: any[], fromCurrencyKey?: Str, toCurrencyKey?: Str, since?: Int, limit?: Int, params?: {}): Conversion[];
|
|
1024
1025
|
parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
1025
1026
|
convertExpireDate(date: string): string;
|
|
1026
1027
|
convertExpireDateToMarketIdDate(date: string): string;
|