hedgequantx 1.2.78 → 1.2.80

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 +38 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.78",
3
+ "version": "1.2.80",
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
@@ -435,7 +435,7 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
435
435
 
436
436
  // Centered subtitle
437
437
  const title2 = 'HQX Ultra-Scalping Algorithm';
438
- console.log(chalk.cyan(V) + chalk.white(center(title2, W)) + chalk.cyan(V));
438
+ console.log(chalk.cyan(V) + chalk.yellow(center(title2, W)) + chalk.cyan(V));
439
439
  console.log(chalk.cyan(MID));
440
440
 
441
441
  // Grid layout for metrics - each in its own cell
@@ -516,8 +516,12 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
516
516
  cell9 + safePad(c4w - cell9plain.length) + chalk.cyan(VS) +
517
517
  cell10 + safePad(c5w - cell10plain.length);
518
518
 
519
+ console.log(chalk.cyan(GRID_MID));
519
520
  console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
520
- console.log(chalk.cyan(MID));
521
+
522
+ // Bottom of grid (before Activity Log)
523
+ const GRID_BOT = '\u2560' + '\u2550'.repeat(c1w) + '\u2567' + '\u2550'.repeat(c2w) + '\u2567' + '\u2550'.repeat(c3w) + '\u2567' + '\u2550'.repeat(c4w) + '\u2567' + '\u2550'.repeat(c5w) + '\u2563';
524
+ console.log(chalk.cyan(GRID_BOT));
521
525
 
522
526
  // Activity log header with spinner and centered date
523
527
  spinnerFrame = (spinnerFrame + 1) % spinnerChars.length;
@@ -810,10 +814,11 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
810
814
  }
811
815
  console.log();
812
816
 
813
- // Final stats in a grid box
814
- const V = '\u2551';
815
- const VS = '\u2502';
816
- const H = '\u2550';
817
+ // Final stats in a grid box - must match main UI width of 96
818
+ const summaryV = '\u2551';
819
+ const summaryVS = '\u2502';
820
+ const summaryH = '\u2550';
821
+ const summaryW = 96; // Same as main UI
817
822
 
818
823
  // Calculate session duration
819
824
  const sessionDuration = Date.now() - sessionStartTime;
@@ -826,50 +831,53 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
826
831
  ? `${durationMin}m ${durationSec % 60}s`
827
832
  : `${durationSec}s`;
828
833
 
829
- // Cell widths: 4 cells of 24 each = 96
830
- const cw = 24;
831
- const W = cw * 4;
834
+ // 4 cells + 3 separators = 96 inner chars
835
+ // 96 - 3 separators = 93, divided by 4 = 23.25, so use 24+23+24+23 = 94... need 96
836
+ // Let's use: 24 + 24 + 24 + 21 = 93 + 3 sep = 96
837
+ const sc1 = 24, sc2 = 24, sc3 = 24, sc4 = 21;
832
838
 
