hedgequantx 1.2.71 → 1.2.72

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 +72 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.71",
3
+ "version": "1.2.72",
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
@@ -434,26 +434,79 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
434
434
  console.log(chalk.cyan(V) + chalk.white(center(title2, W)) + chalk.cyan(V));
435
435
  console.log(chalk.cyan(MID));
436
436
 
437
- // Account line - build plain string first, then color
438
- const acc = accountName.length > 24 ? accountName.substring(0, 24) : accountName.padEnd(24);
439
- const sym = symbolName.length > 8 ? symbolName.substring(0, 8) : symbolName.padEnd(8);
440
- const qty = numContracts.toString().padEnd(2);
441
- const srv = serverStatus.padEnd(3);
442
- const lat = latencyStr.padEnd(6);
443
- const line1 = ` Account: ${acc} Symbol: ${sym} Qty: ${qty} Server: ${srv} ${lat}`;
444
- const line1Colored = ` Account: ${chalk.cyan(acc)} Symbol: ${chalk.yellow(sym)} Qty: ${chalk.cyan(qty)} Server: ${serverColor(srv)} ${latencyColor(lat)}`;
445
- console.log(chalk.cyan(V) + line1Colored + ' '.repeat(W - line1.length) + chalk.cyan(V));
437
+ // Grid layout for metrics - each in its own cell
438
+ // Row 1: Account | Symbol | Qty | Server | Latency
439
+ // Row 2: Target | Risk | P&L | Trades | W/L
440
+ const VS = '\u2502'; // Vertical separator (thin)
446
441
 
447
- // Target line
448
- const tgt = ('$' + dailyTarget.toFixed(2)).padEnd(10);
449
- const rsk = ('$' + maxRisk.toFixed(2)).padEnd(10);
450
- const pnl = pnlStr.padEnd(10);
451
- const trd = stats.trades.toString().padEnd(2);
452
- const win = stats.wins.toString();
453
- const los = stats.losses.toString();
454
- const line2 = ` Target: ${tgt} Risk: ${rsk} P&L: ${pnl} Trades: ${trd} W:${win} L:${los}`;
455
- const line2Colored = ` Target: ${chalk.green(tgt)} Risk: ${chalk.red(rsk)} P&L: ${pnlColor(pnl)} Trades: ${chalk.cyan(trd)} W:${chalk.green(win)} L:${chalk.red(los)}`;
456
- console.log(chalk.cyan(V) + line2Colored + ' '.repeat(W - line2.length) + chalk.cyan(V));
442
+ // Prepare values with fixed widths
443
+ const accLabel = 'Account';
444
+ const accVal = accountName.length > 26 ? accountName.substring(0, 26) : accountName;
445
+ const symLabel = 'Symbol';
446
+ const symVal = symbolName.length > 10 ? symbolName.substring(0, 10) : symbolName;
447
+ const qtyLabel = 'Qty';
448
+ const qtyVal = numContracts.toString();
449
+ const srvLabel = 'Server';
450
+ const srvVal = serverStatus;
451
+ const latLabel = 'Latency';
452
+ const latVal = latencyStr;
453
+
454
+ // Row 1 cells: widths = 36 + 18 + 10 + 14 + 14 = 92 + 4 separators = 96
455
+ const c1w = 36, c2w = 18, c3w = 10, c4w = 14, c5w = 14;
456
+
457
+ const cell1 = ` ${accLabel}: ${chalk.cyan(accVal)}`;
458
+ const cell1plain = ` ${accLabel}: ${accVal}`;
459
+ const cell2 = ` ${symLabel}: ${chalk.yellow(symVal)}`;
460
+ const cell2plain = ` ${symLabel}: ${symVal}`;
461
+ const cell3 = ` ${qtyLabel}: ${chalk.cyan(qtyVal)}`;
462
+ const cell3plain = ` ${qtyLabel}: ${qtyVal}`;
463
+ const cell4 = ` ${srvLabel}: ${serverColor(srvVal)}`;
464
+ const cell4plain = ` ${srvLabel}: ${srvVal}`;
465
+ const cell5 = ` ${latLabel}: ${latencyColor(latVal)}`;
466
+ const cell5plain = ` ${latLabel}: ${latVal}`;
467
+
468
+ const row1 = cell1 + ' '.repeat(c1w - cell1plain.length) + chalk.cyan(VS) +
469
+ cell2 + ' '.repeat(c2w - cell2plain.length) + chalk.cyan(VS) +
470
+ cell3 + ' '.repeat(c3w - cell3plain.length) + chalk.cyan(VS) +
471
+ cell4 + ' '.repeat(c4w - cell4plain.length) + chalk.cyan(VS) +
472
+ cell5 + ' '.repeat(c5w - cell5plain.length);
473
+
474
+ console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
475
+
476
+ // Separator with intersections
477
+ const SEP = '\u2560' + '\u2550'.repeat(c1w) + '\u256A' + '\u2550'.repeat(c2w) + '\u256A' + '\u2550'.repeat(c3w) + '\u256A' + '\u2550'.repeat(c4w) + '\u256A' + '\u2550'.repeat(c5w) + '\u2563';
478
+ console.log(chalk.cyan(SEP));
479
+
480
+ // Row 2: Target | Risk | P&L | Trades | W/L
481
+ const tgtLabel = 'Target';
482
+ const tgtVal = '$' + dailyTarget.toFixed(2);
483
+ const rskLabel = 'Risk';
484
+ const rskVal = '$' + maxRisk.toFixed(2);
485
+ const pnlLabel = 'P&L';
486
+ const pnlVal = pnlStr;
487
+ const trdLabel = 'Trades';
488
+ const trdVal = stats.trades.toString();
489
+ const wlLabel = 'W/L';
490
+ const wlVal = `${stats.wins}/${stats.losses}`;
491
+
492
+ const cell6 = ` ${tgtLabel}: ${chalk.green(tgtVal)}`;
493
+ const cell6plain = ` ${tgtLabel}: ${tgtVal}`;
494
+ const cell7 = ` ${rskLabel}: ${chalk.red(rskVal)}`;
495
+ const cell7plain = ` ${rskLabel}: ${rskVal}`;
496
+ const cell8 = ` ${pnlLabel}: ${pnlColor(pnlVal)}`;
497
+ const cell8plain = ` ${pnlLabel}: ${pnlVal}`;
498
+ const cell9 = ` ${trdLabel}: ${chalk.cyan(trdVal)}`;
499
+ const cell9plain = ` ${trdLabel}: ${trdVal}`;
500
+ const cell10 = ` ${wlLabel}: ${chalk.green(stats.wins.toString())}/${chalk.red(stats.losses.toString())}`;
501
+ const cell10plain = ` ${wlLabel}: ${wlVal}`;
502
+
503
+ const row2 = cell6 + ' '.repeat(c1w - cell6plain.length) + chalk.cyan(VS) +
504
+ cell7 + ' '.repeat(c2w - cell7plain.length) + chalk.cyan(VS) +
505
+ cell8 + ' '.repeat(c3w - cell8plain.length) + chalk.cyan(VS) +
506
+ cell9 + ' '.repeat(c4w - cell9plain.length) + chalk.cyan(VS) +
507
+ cell10 + ' '.repeat(c5w - cell10plain.length);
508
+
509
+ console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
457
510
  console.log(chalk.cyan(MID));
458
511
 
459
512
  // Activity log header