hedgequantx 1.2.77 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pages/algo.js +21 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.77",
3
+ "version": "1.2.78",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/pages/algo.js CHANGED
@@ -455,8 +455,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
455
455
  const latLabel = 'WS';
456
456
  const latVal = latencyStr;
457
457
 
458
- // Row 1 cells: widths = 36 + 18 + 10 + 14 + 14 = 92 + 4 separators = 96
459
- const c1w = 36, c2w = 18, c3w = 10, c4w = 14, c5w = 14;
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;
460
460
 
461
461
  // Safe padding function
462
462
  const safePad = (len) => ' '.repeat(Math.max(0, len));
@@ -478,11 +478,14 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
478
478
  cell4 + safePad(c4w - cell4plain.length) + chalk.cyan(VS) +
479
479
  cell5 + safePad(c5w - cell5plain.length);
480
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
+
481
485
  console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
482
486
 
483
- // Separator with intersections
484
- const SEP = '\u2560' + '\u2550'.repeat(c1w) + '\u256A' + '\u2550'.repeat(c2w) + '\u256A' + '\u2550'.repeat(c3w) + '\u256A' + '\u2550'.repeat(c4w) + '\u256A' + '\u2550'.repeat(c5w) + '\u2563';
485
- 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';
486
489
 
487
490
  // Row 2: Target | Risk | P&L | Trades | W/L
488
491
  const tgtLabel = 'Target';
@@ -653,11 +656,21 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
653
656
 
654
657
  hqxServer.on('error', (data) => {
655
658
  printLog('error', data.message || 'Unknown error');
659
+ // Stop algo on connection error
660
+ if (!stopReason) {
661
+ stopReason = 'connection_error';
662
+ algoRunning = false;
663
+ }
656
664
  });
657
665
 
658
666
  hqxServer.on('disconnected', () => {
659
667
  hqxConnected = false;
660
- printLog('warning', 'Disconnected from HQX Server');
668
+ printLog('error', 'Connection lost - Stopping algo');
669
+ // Stop algo on disconnect
670
+ if (!stopReason) {
671
+ stopReason = 'disconnected';
672
+ algoRunning = false;
673
+ }
661
674
  });
662
675
 
663
676
  // Display header once
@@ -790,6 +803,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
790
803
  console.log(chalk.green.bold(' [OK] Daily target reached! Algo stopped.'));
791
804
  } else if (stopReason === 'risk') {
792
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.'));
793
808
  } else {
794
809
  console.log(chalk.yellow(' [OK] Algo stopped by user'));
795
810
  }