hedgequantx 1.2.81 → 1.2.83
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.
- package/package.json +1 -1
- package/src/pages/algo.js +48 -76
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -153,10 +153,15 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
153
153
|
console.log(chalk.gray(getSeparator()));
|
|
154
154
|
console.log();
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
// Format symbols with aligned columns: "NQ - E-mini NASDAQ-100"
|
|
157
|
+
const symbolChoices = FUTURES_SYMBOLS.map(symbol => {
|
|
158
|
+
const code = symbol.value.padEnd(4);
|
|
159
|
+
const desc = symbol.name.split(' - ')[1] || '';
|
|
160
|
+
return {
|
|
161
|
+
name: chalk.yellow(code) + chalk.gray(' - ') + chalk.white(desc),
|
|
162
|
+
value: symbol
|
|
163
|
+
};
|
|
164
|
+
});
|
|
160
165
|
|
|
161
166
|
symbolChoices.push(new inquirer.Separator());
|
|
162
167
|
symbolChoices.push({ name: chalk.yellow('< Back'), value: 'back' });
|
|
@@ -436,91 +441,58 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
436
441
|
// Centered subtitle
|
|
437
442
|
const title2 = 'HQX Ultra-Scalping Algorithm';
|
|
438
443
|
console.log(chalk.cyan(V) + chalk.yellow(center(title2, W)) + chalk.cyan(V));
|
|
439
|
-
console.log(chalk.cyan(MID));
|
|
440
444
|
|
|
441
|
-
// Grid layout for metrics -
|
|
442
|
-
// Row 1: Account | Symbol
|
|
443
|
-
// Row 2: Target | Risk
|
|
445
|
+
// Grid layout for metrics - 2 columns per row, 3 rows
|
|
446
|
+
// Row 1: Account | Symbol
|
|
447
|
+
// Row 2: Target | Risk
|
|
448
|
+
// Row 3: P&L | Trades | Server | WS
|
|
444
449
|
const VS = '\u2502'; // Vertical separator (thin)
|
|
445
450
|
|
|
446
|
-
//
|
|
447
|
-
const
|
|
448
|
-
const accVal = accountName.length > 26 ? accountName.substring(0, 26) : accountName;
|
|
449
|
-
const symLabel = 'Symbol';
|
|
450
|
-
const symVal = symbolName.length > 10 ? symbolName.substring(0, 10) : symbolName;
|
|
451
|
-
const qtyLabel = 'Qty';
|
|
452
|
-
const qtyVal = numContracts.toString();
|
|
453
|
-
const srvLabel = 'Server';
|
|
454
|
-
const srvVal = serverStatus;
|
|
455
|
-
const latLabel = 'WS';
|
|
456
|
-
const latVal = latencyStr;
|
|
457
|
-
|
|
458
|
-
// Row 1 cells: widths = 36 + 17 + 9 + 13 + 13 = 88 + 4 separators + 4 spaces = 96
|
|
459
|
-
const c1w = 36, c2w = 17, c3w = 9, c4w = 13, c5w = 17;
|
|
451
|
+
// 2 columns: 48 + 47 + 1 separator = 96
|
|
452
|
+
const colL = 48, colR = 47;
|
|
460
453
|
|
|
461
454
|
// Safe padding function
|
|
462
455
|
const safePad = (len) => ' '.repeat(Math.max(0, len));
|
|
463
456
|
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const cell4 = ` ${srvLabel}: ${serverColor(srvVal)}`;
|
|
471
|
-
const cell4plain = ` ${srvLabel}: ${srvVal}`;
|
|
472
|
-
const cell5 = ` ${latLabel}: ${latencyColor(latVal)}`;
|
|
473
|
-
const cell5plain = ` ${latLabel}: ${latVal}`;
|
|
474
|
-
|
|
475
|
-
const row1 = cell1 + safePad(c1w - cell1plain.length) + chalk.cyan(VS) +
|
|
476
|
-
cell2 + safePad(c2w - cell2plain.length) + chalk.cyan(VS) +
|
|
477
|
-
cell3 + safePad(c3w - cell3plain.length) + chalk.cyan(VS) +
|
|
478
|
-
cell4 + safePad(c4w - cell4plain.length) + chalk.cyan(VS) +
|
|
479
|
-
cell5 + safePad(c5w - cell5plain.length);
|
|
480
|
-
|
|
481
|
-
// Top separator for grid (after HQX Ultra-Scalping)
|
|
482
|
-
const GRID_TOP = '\u2560' + '\u2550'.repeat(c1w) + '\u2564' + '\u2550'.repeat(c2w) + '\u2564' + '\u2550'.repeat(c3w) + '\u2564' + '\u2550'.repeat(c4w) + '\u2564' + '\u2550'.repeat(c5w) + '\u2563';
|
|
483
|
-
console.log(chalk.cyan(GRID_TOP));
|
|
484
|
-
|
|
485
|
-
console.log(chalk.cyan(V) + row1 + chalk.cyan(V));
|
|
457
|
+
// Build cell helper
|
|
458
|
+
const buildCell = (label, value, valueColor, width) => {
|
|
459
|
+
const text = ` ${label}: ${valueColor(value)}`;
|
|
460
|
+
const plain = ` ${label}: ${value}`;
|
|
461
|
+
return { text, plain, padded: text + safePad(width - plain.length) };
|
|
462
|
+
};
|
|
486
463
|
|
|
487
|
-
//
|
|
488
|
-
const
|
|
464
|
+
// Row 1: Account | Symbol + Qty
|
|
465
|
+
const accVal = accountName.length > 35 ? accountName.substring(0, 35) : accountName;
|
|
466
|
+
const symVal = symbolName.length > 12 ? symbolName.substring(0, 12) : symbolName;
|
|
467
|
+
const r1c1 = buildCell('Account', accVal, chalk.cyan, colL);
|
|
468
|
+
const r1c2text = ` Symbol: ${chalk.yellow(symVal)} Qty: ${chalk.cyan(numContracts)}`;
|
|
469
|
+
const r1c2plain = ` Symbol: ${symVal} Qty: ${numContracts}`;
|
|
470
|
+
const r1c2 = r1c2text + safePad(colR - r1c2plain.length);
|
|
489
471
|
|
|
490
|
-
// Row 2: Target | Risk
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
const rskLabel = 'Risk';
|
|
494
|
-
const rskVal = '$' + maxRisk.toFixed(2);
|
|
495
|
-
const pnlLabel = 'P&L';
|
|
496
|
-
const pnlVal = pnlStr;
|
|
497
|
-
const trdLabel = 'Trades';
|
|
498
|
-
const trdVal = stats.trades.toString();
|
|
499
|
-
const wlLabel = 'W/L';
|
|
500
|
-
const wlVal = `${stats.wins}/${stats.losses}`;
|
|
472
|
+
// Row 2: Target | Risk
|
|
473
|
+
const r2c1 = buildCell('Target', '$' + dailyTarget.toFixed(2), chalk.green, colL);
|
|
474
|
+
const r2c2 = buildCell('Risk', '$' + maxRisk.toFixed(2), chalk.red, colR);
|
|
501
475
|
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
const cell9plain = ` ${trdLabel}: ${trdVal}`;
|
|
510
|
-
const cell10 = ` ${wlLabel}: ${chalk.green(stats.wins.toString())}/${chalk.red(stats.losses.toString())}`;
|
|
511
|
-
const cell10plain = ` ${wlLabel}: ${wlVal}`;
|
|
476
|
+
// Row 3: P&L | Trades | Server | WS (4 items in 2 columns)
|
|
477
|
+
const r3c1text = ` P&L: ${pnlColor(pnlStr)} Trades: ${chalk.cyan(stats.trades)} W/L: ${chalk.green(stats.wins)}/${chalk.red(stats.losses)}`;
|
|
478
|
+
const r3c1plain = ` P&L: ${pnlStr} Trades: ${stats.trades} W/L: ${stats.wins}/${stats.losses}`;
|
|
479
|
+
const r3c1 = r3c1text + safePad(colL - r3c1plain.length);
|
|
480
|
+
const r3c2text = ` Server: ${serverColor(serverStatus)} WS: ${latencyColor(latencyStr)}`;
|
|
481
|
+
const r3c2plain = ` Server: ${serverStatus} WS: ${latencyStr}`;
|
|
482
|
+
const r3c2 = r3c2text + safePad(colR - r3c2plain.length);
|
|
512
483
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
cell10 + safePad(c5w - cell10plain.length);
|
|
484
|
+
// Grid separators
|
|
485
|
+
const GRID_TOP = '\u2560' + '\u2550'.repeat(colL) + '\u2564' + '\u2550'.repeat(colR) + '\u2563';
|
|
486
|
+
const GRID_MID = '\u2560' + '\u2550'.repeat(colL) + '\u256A' + '\u2550'.repeat(colR) + '\u2563';
|
|
487
|
+
const GRID_BOT = '\u2560' + '\u2550'.repeat(colL) + '\u2567' + '\u2550'.repeat(colR) + '\u2563';
|
|
518
488
|
|
|
489
|
+
// Print grid
|
|
490
|
+
console.log(chalk.cyan(GRID_TOP));
|
|
491
|
+
console.log(chalk.cyan(V) + r1c1.padded + chalk.cyan(VS) + r1c2 + chalk.cyan(V));
|
|
519
492
|
console.log(chalk.cyan(GRID_MID));
|
|
520
|
-
console.log(chalk.cyan(V) +
|
|
521
|
-
|
|
522
|
-
|
|
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';
|
|
493
|
+
console.log(chalk.cyan(V) + r2c1.padded + chalk.cyan(VS) + r2c2.padded + chalk.cyan(V));
|
|
494
|
+
console.log(chalk.cyan(GRID_MID));
|
|
495
|
+
console.log(chalk.cyan(V) + r3c1 + chalk.cyan(VS) + r3c2 + chalk.cyan(V));
|
|
524
496
|
console.log(chalk.cyan(GRID_BOT));
|
|
525
497
|
|
|
526
498
|
// Activity log header with spinner and centered date
|