hedgequantx 1.2.76 → 1.2.78
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 +29 -13
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
|
|
@@ -454,8 +455,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
454
455
|
const latLabel = 'WS';
|
|
455
456
|
const latVal = latencyStr;
|
|
456
457
|
|
|
457
|
-
// Row 1 cells: widths = 36 +
|
|
458
|
-
const c1w = 36, c2w =
|
|
458
|
+
// Row 1 cells: widths = 36 + 17 + 9 + 13 + 13 = 88 + 4 separators + 4 spaces = 96
|
|
459
|
+
const c1w = 36, c2w = 17, c3w = 9, c4w = 13, c5w = 17;
|
|
459
460
|
|
|
460
461
|
// Safe padding function
|
|
461
462
|
const safePad = (len) => ' '.repeat(Math.max(0, len));
|
|
@@ -477,11 +478,14 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
477
478
|
cell4 + safePad(c4w - cell4plain.length) + chalk.cyan(VS) +
|
|
478
479
|
cell5 + safePad(c5w - cell5plain.length);
|
|
479
480
|
|
|
481
|
+
// Top separator for grid (after HQX Ultra-Scalping)
|
|
482
|
+
const GRID_TOP = '\u2560' + '\u2550'.repeat(c1w) + '\u2564' + '\u2550'.repeat(c2w) + '\u2564' + '\u2550'.repeat(c3w) + '\u2564' + '\u2550'.repeat(c4w) + '\u2564' + '\u2550'.repeat(c5w) + '\u2563';
|
|
483
|
+
console.log(chalk.cyan(GRID_TOP));
|
|
484
|
+
|
|
480
485
|
console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
|
|
481
486
|
|
|
482
|
-
//
|
|
483
|
-
const
|
|
484
|
-
console.log(chalk.cyan(SEP));
|
|
487
|
+
// Middle separator with intersections (between row1 and row2)
|
|
488
|
+
const GRID_MID = '\u2560' + '\u2550'.repeat(c1w) + '\u256A' + '\u2550'.repeat(c2w) + '\u256A' + '\u2550'.repeat(c3w) + '\u256A' + '\u2550'.repeat(c4w) + '\u256A' + '\u2550'.repeat(c5w) + '\u2563';
|
|
485
489
|
|
|
486
490
|
// Row 2: Target | Risk | P&L | Trades | W/L
|
|
487
491
|
const tgtLabel = 'Target';
|
|
@@ -652,11 +656,21 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
652
656
|
|
|
653
657
|
hqxServer.on('error', (data) => {
|
|
654
658
|
printLog('error', data.message || 'Unknown error');
|
|
659
|
+
// Stop algo on connection error
|
|
660
|
+
if (!stopReason) {
|
|
661
|
+
stopReason = 'connection_error';
|
|
662
|
+
algoRunning = false;
|
|
663
|
+
}
|
|
655
664
|
});
|
|
656
665
|
|
|
657
666
|
hqxServer.on('disconnected', () => {
|
|
658
667
|
hqxConnected = false;
|
|
659
|
-
printLog('
|
|
668
|
+
printLog('error', 'Connection lost - Stopping algo');
|
|
669
|
+
// Stop algo on disconnect
|
|
670
|
+
if (!stopReason) {
|
|
671
|
+
stopReason = 'disconnected';
|
|
672
|
+
algoRunning = false;
|
|
673
|
+
}
|
|
660
674
|
});
|
|
661
675
|
|
|
662
676
|
// Display header once
|
|
@@ -789,6 +803,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
789
803
|
console.log(chalk.green.bold(' [OK] Daily target reached! Algo stopped.'));
|
|
790
804
|
} else if (stopReason === 'risk') {
|
|
791
805
|
console.log(chalk.red.bold(' [X] Max risk reached! Algo stopped.'));
|
|
806
|
+
} else if (stopReason === 'disconnected' || stopReason === 'connection_error') {
|
|
807
|
+
console.log(chalk.red.bold(' [X] Connection lost! Algo stopped.'));
|
|
792
808
|
} else {
|
|
793
809
|
console.log(chalk.yellow(' [OK] Algo stopped by user'));
|
|
794
810
|
}
|