hedgequantx 1.2.89 → 1.2.91

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 +40 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.89",
3
+ "version": "1.2.91",
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
@@ -470,8 +470,10 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
470
470
  // Stats
471
471
  const pnlColor = stats.pnl >= 0 ? chalk.green : chalk.red;
472
472
  const pnlStr = (stats.pnl >= 0 ? '+$' : '-$') + Math.abs(stats.pnl).toFixed(2);
473
- const latencyStr = hqxConnected ? (latency > 0 ? `${latency}ms` : '--') : '--';
474
- const latencyColor = latency < 100 ? chalk.green : (latency < 300 ? chalk.yellow : chalk.red);
473
+ // Always show latency in ms format
474
+ const latencyMs = latency > 0 ? latency : 0;
475
+ const latencyStr = `${latencyMs}ms`;
476
+ const latencyColor = latencyMs < 100 ? chalk.green : (latencyMs < 300 ? chalk.yellow : chalk.red);
475
477
  const serverStatus = hqxConnected ? 'ON' : 'OFF';
476
478
  const serverColor = hqxConnected ? chalk.green : chalk.red;
477
479
 
@@ -540,6 +542,25 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
540
542
  return { text, plain, padded: text + safePad(width - plain.length) };
541
543
  };
542
544
 
545
+ // Row 1: Account | Symbol + Qty
546
+ // Row 2: Target | Risk
547
+ // Row 3: P&L | Server
548
+ // Row 4: Trades + W/L | Latency
549
+ const VS = '\u2502'; // Vertical separator (thin)
550
+
551
+ // 2 columns: 48 + 47 + 1 separator = 96
552
+ const colL = 48, colR = 47;
553
+
554
+ // Safe padding function
555
+ const safePad = (len) => ' '.repeat(Math.max(0, len));
556
+
557
+ // Build cell helper
558
+ const buildCell = (label, value, valueColor, width) => {
559
+ const text = ` ${label}: ${valueColor(value)}`;
560
+ const plain = ` ${label}: ${value}`;
561
+ return { text, plain, padded: text + safePad(width - plain.length) };
562
+ };
563
+
543
564
  // Row 1: Account | Symbol + Qty
544
565
  const accVal = accountName.length > 35 ? accountName.substring(0, 35) : accountName;
545
566
  const symVal = symbolName.length > 12 ? symbolName.substring(0, 12) : symbolName;
@@ -552,13 +573,15 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
552
573
  const r2c1 = buildCell('Target', '$' + dailyTarget.toFixed(2), chalk.green, colL);
553
574
  const r2c2 = buildCell('Risk', '$' + maxRisk.toFixed(2), chalk.red, colR);
554
575
 
555
- // Row 3: P&L | Trades | Server | WS (4 items in 2 columns)
556
- const r3c1text = ` P&L: ${pnlColor(pnlStr)} Trades: ${chalk.cyan(stats.trades)} W/L: ${chalk.green(stats.wins)}/${chalk.red(stats.losses)}`;
557
- const r3c1plain = ` P&L: ${pnlStr} Trades: ${stats.trades} W/L: ${stats.wins}/${stats.losses}`;
558
- const r3c1 = r3c1text + safePad(colL - r3c1plain.length);
559
- const r3c2text = ` Server: ${serverColor(serverStatus)} WS: ${latencyColor(latencyStr)}`;
560
- const r3c2plain = ` Server: ${serverStatus} WS: ${latencyStr}`;
561
- const r3c2 = r3c2text + safePad(colR - r3c2plain.length);
576
+ // Row 3: P&L | Server
577
+ const r3c1 = buildCell('P&L', pnlStr, pnlColor, colL);
578
+ const r3c2 = buildCell('Server', serverStatus, serverColor, colR);
579
+
580
+ // Row 4: Trades + W/L | Latency
581
+ const r4c1text = ` Trades: ${chalk.cyan(stats.trades)} W/L: ${chalk.green(stats.wins)}/${chalk.red(stats.losses)}`;
582
+ const r4c1plain = ` Trades: ${stats.trades} W/L: ${stats.wins}/${stats.losses}`;
583
+ const r4c1 = r4c1text + safePad(colL - r4c1plain.length);
584
+ const r4c2 = buildCell('Latency', latencyStr, latencyColor, colR);
562
585
 
563
586
  // Grid separators
564
587
  const GRID_TOP = '\u2560' + '\u2550'.repeat(colL) + '\u2564' + '\u2550'.repeat(colR) + '\u2563';
@@ -571,7 +594,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
571
594
  console.log(chalk.cyan(GRID_MID));
572
595
  console.log(chalk.cyan(V) + r2c1.padded + chalk.cyan(VS) + r2c2.padded + chalk.cyan(V));
573
596
  console.log(chalk.cyan(GRID_MID));
574
- console.log(chalk.cyan(V) + r3c1 + chalk.cyan(VS) + r3c2 + chalk.cyan(V));
597
+ console.log(chalk.cyan(V) + r3c1.padded + chalk.cyan(VS) + r3c2.padded + chalk.cyan(V));
598
+ console.log(chalk.cyan(GRID_MID));
599
+ console.log(chalk.cyan(V) + r4c1 + chalk.cyan(VS) + r4c2.padded + chalk.cyan(V));
575
600
  console.log(chalk.cyan(GRID_BOT));
576
601
 
577
602
  // Activity log header with spinner and centered date
@@ -605,7 +630,11 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
605
630
  console.log(color(logLine) + '\x1B[K');
606
631
  });
607
632
  }
608
- // Clear remaining lines below logs
633
+ // Add 30 empty lines so old logs scroll down further
634
+ for (let i = 0; i < 30; i++) {
635
+ console.log('\x1B[K');
636
+ }
637
+ // Clear remaining lines below
609
638
  process.stdout.write('\x1B[J');
610
639
  };
611
640