hedgequantx 1.2.75 → 1.2.76

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 +28 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.75",
3
+ "version": "1.2.76",
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
@@ -419,12 +419,12 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
419
419
 
420
420
  console.log();
421
421
  console.log(chalk.cyan(TOP));
422
- console.log(chalk.cyan(V) + chalk.cyan(' \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 ') + chalk.cyan(V));
423
- console.log(chalk.cyan(V) + chalk.cyan(' \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D ') + chalk.cyan(V));
424
- console.log(chalk.cyan(V) + chalk.cyan(' \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D ') + chalk.cyan(V));
425
- console.log(chalk.cyan(V) + chalk.cyan(' \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u2584\u2584 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 ') + chalk.cyan(V));
426
- console.log(chalk.cyan(V) + chalk.cyan(' \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2588\u2588\u2557 ') + chalk.cyan(V));
427
- console.log(chalk.cyan(V) + chalk.cyan(' \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D ') + chalk.cyan(V));
422
+ console.log(chalk.cyan(V) + chalk.cyan(' ██╗ ██╗███████╗██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗ █████╗ ███╗ ██╗████████╗') + chalk.yellow('██╗ ██╗ ') + chalk.cyan(V));
423
+ console.log(chalk.cyan(V) + chalk.cyan(' ██║ ██║██╔════╝██╔══██╗██╔════╝ ██╔════╝██╔═══██╗██║ ██║██╔══██╗████╗ ██║╚══██╔══╝') + chalk.yellow('╚██╗██╔╝ ') + chalk.cyan(V));
424
+ console.log(chalk.cyan(V) + chalk.cyan(' ███████║█████╗ ██║ ██║██║ ███╗█████╗ ██║ ██║██║ ██║███████║██╔██╗ ██║ ██║ ') + chalk.yellow(' ╚███╔╝ ') + chalk.cyan(V));
425
+ console.log(chalk.cyan(V) + chalk.cyan(' ██╔══██║██╔══╝ ██║ ██║██║ ██║██╔══╝ ██║▄▄ ██║██║ ██║██╔══██║██║╚██╗██║ ██║ ') + chalk.yellow(' ██╔██╗ ') + chalk.cyan(V));
426
+ console.log(chalk.cyan(V) + chalk.cyan(' ██║ ██║███████╗██████╔╝╚██████╔╝███████╗╚██████╔╝╚██████╔╝██║ ██║██║ ╚████║ ██║ ') + chalk.yellow('██╔╝ ██╗ ') + chalk.cyan(V));
427
+ console.log(chalk.cyan(V) + chalk.cyan(' ╚═╝ ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚══════╝ ╚══▀▀═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ') + chalk.yellow('╚═╝ ╚═╝ ') + chalk.cyan(V));
428
428
  console.log(chalk.cyan(MID));
429
429
 
430
430
  // Centered title
@@ -457,6 +457,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
457
457
  // Row 1 cells: widths = 36 + 18 + 10 + 14 + 14 = 92 + 4 separators = 96
458
458
  const c1w = 36, c2w = 18, c3w = 10, c4w = 14, c5w = 14;
459
459
 
460
+ // Safe padding function
461
+ const safePad = (len) => ' '.repeat(Math.max(0, len));
462
+
460
463
  const cell1 = ` ${accLabel}: ${chalk.cyan(accVal)}`;
461
464
  const cell1plain = ` ${accLabel}: ${accVal}`;
462
465
  const cell2 = ` ${symLabel}: ${chalk.yellow(symVal)}`;
@@ -468,11 +471,11 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
468
471
  const cell5 = ` ${latLabel}: ${latencyColor(latVal)}`;
469
472
  const cell5plain = ` ${latLabel}: ${latVal}`;
470
473
 
