hedgequantx 2.7.58 → 2.7.60

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.7.58",
3
+ "version": "2.7.60",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -8,7 +8,7 @@ const ora = require('ora');
8
8
  const { connections } = require('../services');
9
9
  const { RithmicService } = require('../services/rithmic');
10
10
  const { PROPFIRM_CHOICES } = require('../config');
11
- const { getLogoWidth, centerText, prepareStdin } = require('../ui');
11
+ const { getLogoWidth, centerText, prepareStdin, displayBanner } = require('../ui');
12
12
  const { validateUsername, validatePassword } = require('../security');
13
13
  const { prompts } = require('../utils');
14
14
 
@@ -38,6 +38,10 @@ const loginPrompt = async (propfirmName) => {
38
38
  * Rithmic menu - Main connection menu
39
39
  */
40
40
  const rithmicMenu = async () => {
41
+ // Clear screen and show banner
42
+ console.clear();
43
+ displayBanner();
44
+
41
45
  const propfirms = PROPFIRM_CHOICES;
42
46
  const boxWidth = getLogoWidth();
43
47
  const innerWidth = boxWidth - 2;
@@ -46,7 +50,6 @@ const rithmicMenu = async () => {
46
50
 
47
51
  const numbered = propfirms.map((pf, i) => ({ num: i + 1, key: pf.value, name: pf.name }));
48
52
 
49
- console.log();
50
53
  console.log(chalk.cyan('╔' + '═'.repeat(innerWidth) + '╗'));
51
54
  console.log(chalk.cyan('║') + chalk.white.bold(centerText('SELECT PROPFIRM', innerWidth)) + chalk.cyan('║'));
52
55
  console.log(chalk.cyan('║') + ' '.repeat(innerWidth) + chalk.cyan('║'));
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  const chalk = require('chalk');
6
- const { getSeparator } = require('../../ui');
6
+ const { getLogoWidth, centerText, displayBanner } = require('../../ui');
7
7
  const { logger, prompts } = require('../../utils');
8
8
 
9
9
  const log = logger.scope('AlgoMenu');
@@ -18,39 +18,59 @@ const algoTradingMenu = async (service) => {
18
18
  log.info('Algo Trading menu opened');
19
19
 
20
20
  try {
21
- console.log();
22
- console.log(chalk.gray(getSeparator()));
23
- console.log(chalk.yellow.bold(' Algo-Trading'));
24
- console.log(chalk.gray(getSeparator()));
25
- console.log();
21
+ // Clear screen and show banner
22
+ console.clear();
23
+ displayBanner();
24
+
25
+ const boxWidth = getLogoWidth();
26
+ const W = boxWidth - 2;
27
+
28
+ // Draw menu rectangle
29
+ console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
30
+ console.log(chalk.cyan('║') + chalk.magenta.bold(centerText('ALGO-TRADING', W)) + chalk.cyan('║'));
31
+ console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
32
+
33
+ // Options centered in 2 columns
34
+ const col1 = '[1] ONE ACCOUNT';
35
+ const col2 = '[2] COPY TRADING';
36
+ const colWidth = Math.floor(W / 2);
37
+ const pad1 = Math.floor((colWidth - col1.length) / 2);
38
+ const pad2 = Math.floor((colWidth - col2.length) / 2);
39
+ const line = ' '.repeat(pad1) + chalk.cyan(col1) + ' '.repeat(colWidth - col1.length - pad1) +
40
+ ' '.repeat(pad2) + chalk.cyan(col2) + ' '.repeat(colWidth - col2.length - pad2);
41
+ console.log(chalk.cyan('║') + line + chalk.cyan('║'));
42
+
43
+ console.log(chalk.cyan('╠' + '─'.repeat(W) + '╣'));
44
+ console.log(chalk.cyan('║') + chalk.red(centerText('[B] BACK', W)) + chalk.cyan('║'));
45
+ console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
26
46
 
27
- const action = await prompts.selectOption(chalk.yellow('Select Mode:'), [
28
- { value: 'one_account', label: 'One Account' },
29
- { value: 'copy_trading', label: 'Copy Trading' },
30
- { value: 'back', label: '< Back' }
31
- ]);
47
+ const input = await prompts.textInput(chalk.cyan('SELECT (1/2/B): '));
48
+ const choice = (input || '').toLowerCase().trim();
32
49
 
33
- log.debug('Algo mode selected', { action });
50
+ log.debug('Algo mode selected', { choice });
34
51
 
35
- if (!action || action === 'back') {
52
+ if (choice === 'b' || choice === '') {
36
53
  return 'back';
37
54
  }
38
55
 
39
- switch (action) {
40
- case 'one_account':
56
+ switch (choice) {
57
+ case '1':
41
58
  log.info('Starting One Account mode');
42
59
  await oneAccountMenu(service);
43
60
  break;
44
- case 'copy_trading':
61
+ case '2':
45
62
  log.info('Starting Copy Trading mode');
46
63
  await copyTradingMenu();
47
64
  break;
65
+ default:
66
+ console.log(chalk.red(' INVALID OPTION'));
67
+ await new Promise(r => setTimeout(r, 1000));
48
68
  }
49
69
 
50
- return action;
70
+ return choice;
51
71
  } catch (err) {
52
72
  log.error('Algo menu error:', err.message);
53
- console.log(chalk.red(` Error: ${err.message}`));
73
+ console.log(chalk.red(` ERROR: ${err.message.toUpperCase()}`));
54
74
  await prompts.waitForEnter();
55
75
  return 'back';
56
76
  }
package/src/pages/user.js CHANGED
@@ -6,13 +6,17 @@ const chalk = require('chalk');
6
6
  const ora = require('ora');
7
7
 
8
8
  const { connections } = require('../services');
9
- const { getLogoWidth, getColWidths, drawBoxHeader, drawBoxFooter, draw2ColHeader, visibleLength, padText } = require('../ui');
9
+ const { getLogoWidth, getColWidths, drawBoxHeader, drawBoxFooter, draw2ColHeader, visibleLength, padText, displayBanner } = require('../ui');
10
10
  const { prompts } = require('../utils');
11
11
 
12
12
  /**
13
13
  * Show user info
14
14
  */
15
15
  const showUserInfo = async (service) => {
16
+ // Clear screen and show banner
17
+ console.clear();
18
+ displayBanner();
19
+
16
20
  const boxWidth = getLogoWidth();
17
21
  const { col1, col2 } = getColWidths(boxWidth);
18
22
  let spinner;