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
package/js/src/hyperliquid.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/hyperliquid.js';
|
|
9
|
-
import { ExchangeError, ArgumentsRequired, NotSupported, InvalidOrder, OrderNotFound } from './base/errors.js';
|
|
9
|
+
import { ExchangeError, ArgumentsRequired, NotSupported, InvalidOrder, OrderNotFound, BadRequest } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE, ROUND, SIGNIFICANT_DIGITS, DECIMAL_PLACES } from './base/functions/number.js';
|
|
12
12
|
import { keccak_256 as keccak } from './static_dependencies/noble-hashes/sha3.js';
|
|
@@ -40,6 +40,7 @@ export default class hyperliquid extends Exchange {
|
|
|
40
40
|
'cancelAllOrders': false,
|
|
41
41
|
'cancelOrder': true,
|
|
42
42
|
'cancelOrders': true,
|
|
43
|
+
'cancelOrdersForSymbols': true,
|
|
43
44
|
'closeAllPositions': false,
|
|
44
45
|
'closePosition': false,
|
|
45
46
|
'createMarketBuyOrderWithCost': false,
|
|
@@ -314,6 +315,7 @@ export default class hyperliquid extends Exchange {
|
|
|
314
315
|
// ]
|
|
315
316
|
// ]
|
|
316
317
|
//
|
|
318
|
+
//
|
|
317
319
|
let meta = this.safeDict(response, 0, {});
|
|
318
320
|
meta = this.safeList(meta, 'universe', []);
|
|
319
321
|
const assetCtxs = this.safeDict(response, 1, {});
|
|
@@ -372,10 +374,70 @@ export default class hyperliquid extends Exchange {
|
|
|
372
374
|
// },
|
|
373
375
|
// ],
|
|
374
376
|
// ];
|
|
377
|
+
// mainnet
|
|
378
|
+
// [
|
|
379
|
+
// {
|
|
380
|
+
// "canonical_tokens2":[
|
|
381
|
+
// 0,
|
|
382
|
+
// 1
|
|
383
|
+
// ],
|
|
384
|
+
// "spot_infos":[
|
|
385
|
+
// {
|
|
386
|
+
// "name":"PURR/USDC",
|
|
387
|
+
// "tokens":[
|
|
388
|
+
// 1,
|
|
389
|
+
// 0
|
|
390
|
+
// ]
|
|
391
|
+
// }
|
|
392
|
+
// ],
|
|
393
|
+
// "token_id_to_token":[
|
|
394
|
+
// [
|
|
395
|
+
// "0x6d1e7cde53ba9467b783cb7c530ce054",
|
|
396
|
+
// 0
|
|
397
|
+
// ],
|
|
398
|
+
// [
|
|
399
|
+
// "0xc1fb593aeffbeb02f85e0308e9956a90",
|
|
400
|
+
// 1
|
|
401
|
+
// ]
|
|
402
|
+
// ],
|
|
403
|
+
// "token_infos":[
|
|
404
|
+
// {
|
|
405
|
+
// "deployer":null,
|
|
406
|
+
// "spec":{
|
|
407
|
+
// "name":"USDC",
|
|
408
|
+
// "szDecimals":"8",
|
|
409
|
+
// "weiDecimals":"8"
|
|
410
|
+
// },
|
|
411
|
+
// "spots":[
|
|
412
|
+
// ]
|
|
413
|
+
// },
|
|
414
|
+
// {
|
|
415
|
+
// "deployer":null,
|
|
416
|
+
// "spec":{
|
|
417
|
+
// "name":"PURR",
|
|
418
|
+
// "szDecimals":"0",
|
|
419
|
+
// "weiDecimals":"5"
|
|
420
|
+
// },
|
|
421
|
+
// "spots":[
|
|
422
|
+
// 0
|
|
423
|
+
// ]
|
|
424
|
+
// }
|
|
425
|
+
// ]
|
|
426
|
+
// },
|
|
427
|
+
// [
|
|
428
|
+
// {
|
|
429
|
+
// "dayNtlVlm":"35001170.16631",
|
|
430
|
+
// "markPx":"0.15743",
|
|
431
|
+
// "midPx":"0.157555",
|
|
432
|
+
// "prevDayPx":"0.158"
|
|
433
|
+
// }
|
|
434
|
+
// ]
|
|
435
|
+
// ]
|
|
375
436
|
//
|
|
437
|
+
// response differs depending on the environment (mainnet vs sandbox)
|
|
376
438
|
const first = this.safeDict(response, 0, {});
|
|
377
|
-
const meta = this.
|
|
378
|
-
const tokens = this.
|
|
439
|
+
const meta = this.safeList2(first, 'universe', 'spot_infos', []);
|
|
440
|
+
const tokens = this.safeList2(first, 'tokens', 'token_infos', []);
|
|
379
441
|
const markets = [];
|
|
380
442
|
for (let i = 0; i < meta.length; i++) {
|
|
381
443
|
const market = this.safeDict(meta, i, {});
|
|
@@ -391,14 +453,16 @@ export default class hyperliquid extends Exchange {
|
|
|
391
453
|
const maker = this.safeNumber(fees, 'maker');
|
|
392
454
|
const tokensPos = this.safeList(market, 'tokens', []);
|
|
393
455
|
const baseTokenPos = this.safeInteger(tokensPos, 0);
|
|
394
|
-
const quoteTokenPos = this.safeInteger(tokensPos, 1);
|
|
456
|
+
// const quoteTokenPos = this.safeInteger (tokensPos, 1);
|
|
395
457
|
const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
|
|
396
|
-
const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
|
|
397
|
-
const
|
|
398
|
-
const
|
|
458
|
+
// const quoteTokenInfo = this.safeDict (tokens, quoteTokenPos, {});
|
|
459
|
+
const innerBaseTokenInfo = this.safeDict(baseTokenInfo, 'spec', baseTokenInfo);
|
|
460
|
+
// const innerQuoteTokenInfo = this.safeDict (quoteTokenInfo, 'spec', quoteTokenInfo);
|
|
461
|
+
const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(innerBaseTokenInfo, 'szDecimals')));
|
|
462
|
+
// const quotePrecision = this.parseNumber (this.parsePrecision (this.safeString (innerQuoteTokenInfo, 'szDecimals')));
|
|
399
463
|
const baseId = this.numberToString(i + 10000);
|
|
400
464
|
markets.push(this.safeMarketStructure({
|
|
401
|
-
'id':
|
|
465
|
+
'id': marketName,
|
|
402
466
|
'symbol': symbol,
|
|
403
467
|
'base': base,
|
|
404
468
|
'quote': quote,
|
|
@@ -408,14 +472,15 @@ export default class hyperliquid extends Exchange {
|
|
|
408
472
|
'settleId': undefined,
|
|
409
473
|
'type': 'spot',
|
|
410
474
|
'spot': true,
|
|
475
|
+
'subType': undefined,
|
|
411
476
|
'margin': undefined,
|
|
412
477
|
'swap': false,
|
|
413
478
|
'future': false,
|
|
414
479
|
'option': false,
|
|
415
480
|
'active': true,
|
|
416
481
|
'contract': false,
|
|
417
|
-
'linear':
|
|
418
|
-
'inverse':
|
|
482
|
+
'linear': undefined,
|
|
483
|
+
'inverse': undefined,
|
|
419
484
|
'taker': taker,
|
|
420
485
|
'maker': maker,
|
|
421
486
|
'contractSize': undefined,
|
|
@@ -424,8 +489,8 @@ export default class hyperliquid extends Exchange {
|
|
|
424
489
|
'strike': undefined,
|
|
425
490
|
'optionType': undefined,
|
|
426
491
|
'precision': {
|
|
427
|
-
'amount':
|
|
428
|
-
'price':
|
|
492
|
+
'amount': amountPrecision,
|
|
493
|
+
'price': 5, // significant digits
|
|
429
494
|
},
|
|
430
495
|
'limits': {
|
|
431
496
|
'leverage': {
|
|
@@ -641,7 +706,7 @@ export default class hyperliquid extends Exchange {
|
|
|
641
706
|
const market = this.market(symbol);
|
|
642
707
|
const request = {
|
|
643
708
|
'type': 'l2Book',
|
|
644
|
-
'coin': market['base'],
|
|
709
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
645
710
|
};
|
|
646
711
|
const response = await this.publicPostInfo(this.extend(request, params));
|
|
647
712
|
//
|
|
@@ -701,7 +766,7 @@ export default class hyperliquid extends Exchange {
|
|
|
701
766
|
const request = {
|
|
702
767
|
'type': 'candleSnapshot',
|
|
703
768
|
'req': {
|
|
704
|
-
'coin': market['base'],
|
|
769
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
705
770
|
'interval': timeframe,
|
|
706
771
|
'startTime': since,
|
|
707
772
|
'endTime': until,
|
|
@@ -809,6 +874,10 @@ export default class hyperliquid extends Exchange {
|
|
|
809
874
|
return this.parseTrades(response, market, since, limit);
|
|
810
875
|
}
|
|
811
876
|
amountToPrecision(symbol, amount) {
|
|
877
|
+
const market = this.market(symbol);
|
|
878
|
+
if (market['spot']) {
|
|
879
|
+
return super.amountToPrecision(symbol, amount);
|
|
880
|
+
}
|
|
812
881
|
return this.decimalToPrecision(amount, ROUND, this.markets[symbol]['precision']['amount'], this.precisionMode);
|
|
813
882
|
}
|
|
814
883
|
priceToPrecision(symbol, price) {
|
|
@@ -1222,6 +1291,79 @@ export default class hyperliquid extends Exchange {
|
|
|
1222
1291
|
//
|
|
1223
1292
|
return response;
|
|
1224
1293
|
}
|
|
1294
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
1295
|
+
/**
|
|
1296
|
+
* @method
|
|
1297
|
+
* @name hyperliquid#cancelOrdersForSymbols
|
|
1298
|
+
* @description cancel multiple orders for multiple symbols
|
|
1299
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
1300
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
1301
|
+
* @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
|
|
1302
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1303
|
+
* @param {string} [params.vaultAddress] the vault address
|
|
1304
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1305
|
+
*/
|
|
1306
|
+
this.checkRequiredCredentials();
|
|
1307
|
+
await this.loadMarkets();
|
|
1308
|
+
const nonce = this.milliseconds();
|
|
1309
|
+
const request = {
|
|
1310
|
+
'nonce': nonce,
|
|
1311
|
+
// 'vaultAddress': vaultAddress,
|
|
1312
|
+
};
|
|
1313
|
+
const cancelReq = [];
|
|
1314
|
+
const cancelAction = {
|
|
1315
|
+
'type': '',
|
|
1316
|
+
'cancels': [],
|
|
1317
|
+
};
|
|
1318
|
+
let cancelByCloid = false;
|
|
1319
|
+
for (let i = 0; i < orders.length; i++) {
|
|
1320
|
+
const order = orders[i];
|
|
1321
|
+
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1322
|
+
if (clientOrderId !== undefined) {
|
|
1323
|
+
cancelByCloid = true;
|
|
1324
|
+
}
|
|
1325
|
+
const id = this.safeString(order, 'id');
|
|
1326
|
+
const symbol = this.safeString(order, 'symbol');
|
|
1327
|
+
if (symbol === undefined) {
|
|
1328
|
+
throw new ArgumentsRequired(this.id + ' cancelOrdersForSymbols() requires a symbol argument in each order');
|
|
1329
|
+
}
|
|
1330
|
+
if (id !== undefined && cancelByCloid) {
|
|
1331
|
+
throw new BadRequest(this.id + ' cancelOrdersForSymbols() all orders must have either id or clientOrderId');
|
|
1332
|
+
}
|
|
1333
|
+
const assetKey = cancelByCloid ? 'asset' : 'a';
|
|
1334
|
+
const idKey = cancelByCloid ? 'cloid' : 'o';
|
|
1335
|
+
const market = this.market(symbol);
|
|
1336
|
+
const cancelObj = {};
|
|
1337
|
+
cancelObj[assetKey] = this.parseToNumeric(market['baseId']);
|
|
1338
|
+
cancelObj[idKey] = cancelByCloid ? clientOrderId : this.parseToNumeric(id);
|
|
1339
|
+
cancelReq.push(cancelObj);
|
|
1340
|
+
}
|
|
1341
|
+
cancelAction['type'] = cancelByCloid ? 'cancelByCloid' : 'cancel';
|
|
1342
|
+
cancelAction['cancels'] = cancelReq;
|
|
1343
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1344
|
+
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
1345
|
+
request['action'] = cancelAction;
|
|
1346
|
+
request['signature'] = signature;
|
|
1347
|
+
if (vaultAddress !== undefined) {
|
|
1348
|
+
params = this.omit(params, 'vaultAddress');
|
|
1349
|
+
request['vaultAddress'] = vaultAddress;
|
|
1350
|
+
}
|
|
1351
|
+
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1352
|
+
//
|
|
1353
|
+
// {
|
|
1354
|
+
// "status":"ok",
|
|
1355
|
+
// "response":{
|
|
1356
|
+
// "type":"cancel",
|
|
1357
|
+
// "data":{
|
|
1358
|
+
// "statuses":[
|
|
1359
|
+
// "success"
|
|
1360
|
+
// ]
|
|
1361
|
+
// }
|
|
1362
|
+
// }
|
|
1363
|
+
// }
|
|
1364
|
+
//
|
|
1365
|
+
return response;
|
|
1366
|
+
}
|
|
1225
1367
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1226
1368
|
/**
|
|
1227
1369
|
* @method
|
|
@@ -2284,6 +2426,12 @@ export default class hyperliquid extends Exchange {
|
|
|
2284
2426
|
}
|
|
2285
2427
|
throw new ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
|
|
2286
2428
|
}
|
|
2429
|
+
coinToMarketId(coin) {
|
|
2430
|
+
if (coin.indexOf('/') > -1) {
|
|
2431
|
+
return coin; // spot
|
|
2432
|
+
}
|
|
2433
|
+
return coin + '/USDC:USDC';
|
|
2434
|
+
}
|
|
2287
2435
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2288
2436
|
if (!response) {
|
|
2289
2437
|
return undefined; // fallback to default error handler
|
package/js/src/okx.d.ts
CHANGED
|
@@ -299,6 +299,8 @@ export default class okx extends Exchange {
|
|
|
299
299
|
};
|
|
300
300
|
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
301
301
|
createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
302
|
+
fetchConvertTrade(id: string, code?: Str, params?: {}): Promise<Conversion>;
|
|
303
|
+
fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
|
|
302
304
|
parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
303
305
|
fetchConvertCurrencies(params?: {}): Promise<Currencies>;
|
|
304
306
|
handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
package/js/src/okx.js
CHANGED
|
@@ -66,6 +66,8 @@ export default class okx extends Exchange {
|
|
|
66
66
|
'fetchClosedOrders': true,
|
|
67
67
|
'fetchConvertCurrencies': true,
|
|
68
68
|
'fetchConvertQuote': true,
|
|
69
|
+
'fetchConvertTrade': true,
|
|
70
|
+
'fetchConvertTradeHistory': true,
|
|
69
71
|
'fetchCrossBorrowRate': true,
|
|
70
72
|
'fetchCrossBorrowRates': true,
|
|
71
73
|
'fetchCurrencies': true,
|
|
@@ -7715,6 +7717,104 @@ export default class okx extends Exchange {
|
|
|
7715
7717
|
const toCurrency = this.currency(toCurrencyId);
|
|
7716
7718
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
7717
7719
|
}
|
|
7720
|
+
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
7721
|
+
/**
|
|
7722
|
+
* @method
|
|
7723
|
+
* @name okx#fetchConvertTrade
|
|
7724
|
+
* @description fetch the data for a conversion trade
|
|
7725
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
7726
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
7727
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
7728
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7729
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7730
|
+
*/
|
|
7731
|
+
await this.loadMarkets();
|
|
7732
|
+
const request = {
|
|
7733
|
+
'clTReqId': id,
|
|
7734
|
+
};
|
|
7735
|
+
const response = await this.privateGetAssetConvertHistory(this.extend(request, params));
|
|
7736
|
+
//
|
|
7737
|
+
// {
|
|
7738
|
+
// "code": "0",
|
|
7739
|
+
// "data": [
|
|
7740
|
+
// {
|
|
7741
|
+
// "clTReqId": "",
|
|
7742
|
+
// "instId": "ETH-USDT",
|
|
7743
|
+
// "side": "buy",
|
|
7744
|
+
// "fillPx": "2932.401044",
|
|
7745
|
+
// "baseCcy": "ETH",
|
|
7746
|
+
// "quoteCcy": "USDT",
|
|
7747
|
+
// "fillBaseSz": "0.01023052",
|
|
7748
|
+
// "state": "fullyFilled",
|
|
7749
|
+
// "tradeId": "trader16461885203381437",
|
|
7750
|
+
// "fillQuoteSz": "30",
|
|
7751
|
+
// "ts": "1646188520000"
|
|
7752
|
+
// }
|
|
7753
|
+
// ],
|
|
7754
|
+
// "msg": ""
|
|
7755
|
+
// }
|
|
7756
|
+
//
|
|
7757
|
+
const data = this.safeList(response, 'data', []);
|
|
7758
|
+
const result = this.safeDict(data, 0, {});
|
|
7759
|
+
const fromCurrencyId = this.safeString(result, 'baseCcy');
|
|
7760
|
+
const toCurrencyId = this.safeString(result, 'quoteCcy');
|
|
7761
|
+
let fromCurrency = undefined;
|
|
7762
|
+
let toCurrency = undefined;
|
|
7763
|
+
if (fromCurrencyId !== undefined) {
|
|
7764
|
+
fromCurrency = this.currency(fromCurrencyId);
|
|
7765
|
+
}
|
|
7766
|
+
if (toCurrencyId !== undefined) {
|
|
7767
|
+
toCurrency = this.currency(toCurrencyId);
|
|
7768
|
+
}
|
|
7769
|
+
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
7770
|
+
}
|
|
7771
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7772
|
+
/**
|
|
7773
|
+
* @method
|
|
7774
|
+
* @name okx#fetchConvertTradeHistory
|
|
7775
|
+
* @description fetch the users history of conversion trades
|
|
7776
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
7777
|
+
* @param {string} [code] the unified currency code
|
|
7778
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
7779
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
7780
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7781
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
7782
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7783
|
+
*/
|
|
7784
|
+
await this.loadMarkets();
|
|
7785
|
+
let request = {};
|
|
7786
|
+
[request, params] = this.handleUntilOption('after', request, params);
|
|
7787
|
+
if (since !== undefined) {
|
|
7788
|
+
request['before'] = since;
|
|
7789
|
+
}
|
|
7790
|
+
if (limit !== undefined) {
|
|
7791
|
+
request['limit'] = limit;
|
|
7792
|
+
}
|
|
7793
|
+
const response = await this.privateGetAssetConvertHistory(this.extend(request, params));
|
|
7794
|
+
//
|
|
7795
|
+
// {
|
|
7796
|
+
// "code": "0",
|
|
7797
|
+
// "data": [
|
|
7798
|
+
// {
|
|
7799
|
+
// "clTReqId": "",
|
|
7800
|
+
// "instId": "ETH-USDT",
|
|
7801
|
+
// "side": "buy",
|
|
7802
|
+
// "fillPx": "2932.401044",
|
|
7803
|
+
// "baseCcy": "ETH",
|
|
7804
|
+
// "quoteCcy": "USDT",
|
|
7805
|
+
// "fillBaseSz": "0.01023052",
|
|
7806
|
+
// "state": "fullyFilled",
|
|
7807
|
+
// "tradeId": "trader16461885203381437",
|
|
7808
|
+
// "fillQuoteSz": "30",
|
|
7809
|
+
// "ts": "1646188520000"
|
|
7810
|
+
// }
|
|
7811
|
+
// ],
|
|
7812
|
+
// "msg": ""
|
|
7813
|
+
// }
|
|
7814
|
+
//
|
|
7815
|
+
const rows = this.safeList(response, 'data', []);
|
|
7816
|
+
return this.parseConversions(rows, 'baseCcy', 'quoteCcy', since, limit);
|
|
7817
|
+
}
|
|
7718
7818
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
7719
7819
|
//
|
|
7720
7820
|
// fetchConvertQuote
|
|
@@ -7752,6 +7852,22 @@ export default class okx extends Exchange {
|
|
|
7752
7852
|
// "ts": "1646188520338"
|
|
7753
7853
|
// }
|
|
7754
7854
|
//
|
|
7855
|
+
// fetchConvertTrade, fetchConvertTradeHistory
|
|
7856
|
+
//
|
|
7857
|
+
// {
|
|
7858
|
+
// "clTReqId": "",
|
|
7859
|
+
// "instId": "ETH-USDT",
|
|
7860
|
+
// "side": "buy",
|
|
7861
|
+
// "fillPx": "2932.401044",
|
|
7862
|
+
// "baseCcy": "ETH",
|
|
7863
|
+
// "quoteCcy": "USDT",
|
|
7864
|
+
// "fillBaseSz": "0.01023052",
|
|
7865
|
+
// "state": "fullyFilled",
|
|
7866
|
+
// "tradeId": "trader16461885203381437",
|
|
7867
|
+
// "fillQuoteSz": "30",
|
|
7868
|
+
// "ts": "1646188520000"
|
|
7869
|
+
// }
|
|
7870
|
+
//
|
|
7755
7871
|
const timestamp = this.safeInteger2(conversion, 'quoteTime', 'ts');
|
|
7756
7872
|
const fromCoin = this.safeString(conversion, 'baseCcy');
|
|
7757
7873
|
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
@@ -376,8 +376,18 @@ export default class poloniexfutures extends Exchange {
|
|
|
376
376
|
const marketId = this.safeString(ticker, 'symbol');
|
|
377
377
|
const symbol = this.safeSymbol(marketId, market);
|
|
378
378
|
const timestampString = this.safeString(ticker, 'ts');
|
|
379
|
-
// check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011
|
|
380
|
-
|
|
379
|
+
// check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011 and also 17 digits occured
|
|
380
|
+
let multiplier = undefined;
|
|
381
|
+
if (timestampString.length === 17) {
|
|
382
|
+
multiplier = 0.0001;
|
|
383
|
+
}
|
|
384
|
+
else if (timestampString.length === 18) {
|
|
385
|
+
multiplier = 0.00001;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
// 19 length default
|
|
389
|
+
multiplier = 0.000001;
|
|
390
|
+
}
|
|
381
391
|
const timestamp = this.safeIntegerProduct(ticker, 'ts', multiplier);
|
|
382
392
|
const last = this.safeString2(ticker, 'price', 'lastPrice');
|
|
383
393
|
const percentage = Precise.stringMul(this.safeString(ticker, 'priceChgPct'), '100');
|
|
@@ -67,7 +67,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
67
67
|
'method': 'subscribe',
|
|
68
68
|
'subscription': {
|
|
69
69
|
'type': 'l2Book',
|
|
70
|
-
'coin': market['base'],
|
|
70
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
73
|
const message = this.extend(request, params);
|
|
@@ -102,7 +102,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
102
102
|
//
|
|
103
103
|
const entry = this.safeDict(message, 'data', {});
|
|
104
104
|
const coin = this.safeString(entry, 'coin');
|
|
105
|
-
const marketId = coin
|
|
105
|
+
const marketId = this.coinToMarketId(coin);
|
|
106
106
|
const market = this.market(marketId);
|
|
107
107
|
const symbol = market['symbol'];
|
|
108
108
|
const rawData = this.safeList(entry, 'levels', []);
|
|
@@ -233,7 +233,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
233
233
|
'method': 'subscribe',
|
|
234
234
|
'subscription': {
|
|
235
235
|
'type': 'trades',
|
|
236
|
-
'coin': market['base'],
|
|
236
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
237
237
|
},
|
|
238
238
|
};
|
|
239
239
|
const message = this.extend(request, params);
|
|
@@ -263,7 +263,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
263
263
|
const entry = this.safeList(message, 'data', []);
|
|
264
264
|
const first = this.safeDict(entry, 0, {});
|
|
265
265
|
const coin = this.safeString(first, 'coin');
|
|
266
|
-
const marketId = coin
|
|
266
|
+
const marketId = this.coinToMarketId(coin);
|
|
267
267
|
const market = this.market(marketId);
|
|
268
268
|
const symbol = market['symbol'];
|
|
269
269
|
if (!(symbol in this.trades)) {
|
|
@@ -318,7 +318,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
318
318
|
const price = this.safeString(trade, 'px');
|
|
319
319
|
const amount = this.safeString(trade, 'sz');
|
|
320
320
|
const coin = this.safeString(trade, 'coin');
|
|
321
|
-
const marketId = coin
|
|
321
|
+
const marketId = this.coinToMarketId(coin);
|
|
322
322
|
market = this.safeMarket(marketId, undefined);
|
|
323
323
|
const symbol = market['symbol'];
|
|
324
324
|
const id = this.safeString(trade, 'tid');
|
|
@@ -363,7 +363,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
363
363
|
'method': 'subscribe',
|
|
364
364
|
'subscription': {
|
|
365
365
|
'type': 'candle',
|
|
366
|
-
'coin': market['base'],
|
|
366
|
+
'coin': market['swap'] ? market['base'] : market['id'],
|
|
367
367
|
'interval': timeframe,
|
|
368
368
|
},
|
|
369
369
|
};
|
|
@@ -395,7 +395,8 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
395
395
|
//
|
|
396
396
|
const data = this.safeDict(message, 'data', {});
|
|
397
397
|
const base = this.safeString(data, 's');
|
|
398
|
-
const
|
|
398
|
+
const marketId = this.coinToMarketId(base);
|
|
399
|
+
const symbol = this.safeSymbol(marketId);
|
|
399
400
|
const timeframe = this.safeString(data, 'i');
|
|
400
401
|
if (!(symbol in this.ohlcvs)) {
|
|
401
402
|
this.ohlcvs[symbol] = {};
|
package/js/src/pro/kraken.js
CHANGED
|
@@ -1323,7 +1323,7 @@ export default class kraken extends krakenRest {
|
|
|
1323
1323
|
},
|
|
1324
1324
|
};
|
|
1325
1325
|
const url = this.urls['api']['ws']['public'];
|
|
1326
|
-
return await this.watchMultiple(url, messageHashes, this.
|
|
1326
|
+
return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), messageHashes, subscriptionArgs);
|
|
1327
1327
|
}
|
|
1328
1328
|
getMessageHash(unifiedElementName, subChannelName = undefined, symbol = undefined) {
|
|
1329
1329
|
// unifiedElementName can be : orderbook, trade, ticker, bidask ...
|
package/js/src/pro/wazirx.js
CHANGED
|
@@ -749,7 +749,8 @@ export default class wazirx extends wazirxRest {
|
|
|
749
749
|
};
|
|
750
750
|
const streams = Object.keys(streamHandlers);
|
|
751
751
|
for (let i = 0; i < streams.length; i++) {
|
|
752
|
-
|
|
752
|
+
const streamContains = stream.indexOf(streams[i]) > -1;
|
|
753
|
+
if (streamContains) {
|
|
753
754
|
const handler = streamHandlers[streams[i]];
|
|
754
755
|
handler.call(this, client, message);
|
|
755
756
|
return;
|
|
@@ -55,7 +55,7 @@ export declare class JSEncryptRSAKey extends RSAKey {
|
|
|
55
55
|
* @returns {string} DER Encoded String representing the rsa private key
|
|
56
56
|
* @private
|
|
57
57
|
*/
|
|
58
|
-
getPrivateBaseKey():
|
|
58
|
+
getPrivateBaseKey(): any;
|
|
59
59
|
/**
|
|
60
60
|
* base64 (pem) encoded version of the DER encoded representation
|
|
61
61
|
* @returns {string} pem encoded representation without header and footer
|
|
@@ -82,7 +82,7 @@ export declare class JSEncryptRSAKey extends RSAKey {
|
|
|
82
82
|
* @returns {string} DER Encoded String representing the rsa public key
|
|
83
83
|
* @private
|
|
84
84
|
*/
|
|
85
|
-
getPublicBaseKey():
|
|
85
|
+
getPublicBaseKey(): any;
|
|
86
86
|
/**
|
|
87
87
|
* base64 (pem) encoded version of the DER encoded representation
|
|
88
88
|
* @returns {string} pem encoded representation without header and footer
|