hedgequantx 2.9.146 → 2.9.147

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.9.146",
3
+ "version": "2.9.147",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -389,8 +389,8 @@ const selectMultipleSymbols = async (service, account) => {
389
389
  const selectSymbol = async (service, account) => {
390
390
  const spinner = ora({ text: 'Loading symbols...', color: 'yellow' }).start();
391
391
 
392
- // Ensure we have a logged-in service
393
- if (!service.loginInfo && service.credentials) {
392
+ // Ensure we have a logged-in service (for direct RithmicService, not BrokerClient)
393
+ if (!service.loginInfo && service.credentials && typeof service.login === 'function') {
394
394
  spinner.text = 'Reconnecting to broker...';
395
395
  const loginResult = await service.login(service.credentials.username, service.credentials.password);
396
396
  if (!loginResult.success) {
@@ -400,8 +400,11 @@ const selectSymbol = async (service, account) => {
400
400
  }
401
401
 
402
402
  const contractsResult = await service.getContracts();
403
+
403
404
  if (!contractsResult.success || !contractsResult.contracts?.length) {
404
- spinner.fail(`Failed to load contracts: ${contractsResult.error || 'No contracts'}`);
405
+ const errorMsg = contractsResult.error || 'No contracts available';
406
+ spinner.fail(`Failed to load contracts: ${errorMsg}`);
407
+ console.log(chalk.gray(' Tip: Try reconnecting with "hqx login"'));
405
408
  return null;
406
409
  }
407
410
 
@@ -211,7 +211,7 @@ class RithmicBrokerClient extends EventEmitter {
211
211
  */
212
212
  async getContracts() {
213
213
  const result = await this._request('getContracts', { propfirmKey: this.propfirmKey });
214
- if (result.error) return { success: false, contracts: [] };
214
+ if (result.error) return { success: false, contracts: [], error: result.error };
215
215
  return result.payload || { success: true, contracts: [] };
216
216
  }
217
217
 
@@ -299,8 +299,15 @@ class RithmicBrokerDaemon {
299
299
 
300
300
  async _handleGetContracts(payload, requestId) {
301
301
  const conn = this.connections.get(payload.propfirmKey);
302
- if (!conn?.service) return { error: 'Not connected', requestId };
303
- return { type: 'contracts', payload: await conn.service.getContracts(), requestId };
302
+ if (!conn?.service) return { error: 'Not connected to broker', requestId };
303
+
304
+ try {
305
+ const result = await conn.service.getContracts();
306
+ return { type: 'contracts', payload: result, requestId };
307
+ } catch (err) {
308
+ log('ERROR', 'getContracts failed', { propfirm: payload.propfirmKey, error: err.message });
309
+ return { type: 'contracts', payload: { success: false, error: err.message, contracts: [] }, requestId };
310
+ }
304
311
  }
305
312
 
306
313
  async _handleSearchContracts(payload, requestId) {