hedgequantx 2.6.39 → 2.6.41

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.41",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -579,9 +579,11 @@ const launchAlgo = async (service, account, contract, config) => {
579
579
  tps++;
580
580
  const latencyStart = Date.now();
581
581
 
582
- // Debug: log first tick to see structure
582
+ // Debug: log first tick and confirm data flow after 5s
583
583
  if (tickCount === 1) {
584
584
  algoLogger.info(ui, 'FIRST TICK', `price=${tick.price} bid=${tick.bid} ask=${tick.ask} vol=${tick.volume || tick.size || 0}`);
585
+ } else if (tickCount === 100) {
586
+ algoLogger.info(ui, 'DATA FLOWING', `100 ticks received - market data OK`);
585
587
  }
586
588
 
587
589
  // Feed tick to strategy
@@ -625,8 +627,8 @@ const launchAlgo = async (service, account, contract, config) => {
625
627
 
626
628
  stats.latency = Date.now() - latencyStart;
627
629
 
628
- // Heartbeat every 30 seconds - show strategy model values
629
- if (Date.now() - lastHeartbeat > 30000) {
630
+ // Heartbeat every 15 seconds - show strategy model values
631
+ if (Date.now() - lastHeartbeat > 15000) {
630
632
  // Try to get model values from strategy
631
633
  const modelValues = strategy.getModelValues?.() || strategy.getModelValues?.(contractId) || null;
632
634
 
@@ -638,10 +640,10 @@ const launchAlgo = async (service, account, contract, config) => {
638
640
  const mom = (modelValues.momentum || 0).toFixed(1);
639
641
  const signals = modelValues.signalCount || 0;
640
642
  const deltaStr = delta >= 0 ? `+${delta}` : `${delta}`;
641
- algoLogger.info(ui, strategyName, `OFI=${ofi} Z=${zscore} Mom=${mom} Δ=${deltaStr} | ${signals} signals | ${tps} t/30s`);
643
+ algoLogger.info(ui, strategyName, `OFI=${ofi} Z=${zscore} Mom=${mom} Δ=${deltaStr} | ${tps} t/15s | ${tickCount} total`);
642
644
  } else {
643
645
  // Fallback
644
- algoLogger.info(ui, 'SCANNING', `${tps} ticks/30s | ${tickCount} total | price=${tickData.price}`);
646
+ algoLogger.info(ui, 'SCANNING', `${tps} ticks/15s | ${tickCount} total | price=${tickData.price}`);
645
647
  }
646
648
  lastHeartbeat = Date.now();
647
649
  tps = 0;
@@ -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