471
- const row1 = cell1 + ' '.repeat(c1w - cell1plain.length) + chalk.cyan(VS) +
472
- cell2 + ' '.repeat(c2w - cell2plain.length) + chalk.cyan(VS) +
473
- cell3 + ' '.repeat(c3w - cell3plain.length) + chalk.cyan(VS) +
474
- cell4 + ' '.repeat(c4w - cell4plain.length) + chalk.cyan(VS) +
475
- cell5 + ' '.repeat(c5w - cell5plain.length);
474
+ const row1 = cell1 + safePad(c1w - cell1plain.length) + chalk.cyan(VS) +
475
+ cell2 + safePad(c2w - cell2plain.length) + chalk.cyan(VS) +
476
+ cell3 + safePad(c3w - cell3plain.length) + chalk.cyan(VS) +
477
+ cell4 + safePad(c4w - cell4plain.length) + chalk.cyan(VS) +
478
+ cell5 + safePad(c5w - cell5plain.length);
476
479
 
477
480
  console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
478
481
 
@@ -503,27 +506,28 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
503
506
  const cell10 = ` ${wlLabel}: ${chalk.green(stats.wins.toString())}/${chalk.red(stats.losses.toString())}`;
504
507
  const cell10plain = ` ${wlLabel}: ${wlVal}`;
505
508
 
506
- const row2 = cell6 + ' '.repeat(c1w - cell6plain.length) + chalk.cyan(VS) +
507
- cell7 + ' '.repeat(c2w - cell7plain.length) + chalk.cyan(VS) +
508
- cell8 + ' '.repeat(c3w - cell8plain.length) + chalk.cyan(VS) +
509
- cell9 + ' '.repeat(c4w - cell9plain.length) + chalk.cyan(VS) +
510
- cell10 + ' '.repeat(c5w - cell10plain.length);
509
+ const row2 = cell6 + safePad(c1w - cell6plain.length) + chalk.cyan(VS) +
510
+ cell7 + safePad(c2w - cell7plain.length) + chalk.cyan(VS) +
511
+ cell8 + safePad(c3w - cell8plain.length) + chalk.cyan(VS) +
512
+ cell9 + safePad(c4w - cell9plain.length) + chalk.cyan(VS) +
513
+ cell10 + safePad(c5w - cell10plain.length);
511
514
 
512
515
  console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
513
516
  console.log(chalk.cyan(MID));
514
517
 
515
518
  // Activity log header with spinner and centered date
516
519
  spinnerFrame = (spinnerFrame + 1) % spinnerChars.length;
517
- const spinner = spinnerChars[spinnerFrame];
518
- const actLeft = ` Activity Log ${chalk.cyan(spinner)}`;
519
- const actLeftPlain = ` Activity Log ${spinner}`;
520
+ const spinnerChar = spinnerChars[spinnerFrame];
521
+ const actLeft = ` Activity Log ${chalk.cyan(spinnerChar)}`;
522
+ const actLeftPlain = ` Activity Log ${spinnerChar}`;
520
523
  const actRight = 'Press X to stop ';
521
524
  const dateCentered = `- ${dateStr} -`;
522
525
  const leftLen = actLeftPlain.length;
523
526
  const rightLen = actRight.length;
524
- const midSpace = W - leftLen - rightLen;
525
- const datePad = Math.floor((midSpace - dateCentered.length) / 2);
526
- const dateSection = ' '.repeat(datePad) + chalk.gray(dateCentered) + ' '.repeat(midSpace - datePad - dateCentered.length);
527
+ const midSpace = Math.max(0, W - leftLen - rightLen);
528
+ const datePad = Math.max(0, Math.floor((midSpace - dateCentered.length) / 2));
529
+ const remainingPad = Math.max(0, midSpace - datePad - dateCentered.length);
530
+ const dateSection = ' '.repeat(datePad) + chalk.gray(dateCentered) + ' '.repeat(remainingPad);
527
531
  console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
528
532
  console.log(chalk.cyan(BOT));
529
533
 
@@ -817,7 +821,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
817
821
  const cell = (label, value, width) => {
818
822
  const text = ` ${label}: ${value}`;
819
823
  const stripped = text.replace(/\x1b\[[0-9;]*m/g, '');
820
- return text + ' '.repeat(width - stripped.length);
824
+ const padding = Math.max(0, width - stripped.length);
825
+ return text + ' '.repeat(padding);
821
826
  };
822
827
 
823
828
  const centerTitle = (text, width) => {