hedgequantx 1.2.75 → 1.2.77
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/package.json +1 -1
- package/src/pages/algo.js +30 -24
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -386,7 +386,7 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
386
386
|
// Stats
|
|
387
387
|
const pnlColor = stats.pnl >= 0 ? chalk.green : chalk.red;
|
|
388
388
|
const pnlStr = (stats.pnl >= 0 ? '+$' : '-$') + Math.abs(stats.pnl).toFixed(2);
|
|
389
|
-
const latencyStr = hqxConnected ? (latency > 0 ?
|
|
389
|
+
const latencyStr = hqxConnected ? (latency > 0 ? `${latency}ms` : '--') : '--';
|
|
390
390
|
const latencyColor = latency < 100 ? chalk.green : (latency < 300 ? chalk.yellow : chalk.red);
|
|
391
391
|
const serverStatus = hqxConnected ? 'ON' : 'OFF';
|
|
392
392
|
const serverColor = hqxConnected ? chalk.green : chalk.red;
|
|
@@ -419,12 +419,13 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
419
419
|
|
|
420
420
|
console.log();
|
|
421
421
|
console.log(chalk.cyan(TOP));
|
|
422
|
-
|
|
423
|
-
console.log(chalk.cyan(V) + chalk.cyan('
|
|
424
|
-
console.log(chalk.cyan(V) + chalk.cyan('
|
|
425
|
-
console.log(chalk.cyan(V) + chalk.cyan('
|
|
426
|
-
console.log(chalk.cyan(V) + chalk.cyan('
|
|
427
|
-
console.log(chalk.cyan(V) + chalk.cyan('
|
|
422
|
+
// Logo = 87 chars cyan + 9 chars yellow = 96 total
|
|
423
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ██╗ ██╗███████╗██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗ █████╗ ███╗ ██╗████████╗') + chalk.yellow('██╗ ██╗') + ' ' + chalk.cyan(V));
|
|
424
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ██║ ██║██╔════╝██╔══██╗██╔════╝ ██╔════╝██╔═══██╗██║ ██║██╔══██╗████╗ ██║╚══██╔══╝') + chalk.yellow('╚██╗██╔╝') + ' ' + chalk.cyan(V));
|
|
425
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ███████║█████╗ ██║ ██║██║ ███╗█████╗ ██║ ██║██║ ██║███████║██╔██╗ ██║ ██║ ') + chalk.yellow(' ╚███╔╝ ') + ' ' + chalk.cyan(V));
|
|
426
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ██╔══██║██╔══╝ ██║ ██║██║ ██║██╔══╝ ██║▄▄ ██║██║ ██║██╔══██║██║╚██╗██║ ██║ ') + chalk.yellow(' ██╔██╗ ') + ' ' + chalk.cyan(V));
|
|
427
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ██║ ██║███████╗██████╔╝╚██████╔╝███████╗╚██████╔╝╚██████╔╝██║ ██║██║ ╚████║ ██║ ') + chalk.yellow('██╔╝ ██╗') + ' ' + chalk.cyan(V));
|
|
428
|
+
console.log(chalk.cyan(V) + chalk.cyan(' ╚═╝ ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚══════╝ ╚══▀▀═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ') + chalk.yellow('╚═╝ ╚═╝') + ' ' + chalk.cyan(V));
|
|
428
429
|
console.log(chalk.cyan(MID));
|
|
429
430
|
|
|
430
431
|
// Centered title
|
|
@@ -457,6 +458,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
457
458
|
// Row 1 cells: widths = 36 + 18 + 10 + 14 + 14 = 92 + 4 separators = 96
|
|
458
459
|
const c1w = 36, c2w = 18, c3w = 10, c4w = 14, c5w = 14;
|
|
459
460
|
|
|
461
|
+
// Safe padding function
|
|
462
|
+
const safePad = (len) => ' '.repeat(Math.max(0, len));
|
|
463
|
+
|
|
460
464
|
const cell1 = ` ${accLabel}: ${chalk.cyan(accVal)}`;
|
|
461
465
|
const cell1plain = ` ${accLabel}: ${accVal}`;
|
|
462
466
|
const cell2 = ` ${symLabel}: ${chalk.yellow(symVal)}`;
|
|
@@ -468,11 +472,11 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
468
472
|
const cell5 = ` ${latLabel}: ${latencyColor(latVal)}`;
|
|
469
473
|
const cell5plain = ` ${latLabel}: ${latVal}`;
|
|
470
474
|
|
|
471
|
-
const row1 = cell1 +
|
|
472
|
-
cell2 +
|
|
473
|
-
cell3 +
|
|
474
|
-
cell4 +
|
|
475
|
-
cell5 +
|
|
475
|
+
const row1 = cell1 + safePad(c1w - cell1plain.length) + chalk.cyan(VS) +
|
|
476
|
+
cell2 + safePad(c2w - cell2plain.length) + chalk.cyan(VS) +
|
|
477
|
+
cell3 + safePad(c3w - cell3plain.length) + chalk.cyan(VS) +
|
|
478
|
+
cell4 + safePad(c4w - cell4plain.length) + chalk.cyan(VS) +
|
|
479
|
+
cell5 + safePad(c5w - cell5plain.length);
|
|
476
480
|
|
|
477
481
|
console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
|
|
478
482
|
|
|
@@ -503,27 +507,28 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
503
507
|
const cell10 = ` ${wlLabel}: ${chalk.green(stats.wins.toString())}/${chalk.red(stats.losses.toString())}`;
|
|
504
508
|
const cell10plain = ` ${wlLabel}: ${wlVal}`;
|
|
505
509
|
|
|
506
|
-
const row2 = cell6 +
|
|
507
|
-
cell7 +
|
|
508
|
-
cell8 +
|
|
509
|
-
cell9 +
|
|
510
|
-
cell10 +
|
|
510
|
+
const row2 = cell6 + safePad(c1w - cell6plain.length) + chalk.cyan(VS) +
|
|
511
|
+
cell7 + safePad(c2w - cell7plain.length) + chalk.cyan(VS) +
|
|
512
|
+
cell8 + safePad(c3w - cell8plain.length) + chalk.cyan(VS) +
|
|
513
|
+
cell9 + safePad(c4w - cell9plain.length) + chalk.cyan(VS) +
|
|
514
|
+
cell10 + safePad(c5w - cell10plain.length);
|
|
511
515
|
|
|
512
516
|
console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
|
|
513
517
|
console.log(chalk.cyan(MID));
|
|
514
518
|
|
|
515
519
|
// Activity log header with spinner and centered date
|
|
516
520
|
spinnerFrame = (spinnerFrame + 1) % spinnerChars.length;
|
|
517
|
-
const
|
|
518
|
-
const actLeft = ` Activity Log ${chalk.cyan(
|
|
519
|
-
const actLeftPlain = ` Activity Log ${
|
|
521
|
+
const spinnerChar = spinnerChars[spinnerFrame];
|
|
522
|
+
const actLeft = ` Activity Log ${chalk.cyan(spinnerChar)}`;
|
|
523
|
+
const actLeftPlain = ` Activity Log ${spinnerChar}`;
|
|
520
524
|
const actRight = 'Press X to stop ';
|
|
521
525
|
const dateCentered = `- ${dateStr} -`;
|
|
522
526
|
const leftLen = actLeftPlain.length;
|
|
523
527
|
const rightLen = actRight.length;
|
|
524
|
-
const midSpace = W - leftLen - rightLen;
|
|
525
|
-
const datePad = Math.floor((midSpace - dateCentered.length) / 2);
|
|
526
|
-
const
|
|
528
|
+
const midSpace = Math.max(0, W - leftLen - rightLen);
|
|
529
|
+
const datePad = Math.max(0, Math.floor((midSpace - dateCentered.length) / 2));
|
|
530
|
+
const remainingPad = Math.max(0, midSpace - datePad - dateCentered.length);
|
|
531
|
+
const dateSection = ' '.repeat(datePad) + chalk.gray(dateCentered) + ' '.repeat(remainingPad);
|
|
527
532
|
console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
|
|
528
533
|
console.log(chalk.cyan(BOT));
|
|
529
534
|
|
|
@@ -817,7 +822,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
817
822
|
const cell = (label, value, width) => {
|
|
818
823
|
const text = ` ${label}: ${value}`;
|
|
819
824
|
const stripped = text.replace(/\x1b\[[0-9;]*m/g, '');
|
|
820
|
-
|
|
825
|
+
const padding = Math.max(0, width - stripped.length);
|
|
826
|
+
return text + ' '.repeat(padding);
|
|
821
827
|
};
|
|
822
828
|
|
|
823
829
|
const centerTitle = (text, width) => {
|