hedgequantx 1.2.97 → 1.2.99
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/app.js +27 -18
- package/src/pages/algo.js +8 -7
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -579,48 +579,57 @@ const mainMenu = async () => {
|
|
|
579
579
|
*/
|
|
580
580
|
const dashboardMenu = async (service) => {
|
|
581
581
|
const user = service.user;
|
|
582
|
-
const
|
|
583
|
-
|
|
582
|
+
const W = 60; // Fixed width for dashboard box
|
|
583
|
+
|
|
584
|
+
// Helper to center text
|
|
585
|
+
const centerLine = (text, width) => {
|
|
586
|
+
const pad = Math.floor((width - text.length) / 2);
|
|
587
|
+
return ' '.repeat(Math.max(0, pad)) + text + ' '.repeat(Math.max(0, width - pad - text.length));
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// Helper to pad text left
|
|
591
|
+
const padLine = (text, width) => {
|
|
592
|
+
return ' ' + text + ' '.repeat(Math.max(0, width - text.length - 1));
|
|
593
|
+
};
|
|
584
594
|
|
|
585
595
|
// Dashboard box header
|
|
586
596
|
console.log();
|
|
587
|
-
console.log(chalk.cyan('╔' + '═'.repeat(
|
|
588
|
-
console.log(chalk.cyan('║') + chalk.white.bold(
|
|
589
|
-
console.log(chalk.cyan('╠' + '═'.repeat(
|
|
597
|
+
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
598
|
+
console.log(chalk.cyan('║') + chalk.white.bold(centerLine('DASHBOARD', W)) + chalk.cyan('║'));
|
|
599
|
+
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
590
600
|
|
|
591
601
|
// Connection info - show all active connections
|
|
592
602
|
const allConns = connections.getAll();
|
|
593
603
|
if (allConns.length > 0) {
|
|
594
604
|
const connNames = allConns.map(c => c.propfirm || c.type).join(', ');
|
|
595
605
|
const connText = `Connected to ${connNames}`;
|
|
596
|
-
|
|
597
|
-
console.log(chalk.cyan('║') + ' ' + connInfo + ' '.repeat(Math.max(0, innerWidth - connText.length - 2)) + chalk.cyan('║'));
|
|
606
|
+
console.log(chalk.cyan('║') + chalk.green(padLine(connText, W)) + chalk.cyan('║'));
|
|
598
607
|
}
|
|
599
608
|
|
|
600
609
|
if (user) {
|
|
601
|
-
const
|
|
602
|
-
console.log(chalk.cyan('║') +
|
|
610
|
+
const userText = 'Welcome, ' + user.userName.toUpperCase() + '!';
|
|
611
|
+
console.log(chalk.cyan('║') + chalk.white(padLine(userText, W)) + chalk.cyan('║'));
|
|
603
612
|
}
|
|
604
613
|
|
|
605
|
-
console.log(chalk.cyan('╠' + '═'.repeat(
|
|
614
|
+
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
606
615
|
|
|
607
616
|
// Menu options in 2 columns
|
|
608
|
-
const col1Width = Math.floor(
|
|
609
|
-
const col2Width =
|
|
617
|
+
const col1Width = Math.floor(W / 2);
|
|
618
|
+
const col2Width = W - col1Width;
|
|
610
619
|
|
|
611
620
|
const menuRow = (left, right) => {
|
|
612
|
-
const
|
|
613
|
-
const
|
|
614
|
-
const leftPad = col1Width -
|
|
615
|
-
const rightPad = col2Width -
|
|
616
|
-
console.log(chalk.cyan('║') +
|
|
621
|
+
const leftPlain = left.replace(/\x1b\[[0-9;]*m/g, '');
|
|
622
|
+
const rightPlain = right ? right.replace(/\x1b\[[0-9;]*m/g, '') : '';
|
|
623
|
+
const leftPad = ' '.repeat(Math.max(0, col1Width - leftPlain.length - 2));
|
|
624
|
+
const rightPad = ' '.repeat(Math.max(0, col2Width - rightPlain.length - 2));
|
|
625
|
+
console.log(chalk.cyan('║') + ' ' + left + leftPad + ' ' + (right || '') + rightPad + chalk.cyan('║'));
|
|
617
626
|
};
|
|
618
627
|
|
|
619
628
|
menuRow(chalk.cyan('[1] View Accounts'), chalk.cyan('[2] View Stats'));
|
|
620
629
|
menuRow(chalk.cyan('[+] Add Prop-Account'), chalk.cyan('[A] Algo-Trading'));
|
|
621
630
|
menuRow(chalk.yellow('[U] Update HQX'), chalk.red('[X] Disconnect'));
|
|
622
631
|
|
|
623
|
-
console.log(chalk.cyan('╚' + '═'.repeat(
|
|
632
|
+
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
624
633
|
console.log();
|
|
625
634
|
|
|
626
635
|
const { action } = await inquirer.prompt([
|
package/src/pages/algo.js
CHANGED
|
@@ -454,16 +454,17 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
454
454
|
};
|
|
455
455
|
|
|
456
456
|
const getIcon = (type) => {
|
|
457
|
+
// Fixed width tags (10 chars) for alignment
|
|
457
458
|
switch(type) {
|
|
458
|
-
case 'signal':
|
|
459
|
-
case 'trade':
|
|
460
|
-
case 'order':
|
|
459
|
+
case 'signal': return '[SIGNAL] ';
|
|
460
|
+
case 'trade': return '[TRADE] ';
|
|
461
|
+
case 'order': return '[ORDER] ';
|
|
461
462
|
case 'position': return '[POSITION]';
|
|
462
|
-
case 'error':
|
|
463
|
-
case 'warning':
|
|
464
|
-
case 'success':
|
|
463
|
+
case 'error': return '[ERROR] ';
|
|
464
|
+
case 'warning': return '[WARNING] ';
|
|
465
|
+
case 'success': return '[OK] ';
|
|
465
466
|
case 'analysis': return '[ANALYSIS]';
|
|
466
|
-
default:
|
|
467
|
+
default: return '[INFO] ';
|
|
467
468
|
}
|
|
468
469
|
};
|
|
469
470
|
|