hedgequantx 1.8.28 → 1.8.30

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.28",
3
+ "version": "1.8.30",
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
  };
@@ -57,7 +57,8 @@ const oneAccountMenu = async (service) => {
57
57
  const selectedAccount = await prompts.selectOption('Select Account:', options);
58
58
  if (!selectedAccount || selectedAccount === 'back') return;
59
59
 
60
- const accountService = connections.getServiceForAccount(selectedAccount.accountId) || service;
60
+ // Use the service attached to the account (from getAllAccounts), fallback to getServiceForAccount
61
+ const accountService = selectedAccount.service || connections.getServiceForAccount(selectedAccount.accountId) || service;
61
62
 
62
63
  // Select symbol
63
64
  const contract = await selectSymbol(accountService, selectedAccount);
@@ -150,6 +151,7 @@ const launchAlgo = async (service, account, contract, config) => {
150
151
  const stats = {
151
152
  accountName, symbol: symbolName, contracts,
152
153
  target: dailyTarget, risk: maxRisk,
154
+ propfirm: account.propfirm || 'Unknown',
153
155
  pnl: 0, trades: 0, wins: 0, losses: 0,
154
156
  latency: 0, connected: false
155
157
  };
@@ -208,8 +210,11 @@ const launchAlgo = async (service, account, contract, config) => {
208
210
  if (stats.connected) {
209
211
  ui.addLog('info', 'Starting algo...');
210
212
 
213
+ // Get Rithmic credentials from the account's service
211
214
  let rithmicCreds = null;
212
- if (service.getRithmicCredentials) rithmicCreds = service.getRithmicCredentials();
215
+ if (service && service.getRithmicCredentials) {
216
+ rithmicCreds = service.getRithmicCredentials();
217
+ }
213
218
 
214
219
  hqx.startAlgo({
215
220
  accountId: account.accountId,