hedgequantx 1.2.72 → 1.2.74

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 +30 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.72",
3
+ "version": "1.2.74",
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
@@ -307,6 +307,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
307
307
  let algoRunning = false;
308
308
  let stopReason = null;
309
309
  let latency = 0;
310
+ let spinnerFrame = 0;
311
+ const spinnerChars = ['\u280B', '\u2819', '\u2839', '\u2838', '\u283C', '\u2834', '\u2826', '\u2827', '\u2807', '\u280F'];
310
312
 
311
313
  // Stats
312
314
  let stats = {
@@ -383,7 +385,7 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
383
385
  // Stats
384
386
  const pnlColor = stats.pnl >= 0 ? chalk.green : chalk.red;
385
387
  const pnlStr = (stats.pnl >= 0 ? '+$' : '-$') + Math.abs(stats.pnl).toFixed(2);
386
- const latencyStr = hqxConnected ? (latency > 0 ? `${latency}ms` : '---') : '---';
388
+ const latencyStr = hqxConnected ? (latency > 0 ? `ws:${latency}ms` : 'ws:--') : 'ws:--';
387
389
  const latencyColor = latency < 100 ? chalk.green : (latency < 300 ? chalk.yellow : chalk.red);
388
390
  const serverStatus = hqxConnected ? 'ON' : 'OFF';
389
391
  const serverColor = hqxConnected ? chalk.green : chalk.red;
@@ -448,7 +450,7 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
448
450
  const qtyVal = numContracts.toString();
449
451
  const srvLabel = 'Server';
450
452
  const srvVal = serverStatus;
451
- const latLabel = 'Latency';
453
+ const latLabel = 'WS';
452
454
  const latVal = latencyStr;
453
455
 
454
456
  // Row 1 cells: widths = 36 + 18 + 10 + 14 + 14 = 92 + 4 separators = 96
@@ -509,19 +511,29 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
509
511
  console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
510
512
  console.log(chalk.cyan(MID));
511
513
 
512
- // Activity log header
513
- const actLeft = ` Activity Log - ${dateStr}`;
514
+ // Activity log header with spinner and centered date
515
+ spinnerFrame = (spinnerFrame + 1) % spinnerChars.length;
516
+ const spinner = spinnerChars[spinnerFrame];
517
+ const actLeft = ` Activity Log ${chalk.cyan(spinner)}`;
518
+ const actLeftPlain = ` Activity Log ${spinner}`;
514
519
  const actRight = 'Press X to stop ';
515
- const actMid = W - actLeft.length - actRight.length;
516
- console.log(chalk.cyan(V) + chalk.white(actLeft) + ' '.repeat(actMid) + chalk.yellow(actRight) + chalk.cyan(V));
520
+ const dateCentered = `- ${dateStr} -`;
521
+ const leftLen = actLeftPlain.length;
522
+ const rightLen = actRight.length;
523
+ const midSpace = W - leftLen - rightLen;
524
+ const datePad = Math.floor((midSpace - dateCentered.length) / 2);
525
+ const dateSection = ' '.repeat(datePad) + chalk.gray(dateCentered) + ' '.repeat(midSpace - datePad - dateCentered.length);
526
+ console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
517
527
  console.log(chalk.cyan(BOT));
518
528
 
519
- // Logs (without borders)
529
+ // Logs (without borders) - newest first
520
530
  console.log();
521
531
  if (logs.length === 0) {
522
532
  console.log(chalk.gray(' Waiting for activity...'));
523
533
  } else {
524
- logs.forEach(log => {
534
+ // Reverse to show newest first
535
+ const reversedLogs = [...logs].reverse();
536
+ reversedLogs.forEach(log => {
525
537
  const color = typeColors[log.type] || chalk.white;
526
538
  const icon = getIcon(log.type);
527
539
  console.log(color(` [${log.timestamp}] ${icon} ${log.message}`));
@@ -529,6 +541,13 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
529
541
  }
530
542
  };
531
543
 
544
+ // Spinner interval to refresh UI
545
+ const spinnerInterval = setInterval(() => {
546
+ if (algoRunning) {
547
+ displayUI();
548
+ }
549
+ }, 100);
550
+
532
551
  // Connect to HQX Server
533
552
  const spinner = ora('Authenticating with HQX Server...').start();
534
553
 
@@ -703,6 +722,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
703
722
  }
704
723
  });
705
724
 
725
+ // Clear spinner interval
726
+ clearInterval(spinnerInterval);
727
+
706
728
  // Stop algo
707
729
  console.log();
708
730
  if (!stopReason) {