hedgequantx 2.6.39 → 2.6.40

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.39",
3
+ "version": "2.6.40",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -331,16 +331,37 @@ class RithmicMarketDataFeed extends EventEmitter {
331
331
 
332
332
  /**
333
333
  * Connect to market data (uses existing tickerConn from RithmicService)
334
+ * Will attempt to reconnect if tickerConn is not connected
334
335
  * @returns {Promise<boolean>}
335
336
  */
336
337
  async connect() {
337
- if (!this.service || !this.service.tickerConn) {
338
- throw new Error('RithmicService or tickerConn not available');
338
+ if (!this.service) {
339
+ throw new Error('RithmicService not available');
339
340
  }
340
341
 
341
- // Check if ticker connection is ready
342
- if (!this.service.tickerConn.isConnected) {
343
- throw new Error('Ticker connection not established');
342
+ // Check if ticker connection is ready, reconnect if needed
343
+ if (!this.service.tickerConn?.isConnected) {
344
+ log.info('Ticker connection not ready, attempting to reconnect...');
345
+
346
+ // Try to reconnect using stored credentials
347
+ if (this.service.credentials) {
348
+ try {
349
+ const connected = await this.service.connectTicker(
350
+ this.service.credentials.username,
351
+ this.service.credentials.password
352
+ );
353
+
354
+ if (!connected || !this.service.tickerConn?.isConnected) {
355
+ throw new Error('Failed to reconnect to TICKER_PLANT');
356
+ }
357
+
358
+ log.info('Ticker connection re-established');
359
+ } catch (err) {
360
+ throw new Error(`Ticker reconnection failed: ${err.message}`);
361
+ }
362
+ } else {
363
+ throw new Error('Ticker connection not established and no credentials available');
364
+ }
344
365
  }
345
366
 
346
367
  // Setup message handler