833
- const TOP = '\u2554' + H.repeat(cw) + '\u2564' + H.repeat(cw) + '\u2564' + H.repeat(cw) + '\u2564' + H.repeat(cw) + '\u2557';
834
- const MID = '\u2560' + H.repeat(cw) + '\u256A' + H.repeat(cw) + '\u256A' + H.repeat(cw) + '\u256A' + H.repeat(cw) + '\u2563';
835
- const BOT = '\u255A' + H.repeat(cw) + '\u2567' + H.repeat(cw) + '\u2567' + H.repeat(cw) + '\u2567' + H.repeat(cw) + '\u255D';
836
-
837
- const cell = (label, value, width) => {
839
+ const summaryCell = (label, value, width) => {
838
840
  const text = ` ${label}: ${value}`;
839
841
  const stripped = text.replace(/\x1b\[[0-9;]*m/g, '');
840
842
  const padding = Math.max(0, width - stripped.length);
841
843
  return text + ' '.repeat(padding);
842
844
  };
843
845
 
844
- const centerTitle = (text, width) => {
846
+ const centerSummaryTitle = (text, width) => {
845
847
  const pad = Math.floor((width - text.length) / 2);
846
848
  return ' '.repeat(pad) + text + ' '.repeat(width - pad - text.length);
847
849
  };
848
850
 
849
851
  const pnlValue = stats.pnl >= 0 ? chalk.green('+$' + stats.pnl.toFixed(2)) : chalk.red('-$' + Math.abs(stats.pnl).toFixed(2));
850
852
 
853
+ // Build separator lines
854
+ const SUMMARY_TOP = '\u2554' + summaryH.repeat(summaryW) + '\u2557';
855
+ const SUMMARY_GRID_TOP = '\u2560' + summaryH.repeat(sc1) + '\u2564' + summaryH.repeat(sc2) + '\u2564' + summaryH.repeat(sc3) + '\u2564' + summaryH.repeat(sc4) + '\u2563';
856
+ const SUMMARY_GRID_MID = '\u2560' + summaryH.repeat(sc1) + '\u256A' + summaryH.repeat(sc2) + '\u256A' + summaryH.repeat(sc3) + '\u256A' + summaryH.repeat(sc4) + '\u2563';
857
+ const SUMMARY_BOT = '\u255A' + summaryH.repeat(sc1) + '\u2567' + summaryH.repeat(sc2) + '\u2567' + summaryH.repeat(sc3) + '\u2567' + summaryH.repeat(sc4) + '\u255D';
858
+
851
859
  console.log();
852
- console.log(chalk.cyan('\u2554' + H.repeat(W) + '\u2557'));
853
- console.log(chalk.cyan(V) + chalk.white.bold(centerTitle('Session Summary', W)) + chalk.cyan(V));
854
- console.log(chalk.cyan(TOP.replace('\u2554', '\u2560').replace('\u2557', '\u2563')));
860
+ console.log(chalk.cyan(SUMMARY_TOP));
861
+ console.log(chalk.cyan(summaryV) + chalk.white.bold(centerSummaryTitle('Session Summary', summaryW)) + chalk.cyan(summaryV));
862
+ console.log(chalk.cyan(SUMMARY_GRID_TOP));
855
863
 
856
864
  // Row 1: Target | Risk | P&L | Win Rate
857
- const r1c1 = cell('Target', chalk.green('$' + dailyTarget.toFixed(2)), cw);
858
- const r1c2 = cell('Risk', chalk.red('$' + maxRisk.toFixed(2)), cw);
859
- const r1c3 = cell('P&L', pnlValue, cw);
860
- const r1c4 = cell('Win Rate', chalk.yellow(stats.winRate + '%'), cw);
861
- console.log(chalk.cyan(V) + r1c1 + chalk.cyan(VS) + r1c2 + chalk.cyan(VS) + r1c3 + chalk.cyan(VS) + r1c4 + chalk.cyan(V));
865
+ const r1c1 = summaryCell('Target', chalk.green('$' + dailyTarget.toFixed(2)), sc1);
866
+ const r1c2 = summaryCell('Risk', chalk.red('$' + maxRisk.toFixed(2)), sc2);
867
+ const r1c3 = summaryCell('P&L', pnlValue, sc3);
868
+ const r1c4 = summaryCell('Win Rate', chalk.yellow(stats.winRate + '%'), sc4);
869
+ console.log(chalk.cyan(summaryV) + r1c1 + chalk.cyan(summaryVS) + r1c2 + chalk.cyan(summaryVS) + r1c3 + chalk.cyan(summaryVS) + r1c4 + chalk.cyan(summaryV));
862
870
 
863
- console.log(chalk.cyan(MID));
871
+ console.log(chalk.cyan(SUMMARY_GRID_MID));
864
872
 
865
873
  // Row 2: Trades | Wins | Losses | Duration
866
- const r2c1 = cell('Trades', chalk.cyan(stats.trades.toString()), cw);
867
- const r2c2 = cell('Wins', chalk.green(stats.wins.toString()), cw);
868
- const r2c3 = cell('Losses', chalk.red(stats.losses.toString()), cw);
869
- const r2c4 = cell('Duration', chalk.white(durationStr), cw);
870
- console.log(chalk.cyan(V) + r2c1 + chalk.cyan(VS) + r2c2 + chalk.cyan(VS) + r2c3 + chalk.cyan(VS) + r2c4 + chalk.cyan(V));
874
+ const r2c1 = summaryCell('Trades', chalk.cyan(stats.trades.toString()), sc1);
875
+ const r2c2 = summaryCell('Wins', chalk.green(stats.wins.toString()), sc2);
876
+ const r2c3 = summaryCell('Losses', chalk.red(stats.losses.toString()), sc3);
877
+ const r2c4 = summaryCell('Duration', chalk.white(durationStr), sc4);
878
+ console.log(chalk.cyan(summaryV) + r2c1 + chalk.cyan(summaryVS) + r2c2 + chalk.cyan(summaryVS) + r2c3 + chalk.cyan(summaryVS) + r2c4 + chalk.cyan(summaryV));
871
879
 
872
- console.log(chalk.cyan(BOT));
880
+ console.log(chalk.cyan(SUMMARY_BOT));
873
881
  console.log();
874
882
 
875
883
  await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);