hedgequantx 1.8.27 → 1.8.29

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.8.27",
3
+ "version": "1.8.29",
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": {
@@ -100,8 +100,18 @@ const copyTradingMenu = async () => {
100
100
  // Step 3: Select Trading Symbol
101
101
  console.log();
102
102
  console.log(chalk.cyan(' Step 3: Select Trading Symbol'));
103
- const symbol = await selectSymbol(lead.service, 'Trading');
104
- if (!symbol) return;
103
+ let symbol;
104
+ try {
105
+ symbol = await selectSymbol(lead.service, 'Trading');
106
+ } catch (err) {
107
+ console.log(chalk.red(` Error selecting symbol: ${err.message}`));
108
+ await prompts.waitForEnter();
109
+ return;
110
+ }
111
+ if (!symbol) {
112
+ log.debug('No symbol selected');
113
+ return;
114
+ }
105
115
 
106
116
  // Step 4: Configure parameters
107
117
  console.log();
@@ -173,9 +183,9 @@ const getContractsFromAPI = async () => {
173
183
  * Symbol selection helper - uses API contracts for all services
174
184
  */
175
185
  const selectSymbol = async (service, label) => {
186
+ const spinner = ora({ text: 'Loading symbols...', color: 'yellow' }).start();
187
+
176
188
  try {
177
- const spinner = ora({ text: 'Loading symbols...', color: 'yellow' }).start();
178
-
179
189
  // Always use contracts from ProjectX API for consistency
180
190
  let contracts = await getContractsFromAPI();
181
191
 
@@ -189,6 +199,7 @@ const selectSymbol = async (service, label) => {
189
199
 
190
200
  if (!contracts || contracts.length === 0) {
191
201
  spinner.fail('No contracts available');
202
+ await prompts.waitForEnter();
192
203
  return null;
193
204
  }
194
205
 
@@ -212,7 +223,8 @@ const selectSymbol = async (service, label) => {
212
223
 
213
224
  return await prompts.selectOption(`${label} Symbol:`, options);
214
225
  } catch (e) {
215
- console.log(chalk.red(' Error loading contracts'));
226
+ spinner.fail(`Error loading contracts: ${e.message}`);
227
+ await prompts.waitForEnter();
216
228
  return null;
217
229
  }
218
230
  };
@@ -17,37 +17,43 @@ const { copyTradingMenu } = require('./copy-trading');
17
17
  const algoTradingMenu = async (service) => {
18
18
  log.info('Algo Trading menu opened');
19
19
 
20
- console.log();
21
- console.log(chalk.gray(getSeparator()));
22
- console.log(chalk.yellow.bold(' Algo-Trading'));
23
- console.log(chalk.gray(getSeparator()));
24
- console.log();
25
-
26
- const action = await prompts.selectOption(chalk.yellow('Select Mode:'), [
27
- { value: 'one_account', label: 'One Account' },
28
- { value: 'copy_trading', label: 'Copy Trading' },
29
- { value: 'back', label: '< Back' }
30
- ]);
31
-
32
- if (!action || action === 'back') {
33
- log.debug('User went back');
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();
26
+
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
+ ]);
32
+
33
+ log.debug('Algo mode selected', { action });
34
+
35
+ if (!action || action === 'back') {
36
+ return 'back';
37
+ }
38
+
39
+ switch (action) {
40
+ case 'one_account':
41
+ log.info('Starting One Account mode');
42
+ await oneAccountMenu(service);
43
+ break;
44
+ case 'copy_trading':
45
+ log.info('Starting Copy Trading mode');
46
+ await copyTradingMenu();
47
+ break;
48
+ }
49
+
50
+ return action;
51
+ } catch (err) {
52
+ log.error('Algo menu error:', err.message);
53
+ console.log(chalk.red(` Error: ${err.message}`));
54
+ await prompts.waitForEnter();
34
55
  return 'back';
35
56
  }
36
-
37
- log.debug('Algo mode selected', { action });
38
-
39
- switch (action) {
40
- case 'one_account':
41
- log.info('Starting One Account mode');
42
- await oneAccountMenu(service);
43
- break;
44
- case 'copy_trading':
45
- log.info('Starting Copy Trading mode');
46
- await copyTradingMenu();
47
- break;
48
- }
49
-
50
- return action;
51
57
  };
52
58
 
53
59
  module.exports = { algoTradingMenu };