ccxt 4.2.85 → 4.2.87
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 -5
- package/dist/ccxt.browser.js +1132 -432
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +11 -1
- package/dist/cjs/src/binance.js +14 -1
- package/dist/cjs/src/bingx.js +71 -20
- package/dist/cjs/src/bitbank.js +19 -23
- package/dist/cjs/src/bitfinex.js +3 -0
- package/dist/cjs/src/bitfinex2.js +16 -1
- package/dist/cjs/src/bitflyer.js +19 -0
- package/dist/cjs/src/bitget.js +15 -1
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +13 -7
- package/dist/cjs/src/bitvavo.js +3 -0
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +2 -1
- package/dist/cjs/src/coinex.js +576 -302
- package/dist/cjs/src/currencycom.js +1 -1
- package/dist/cjs/src/delta.js +3 -1
- package/dist/cjs/src/digifinex.js +4 -2
- package/dist/cjs/src/exmo.js +11 -12
- package/dist/cjs/src/gate.js +5 -2
- package/dist/cjs/src/hitbtc.js +26 -2
- package/dist/cjs/src/htx.js +2 -2
- package/dist/cjs/src/huobijp.js +1 -1
- package/dist/cjs/src/hyperliquid.js +249 -12
- package/dist/cjs/src/idex.js +11 -12
- package/dist/cjs/src/krakenfutures.js +2 -6
- package/dist/cjs/src/lbank.js +3 -0
- package/dist/cjs/src/oceanex.js +1 -1
- package/dist/cjs/src/okcoin.js +3 -1
- package/dist/cjs/src/okx.js +24 -10
- package/dist/cjs/src/phemex.js +3 -1
- package/dist/cjs/src/pro/bitget.js +1 -0
- package/dist/cjs/src/pro/kucoin.js +11 -6
- package/dist/cjs/src/wazirx.js +1 -1
- package/dist/cjs/src/zonda.js +3 -0
- package/examples/js/benchmark.js +104 -0
- package/examples/ts/benchmark.ts +134 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinex.d.ts +232 -123
- package/js/src/ascendex.d.ts +5 -12
- package/js/src/ascendex.js +11 -1
- package/js/src/base/Exchange.d.ts +13 -13
- package/js/src/base/types.d.ts +11 -0
- package/js/src/binance.d.ts +4 -11
- package/js/src/binance.js +14 -1
- package/js/src/bingx.d.ts +5 -2
- package/js/src/bingx.js +71 -20
- package/js/src/bitbank.js +19 -23
- package/js/src/bitfinex.js +3 -0
- package/js/src/bitfinex2.d.ts +3 -17
- package/js/src/bitfinex2.js +16 -1
- package/js/src/bitflyer.d.ts +1 -0
- package/js/src/bitflyer.js +20 -1
- package/js/src/bitget.d.ts +5 -12
- package/js/src/bitget.js +15 -1
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.d.ts +3 -17
- package/js/src/bitrue.js +13 -7
- package/js/src/bitvavo.js +3 -0
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +2 -1
- package/js/src/coinex.d.ts +5 -12
- package/js/src/coinex.js +576 -302
- package/js/src/currencycom.js +1 -1
- package/js/src/delta.d.ts +5 -37
- package/js/src/delta.js +3 -1
- package/js/src/digifinex.d.ts +5 -13
- package/js/src/digifinex.js +4 -2
- package/js/src/exmo.d.ts +5 -37
- package/js/src/exmo.js +11 -12
- package/js/src/gate.d.ts +5 -33
- package/js/src/gate.js +5 -2
- package/js/src/hitbtc.d.ts +5 -12
- package/js/src/hitbtc.js +26 -2
- package/js/src/htx.js +2 -2
- package/js/src/huobijp.js +1 -1
- package/js/src/hyperliquid.d.ts +7 -4
- package/js/src/hyperliquid.js +249 -12
- package/js/src/idex.js +11 -12
- package/js/src/krakenfutures.js +2 -6
- package/js/src/kucoinfutures.d.ts +2 -2
- package/js/src/lbank.js +3 -0
- package/js/src/mexc.d.ts +3 -3
- package/js/src/oceanex.js +1 -1
- package/js/src/okcoin.js +3 -1
- package/js/src/okx.d.ts +5 -33
- package/js/src/okx.js +24 -10
- package/js/src/phemex.d.ts +3 -11
- package/js/src/phemex.js +3 -1
- package/js/src/pro/bitget.js +1 -0
- package/js/src/pro/kucoin.js +11 -6
- package/js/src/wazirx.js +1 -1
- package/js/src/zonda.js +3 -0
- package/package.json +3 -2
- package/skip-tests.json +7 -3
package/dist/cjs/src/okcoin.js
CHANGED
|
@@ -1133,8 +1133,10 @@ class okcoin extends okcoin$1 {
|
|
|
1133
1133
|
const request = {
|
|
1134
1134
|
'instId': market['id'],
|
|
1135
1135
|
'bar': bar,
|
|
1136
|
-
'limit': limit,
|
|
1137
1136
|
};
|
|
1137
|
+
if (limit !== undefined) {
|
|
1138
|
+
request['limit'] = limit; // default 100, max 100
|
|
1139
|
+
}
|
|
1138
1140
|
let method = undefined;
|
|
1139
1141
|
[method, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'method', 'publicGetMarketCandles');
|
|
1140
1142
|
let response = undefined;
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -6460,26 +6460,40 @@ class okx extends okx$1 {
|
|
|
6460
6460
|
// "msg": ""
|
|
6461
6461
|
// }
|
|
6462
6462
|
//
|
|
6463
|
-
|
|
6463
|
+
const data = this.safeList(response, 'data', []);
|
|
6464
|
+
const errorCode = this.safeString(response, 'code');
|
|
6465
|
+
const item = this.safeDict(data, 0, {});
|
|
6466
|
+
return this.extend(this.parseMarginModification(item, market), {
|
|
6467
|
+
'status': (errorCode === '0') ? 'ok' : 'failed',
|
|
6468
|
+
});
|
|
6464
6469
|
}
|
|
6465
6470
|
parseMarginModification(data, market = undefined) {
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6471
|
+
//
|
|
6472
|
+
// addMargin/reduceMargin
|
|
6473
|
+
//
|
|
6474
|
+
// {
|
|
6475
|
+
// "amt": "0.01",
|
|
6476
|
+
// "instId": "ETH-USD-SWAP",
|
|
6477
|
+
// "posSide": "net",
|
|
6478
|
+
// "type": "reduce"
|
|
6479
|
+
// }
|
|
6480
|
+
//
|
|
6481
|
+
const amountRaw = this.safeNumber(data, 'amt');
|
|
6482
|
+
const typeRaw = this.safeString(data, 'type');
|
|
6472
6483
|
const type = (typeRaw === 'reduce') ? 'reduce' : 'add';
|
|
6473
|
-
const marketId = this.safeString(
|
|
6484
|
+
const marketId = this.safeString(data, 'instId');
|
|
6474
6485
|
const responseMarket = this.safeMarket(marketId, market);
|
|
6475
6486
|
const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
|
|
6476
6487
|
return {
|
|
6477
6488
|
'info': data,
|
|
6489
|
+
'symbol': responseMarket['symbol'],
|
|
6478
6490
|
'type': type,
|
|
6479
6491
|
'amount': amountRaw,
|
|
6492
|
+
'total': undefined,
|
|
6480
6493
|
'code': code,
|
|
6481
|
-
'
|
|
6482
|
-
'
|
|
6494
|
+
'status': undefined,
|
|
6495
|
+
'timestamp': undefined,
|
|
6496
|
+
'datetime': undefined,
|
|
6483
6497
|
};
|
|
6484
6498
|
}
|
|
6485
6499
|
async reduceMargin(symbol, amount, params = {}) {
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -4060,12 +4060,14 @@ class phemex extends phemex$1 {
|
|
|
4060
4060
|
const codeCurrency = inverse ? 'base' : 'quote';
|
|
4061
4061
|
return {
|
|
4062
4062
|
'info': data,
|
|
4063
|
+
'symbol': this.safeSymbol(undefined, market),
|
|
4063
4064
|
'type': 'set',
|
|
4064
4065
|
'amount': undefined,
|
|
4065
4066
|
'total': undefined,
|
|
4066
4067
|
'code': market[codeCurrency],
|
|
4067
|
-
'symbol': this.safeSymbol(undefined, market),
|
|
4068
4068
|
'status': this.parseMarginStatus(this.safeString(data, 'code')),
|
|
4069
|
+
'timestamp': undefined,
|
|
4070
|
+
'datetime': undefined,
|
|
4069
4071
|
};
|
|
4070
4072
|
}
|
|
4071
4073
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
@@ -570,17 +570,22 @@ class kucoin extends kucoin$1 {
|
|
|
570
570
|
const marketId = this.safeString(data, 'symbol', topicSymbol);
|
|
571
571
|
const symbol = this.safeSymbol(marketId, undefined, '-');
|
|
572
572
|
const messageHash = 'orderbook:' + symbol;
|
|
573
|
-
let orderbook = this.safeDict(this.orderbooks, symbol);
|
|
573
|
+
// let orderbook = this.safeDict (this.orderbooks, symbol);
|
|
574
574
|
if (subject === 'level2') {
|
|
575
|
-
if (
|
|
576
|
-
|
|
575
|
+
if (!(symbol in this.orderbooks)) {
|
|
576
|
+
this.orderbooks[symbol] = this.orderBook();
|
|
577
577
|
}
|
|
578
578
|
else {
|
|
579
|
+
const orderbook = this.orderbooks[symbol];
|
|
579
580
|
orderbook.reset();
|
|
580
581
|
}
|
|
581
|
-
|
|
582
|
+
this.orderbooks[symbol]['symbol'] = symbol;
|
|
582
583
|
}
|
|
583
584
|
else {
|
|
585
|
+
if (!(symbol in this.orderbooks)) {
|
|
586
|
+
this.orderbooks[symbol] = this.orderBook();
|
|
587
|
+
}
|
|
588
|
+
const orderbook = this.orderbooks[symbol];
|
|
584
589
|
const nonce = this.safeInteger(orderbook, 'nonce');
|
|
585
590
|
const deltaEnd = this.safeInteger2(data, 'sequenceEnd', 'timestamp');
|
|
586
591
|
if (nonce === undefined) {
|
|
@@ -606,8 +611,8 @@ class kucoin extends kucoin$1 {
|
|
|
606
611
|
return;
|
|
607
612
|
}
|
|
608
613
|
}
|
|
609
|
-
this.handleDelta(
|
|
610
|
-
client.resolve(
|
|
614
|
+
this.handleDelta(this.orderbooks[symbol], data);
|
|
615
|
+
client.resolve(this.orderbooks[symbol], messageHash);
|
|
611
616
|
}
|
|
612
617
|
getCacheIndex(orderbook, cache) {
|
|
613
618
|
const firstDelta = this.safeValue(cache, 0);
|
package/dist/cjs/src/wazirx.js
CHANGED
|
@@ -319,7 +319,7 @@ class wazirx extends wazirx$1 {
|
|
|
319
319
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
320
320
|
};
|
|
321
321
|
if (limit !== undefined) {
|
|
322
|
-
request['limit'] = limit;
|
|
322
|
+
request['limit'] = Math.min(limit, 2000);
|
|
323
323
|
}
|
|
324
324
|
const until = this.safeInteger(params, 'until');
|
|
325
325
|
params = this.omit(params, ['until']);
|
package/dist/cjs/src/zonda.js
CHANGED
|
@@ -1201,6 +1201,9 @@ class zonda extends zonda$1 {
|
|
|
1201
1201
|
if (limit === undefined) {
|
|
1202
1202
|
limit = 100;
|
|
1203
1203
|
}
|
|
1204
|
+
else {
|
|
1205
|
+
limit = Math.min(limit, 11000); // supports up to 11k candles diapason
|
|
1206
|
+
}
|
|
1204
1207
|
const duration = this.parseTimeframe(timeframe);
|
|
1205
1208
|
const timerange = limit * duration * 1000;
|
|
1206
1209
|
if (since === undefined) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import asTable from 'as-table';
|
|
3
|
+
import ccxt, { version } from '../../js/ccxt.js';
|
|
4
|
+
const stats = (times) => {
|
|
5
|
+
// calculate statistics
|
|
6
|
+
const sum = times.reduce((a, b) => a + b, 0);
|
|
7
|
+
const avg = Math.round(sum / times.length);
|
|
8
|
+
const min = Math.min(...times);
|
|
9
|
+
const max = Math.max(...times);
|
|
10
|
+
times.sort((a, b) => a - b);
|
|
11
|
+
const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor(times.length / 2)];
|
|
12
|
+
return { min, 'average': avg, max, median, 'iterations': times.length };
|
|
13
|
+
};
|
|
14
|
+
async function benchmark(exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') {
|
|
15
|
+
const exchange = new ccxt.pro[exchangeId]({});
|
|
16
|
+
const languages = ['js', 'py', 'php', 'cs'];
|
|
17
|
+
const commands = languages.map((language) => ({
|
|
18
|
+
'language': language,
|
|
19
|
+
'method': method,
|
|
20
|
+
'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join(' ')} -- ${argsv} --poll`,
|
|
21
|
+
}));
|
|
22
|
+
const wsMethod = method + 'Ws';
|
|
23
|
+
if (exchange.has[wsMethod]) {
|
|
24
|
+
const wsCommands = languages.map((language) => ({
|
|
25
|
+
'language': language,
|
|
26
|
+
'method': wsMethod,
|
|
27
|
+
'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join(' ')} -- ${argsv} --poll`,
|
|
28
|
+
}));
|
|
29
|
+
commands.push(...wsCommands);
|
|
30
|
+
}
|
|
31
|
+
const regex = /iteration (\d+) passed in (\d+) ms/g;
|
|
32
|
+
async function runCommand(command) {
|
|
33
|
+
if (verbose) {
|
|
34
|
+
console.log(exchange.iso8601(new Date().getTime()), ' running command:', command);
|
|
35
|
+
}
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const [cmd, ...args] = command.split(' ');
|
|
38
|
+
const child = spawn(cmd, args);
|
|
39
|
+
const matches = [];
|
|
40
|
+
const language = command.slice(8, 15);
|
|
41
|
+
child.stdout.on('data', (data) => {
|
|
42
|
+
const message = data.toString();
|
|
43
|
+
matches.push(...Array.from(message.matchAll(regex)));
|
|
44
|
+
const match = matches[matches.length - 1];
|
|
45
|
+
if (match && match[1] && match[2]) {
|
|
46
|
+
const iteration = parseInt(match[1]);
|
|
47
|
+
const time = parseInt(match[2]);
|
|
48
|
+
if (iteration <= minIterations) {
|
|
49
|
+
if (verbose) {
|
|
50
|
+
console.log(exchange.iso8601(new Date().getTime()), `${language} iteration ${iteration} passed in ${time} ms`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const times = matches.map((m) => parseInt(m[2]));
|
|
55
|
+
child.kill();
|
|
56
|
+
if (verbose) {
|
|
57
|
+
console.log(exchange.iso8601(new Date().getTime()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`);
|
|
58
|
+
}
|
|
59
|
+
resolve({ times });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
child.stderr.on('data', (data) => {
|
|
64
|
+
const message = data.toString();
|
|
65
|
+
console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. stderr: ${message}`);
|
|
66
|
+
const times = matches.map((m) => parseInt(m[2]));
|
|
67
|
+
resolve({ times });
|
|
68
|
+
});
|
|
69
|
+
child.on('close', (code) => {
|
|
70
|
+
const times = matches.map((m) => parseInt(m[2]));
|
|
71
|
+
resolve({ times });
|
|
72
|
+
console.log(exchange.iso8601(new Date().getTime()), `${language} child process exited with code ${code}`);
|
|
73
|
+
});
|
|
74
|
+
child.on('error', (err) => {
|
|
75
|
+
console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. error: ${err}`);
|
|
76
|
+
reject(err);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const benchmarks = [];
|
|
81
|
+
const results = await Promise.all(commands.map((c) => runCommand(c.command)));
|
|
82
|
+
for (let i = 0; i < results.length; i++) {
|
|
83
|
+
const result = results[i];
|
|
84
|
+
benchmarks.push({ 'language': commands[i].language, 'method': commands[i].method, ...stats(result.times) });
|
|
85
|
+
}
|
|
86
|
+
if (verbose) {
|
|
87
|
+
const rawResults = results.map((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats(r.times), 'times': r.times }));
|
|
88
|
+
console.log(rawResults);
|
|
89
|
+
}
|
|
90
|
+
console.log(asTable(benchmarks));
|
|
91
|
+
}
|
|
92
|
+
const [_, , exchangeId, methodName, ...params] = process.argv.filter((x) => !x.startsWith('--'));
|
|
93
|
+
const verbose = process.argv.includes('--verbose');
|
|
94
|
+
const minIterationsString = process.argv.find((x) => x.startsWith('--min-iterations='))?.slice(18);
|
|
95
|
+
const minIterations = minIterationsString ? parseInt(minIterationsString) : 10;
|
|
96
|
+
const argsv = process.argv.filter((x) => x.startsWith('--') && !x.startsWith('--min-iterations')).join(' ');
|
|
97
|
+
console.log((new Date()).toISOString());
|
|
98
|
+
console.log('Node.js:', process.version);
|
|
99
|
+
console.log('CCXT v' + version);
|
|
100
|
+
const start = new Date().getTime();
|
|
101
|
+
await benchmark(exchangeId, methodName, params, verbose, minIterations, argsv);
|
|
102
|
+
const end = new Date().getTime();
|
|
103
|
+
console.log((new Date().toISOString()), 'Total time:', end - start, 'ms');
|
|
104
|
+
process.exit(0);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import asTable from 'as-table';
|
|
3
|
+
import ccxt, { version } from '../../js/ccxt.js';
|
|
4
|
+
|
|
5
|
+
interface Stats {
|
|
6
|
+
min: number;
|
|
7
|
+
average: number;
|
|
8
|
+
max: number;
|
|
9
|
+
median: number;
|
|
10
|
+
iterations: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Test {
|
|
14
|
+
language: string;
|
|
15
|
+
method: string;
|
|
16
|
+
command: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Benchmark extends Omit<Test, 'command'>, Stats { }
|
|
20
|
+
|
|
21
|
+
const stats = (times: number[]): Stats => {
|
|
22
|
+
// calculate statistics
|
|
23
|
+
const sum = times.reduce ((a, b) => a + b, 0);
|
|
24
|
+
const avg = Math.round (sum / times.length);
|
|
25
|
+
const min = Math.min (...times);
|
|
26
|
+
const max = Math.max (...times);
|
|
27
|
+
times.sort ((a, b) => a - b);
|
|
28
|
+
const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor (times.length / 2)];
|
|
29
|
+
return { min, 'average': avg, max, median, 'iterations': times.length };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
async function benchmark (exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') {
|
|
33
|
+
const exchange = new ccxt.pro[exchangeId] ({});
|
|
34
|
+
const languages = [ 'js', 'py', 'php', 'cs' ];
|
|
35
|
+
const commands: Test[] = languages.map ((language) => ({
|
|
36
|
+
'language': language,
|
|
37
|
+
'method': method,
|
|
38
|
+
'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join (' ')} -- ${argsv} --poll`,
|
|
39
|
+
}));
|
|
40
|
+
const wsMethod = method + 'Ws';
|
|
41
|
+
if (exchange.has[wsMethod]) {
|
|
42
|
+
const wsCommands: Test[] = languages.map ((language) => ({
|
|
43
|
+
'language': language,
|
|
44
|
+
'method': wsMethod,
|
|
45
|
+
'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join (' ')} -- ${argsv} --poll`,
|
|
46
|
+
}));
|
|
47
|
+
commands.push (...wsCommands);
|
|
48
|
+
}
|
|
49
|
+
const regex = /iteration (\d+) passed in (\d+) ms/g;
|
|
50
|
+
|
|
51
|
+
async function runCommand (command: string) {
|
|
52
|
+
if (verbose) {
|
|
53
|
+
console.log (exchange.iso8601 (new Date ().getTime ()), ' running command:', command);
|
|
54
|
+
}
|
|
55
|
+
return new Promise<{ times: number[] }> ((resolve, reject) => {
|
|
56
|
+
const [ cmd, ...args ] = command.split (' ');
|
|
57
|
+
|
|
58
|
+
const child = spawn (cmd, args);
|
|
59
|
+
const matches = [];
|
|
60
|
+
const language = command.slice (8, 15);
|
|
61
|
+
child.stdout.on ('data', (data: Buffer) => {
|
|
62
|
+
const message = data.toString ();
|
|
63
|
+
matches.push (...Array.from (message.matchAll (regex)));
|
|
64
|
+
const match = matches[matches.length - 1];
|
|
65
|
+
|
|
66
|
+
if (match && match[1] && match[2]) {
|
|
67
|
+
const iteration = parseInt (match[1]);
|
|
68
|
+
const time = parseInt (match[2]);
|
|
69
|
+
|
|
70
|
+
if (iteration <= minIterations) {
|
|
71
|
+
if (verbose) {
|
|
72
|
+
console.log (exchange.iso8601 (new Date ().getTime ()), `${language} iteration ${iteration} passed in ${time} ms`);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
const times = matches.map ((m) => parseInt (m[2]));
|
|
76
|
+
child.kill ();
|
|
77
|
+
if (verbose) {
|
|
78
|
+
console.log (exchange.iso8601 (new Date ().getTime ()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`);
|
|
79
|
+
}
|
|
80
|
+
resolve ({ times });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
child.stderr.on ('data', (data: Buffer) => {
|
|
86
|
+
const message = data.toString ();
|
|
87
|
+
console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. stderr: ${message}`);
|
|
88
|
+
const times = matches.map ((m) => parseInt (m[2]));
|
|
89
|
+
resolve ({ times });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
child.on ('close', (code: number) => {
|
|
93
|
+
const times = matches.map ((m) => parseInt (m[2]));
|
|
94
|
+
resolve ({ times });
|
|
95
|
+
console.log (exchange.iso8601 (new Date ().getTime ()), `${language} child process exited with code ${code}`);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
child.on ('error', (err) => {
|
|
99
|
+
console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. error: ${err}`);
|
|
100
|
+
reject (err);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const benchmarks: Benchmark[] = [];
|
|
106
|
+
const results = await Promise.all (commands.map ((c) => runCommand (c.command)));
|
|
107
|
+
for (let i = 0; i < results.length; i++) {
|
|
108
|
+
const result = results[i];
|
|
109
|
+
benchmarks.push ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (result.times) });
|
|
110
|
+
}
|
|
111
|
+
if (verbose) {
|
|
112
|
+
const rawResults = results.map ((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (r.times), 'times': r.times }));
|
|
113
|
+
console.log (rawResults);
|
|
114
|
+
}
|
|
115
|
+
console.log (asTable (benchmarks));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const [ _, , exchangeId, methodName, ...params ] = process.argv.filter ((x) => !x.startsWith ('--'));
|
|
119
|
+
const verbose = process.argv.includes ('--verbose');
|
|
120
|
+
const minIterationsString = process.argv.find ((x) => x.startsWith ('--min-iterations='))?.slice (18);
|
|
121
|
+
const minIterations = minIterationsString ? parseInt (minIterationsString) : 10;
|
|
122
|
+
const argsv = process.argv.filter ((x) => x.startsWith ('--') && !x.startsWith ('--min-iterations')).join (' ');
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
console.log ((new Date ()).toISOString ());
|
|
126
|
+
console.log ('Node.js:', process.version);
|
|
127
|
+
console.log ('CCXT v' + version);
|
|
128
|
+
|
|
129
|
+
const start = new Date ().getTime ();
|
|
130
|
+
await benchmark (exchangeId, methodName, params, verbose, minIterations, argsv);
|
|
131
|
+
const end = new Date ().getTime ();
|
|
132
|
+
|
|
133
|
+
console.log ((new Date ().toISOString ()), 'Total time:', end - start, 'ms');
|
|
134
|
+
process.exit (0);
|
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 } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.86";
|
|
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.87';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|