hedgequantx 2.6.14 → 2.6.16

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.6.14",
3
+ "version": "2.6.16",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -219,10 +219,24 @@ const handleUpdate = async () => {
219
219
  }
220
220
 
221
221
  spinner.succeed(`UPDATED TO v${latestVersion}!`);
222
- console.log(chalk.green('\n UPDATE COMPLETE!'));
223
- console.log(chalk.yellow(' PLEASE RESTART HQX TO USE NEW VERSION:'));
224
- console.log(chalk.white(' hqx\n'));
225
- await prompts.waitForEnter();
222
+ console.log(chalk.cyan('\n RESTARTING HQX...\n'));
223
+
224
+ // Clean terminal state before restart
225
+ if (process.stdin.isTTY) {
226
+ process.stdin.setRawMode(false);
227
+ }
228
+ process.stdin.pause();
229
+
230
+ // Small delay then restart with clean stdio
231
+ await new Promise(r => setTimeout(r, 500));
232
+
233
+ // Use spawnSync to restart - replaces current process
234
+ const { spawnSync } = require('child_process');
235
+ spawnSync('hqx', [], {
236
+ stdio: 'inherit',
237
+ shell: true
238
+ });
239
+
226
240
  process.exit(0);
227
241
 
228
242
  } catch (error) {
@@ -534,17 +534,6 @@ class CopyEngine {
534
534
  const copyTradingMenu = async () => {
535
535
  log.info('Copy Trading menu opened');
536
536
 
537
- // Check market hours
538
- const market = checkMarketHours();
539
- if (!market.isOpen && !market.message.includes('early')) {
540
- console.log();
541
- console.log(chalk.red(` ${market.message}`));
542
- console.log(chalk.gray(' Algo trading is only available when market is open'));
543
- console.log();
544
- await prompts.waitForEnter();
545
- return;
546
- }
547
-
548
537
  const allConns = connections.getAll();
549
538
 
550
539
  if (allConns.length === 0) {
@@ -20,11 +20,32 @@ const algoTradingMenu = async (service) => {
20
20
  // Check market hours first - block if closed
21
21
  const market = checkMarketHours();
22
22
  if (!market.isOpen) {
23
- console.log();
24
- console.log(chalk.red(` MARKET CLOSED`));
25
- console.log(chalk.gray(` ${market.message}`));
26
- console.log(chalk.gray(' ALGO TRADING UNAVAILABLE'));
27
- console.log();
23
+ console.clear();
24
+ displayBanner();
25
+
26
+ const boxWidth = getLogoWidth();
27
+ const W = boxWidth - 2;
28
+
29
+ drawBoxHeaderContinue('ALGO TRADING', boxWidth);
30
+
31
+ // Centered error message
32
+ const errorMsg = chalk.red('MARKET CLOSED');
33
+ const errorLen = 'MARKET CLOSED'.length;
34
+ const errorPad = Math.floor((W - errorLen) / 2);
35
+ console.log(chalk.cyan('║') + ' '.repeat(errorPad) + errorMsg + ' '.repeat(W - errorLen - errorPad) + chalk.cyan('║'));
36
+
37
+ const reason = market.message || 'Market is currently closed';
38
+ const reasonLen = reason.length;
39
+ const reasonPad = Math.floor((W - reasonLen) / 2);
40
+ console.log(chalk.cyan('║') + ' '.repeat(reasonPad) + chalk.gray(reason) + ' '.repeat(W - reasonLen - reasonPad) + chalk.cyan('║'));
41
+
42
+ const unavail = 'ALGO TRADING UNAVAILABLE';
43
+ const unavailLen = unavail.length;
44
+ const unavailPad = Math.floor((W - unavailLen) / 2);
45
+ console.log(chalk.cyan('║') + ' '.repeat(unavailPad) + chalk.yellow(unavail) + ' '.repeat(W - unavailLen - unavailPad) + chalk.cyan('║'));
46
+
47
+ drawBoxFooter(boxWidth);
48
+
28
49
  await prompts.waitForEnter();
29
50
  return 'back';
30
51
  }
@@ -31,17 +31,6 @@ const StrategySupervisor = require('../../services/ai/strategy-supervisor');
31
31
  * One Account Menu
32
32
  */
33
33
  const oneAccountMenu = async (service) => {
34
- // Check if market is open (skip early close check - market may still be open)
35
- const market = checkMarketHours();
36
- if (!market.isOpen && !market.message.includes('early')) {
37
- console.log();
38
- console.log(chalk.red(` ${market.message}`));
39
- console.log(chalk.gray(' ALGO TRADING IS ONLY AVAILABLE WHEN MARKET IS OPEN'));
40
- console.log();
41
- await prompts.waitForEnter();
42
- return;
43
- }
44
-
45
34
  const spinner = ora({ text: 'FETCHING ACTIVE ACCOUNTS...', color: 'yellow' }).start();
46
35
 
47
36
  const allAccounts = await connections.getAllAccounts();