hedgequantx 1.5.1 → 1.5.3

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": "1.5.1",
3
+ "version": "1.5.3",
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": {
@@ -6,6 +6,9 @@
6
6
  const chalk = require('chalk');
7
7
  const inquirer = require('inquirer');
8
8
  const { getSeparator } = require('../../ui');
9
+ const { logger } = require('../../utils');
10
+
11
+ const log = logger.scope('AlgoMenu');
9
12
 
10
13
  const { oneAccountMenu } = require('./one-account');
11
14
  const { copyTradingMenu } = require('./copy-trading');
@@ -14,6 +17,8 @@ const { copyTradingMenu } = require('./copy-trading');
14
17
  * Algo Trading Menu
15
18
  */
16
19
  const algoTradingMenu = async (service) => {
20
+ log.info('Algo Trading menu opened');
21
+
17
22
  console.log();
18
23
  console.log(chalk.gray(getSeparator()));
19
24
  console.log(chalk.magenta.bold(' Algo-Trading'));
@@ -36,13 +41,20 @@ const algoTradingMenu = async (service) => {
36
41
  }
37
42
  ]);
38
43
 
44
+ log.debug('Algo mode selected', { action });
45
+
39
46
  switch (action) {
40
47
  case 'one_account':
48
+ log.info('Starting One Account mode');
41
49
  await oneAccountMenu(service);
42
50
  break;
43
51
  case 'copy_trading':
52
+ log.info('Starting Copy Trading mode');
44
53
  await copyTradingMenu();
45
54
  break;
55
+ case 'back':
56
+ log.debug('User went back');
57
+ break;
46
58
  }
47
59
 
48
60
  return action;
@@ -32,18 +32,19 @@ const COLORS = {
32
32
  class Logger {
33
33
  constructor() {
34
34
  this.enabled = process.env.HQX_DEBUG === '1';
35
- this.fileEnabled = process.env.HQX_LOG_FILE === '1';
36
35
  this.level = LEVELS.DEBUG;
37
36
  this.logFile = path.join(os.homedir(), '.hedgequantx', 'debug.log');
38
37
 
39
- // Create log directory if file logging enabled
40
- if (this.fileEnabled) {
38
+ // Always write to file when debug is enabled
39
+ if (this.enabled) {
41
40
  const dir = path.dirname(this.logFile);
42
41
  if (!fs.existsSync(dir)) {
43
42
  fs.mkdirSync(dir, { recursive: true });
44
43
  }
45
44
  // Clear log file on start
46
45
  fs.writeFileSync(this.logFile, `=== HQX Debug Log Started ${new Date().toISOString()} ===\n`);
46
+ fs.appendFileSync(this.logFile, `Platform: ${process.platform}, Node: ${process.version}\n`);
47
+ fs.appendFileSync(this.logFile, `CWD: ${process.cwd()}\n\n`);
47
48
  }
48
49
  }
49
50
 
@@ -59,17 +60,15 @@ class Logger {
59
60
  const formatted = this._format(levelName, module, message, data);
60
61
  const color = COLORS[levelName] || COLORS.RESET;
61
62
 
63
+ // Always write to file first (survives crashes)
64
+ try {
65
+ fs.appendFileSync(this.logFile, formatted + '\n');
66
+ } catch (e) {
67
+ // Ignore file write errors
68
+ }
69
+
62
70
  // Console output (stderr to not interfere with CLI UI)
63
71
  console.error(`${color}${formatted}${COLORS.RESET}`);
64
-
65
- // File output
66
- if (this.fileEnabled) {
67
- try {
68
- fs.appendFileSync(this.logFile, formatted + '\n');
69
- } catch (e) {
70
- // Ignore file write errors
71
- }
72
- }
73
72
  }
74
73
 
75
74
  error(module, message, data) {