hedgequantx 2.6.133 → 2.6.134

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.133",
3
+ "version": "2.6.134",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -1683,10 +1683,15 @@ const launchMultiSymbolRithmic = async (service, account, contracts, config) =>
1683
1683
  algoLogger.algoOperational(ui, 'RITHMIC');
1684
1684
  });
1685
1685
 
1686
+ // Smart logs state tracking
1687
+ let lastHeartbeat = Date.now();
1688
+ let tps = 0;
1689
+
1686
1690
  marketFeed.on('tick', (tick) => {
1687
1691
  if (!running) return;
1688
1692
 
1689
1693
  tickCount++;
1694
+ tps++;
1690
1695
  stats.latency = tick.latency || 0;
1691
1696
 
1692
1697
  // Route tick to correct strategy based on symbol
@@ -1743,6 +1748,48 @@ const launchMultiSymbolRithmic = async (service, account, contracts, config) =>
1743
1748
  }
1744
1749
  }
1745
1750
 
1751
+ // ═══════════════════════════════════════════════════════════════════════════
1752
+ // SMART LOGS - Same as single-symbol mode
1753
+ // ═══════════════════════════════════════════════════════════════════════════
1754
+ const now = Date.now();
1755
+ if (now - lastHeartbeat > 1000) {
1756
+ // Get model values from first active symbol's strategy
1757
+ const firstSymbol = Object.keys(strategies)[0];
1758
+ const firstStrategy = strategies[firstSymbol];
1759
+ const modelValues = firstStrategy?.getModelValues?.() || firstStrategy?.getModelValues?.(firstSymbol) || null;
1760
+
1761
+ if (modelValues && modelValues.ofi !== undefined) {
1762
+ const ofi = modelValues.ofi || 0;
1763
+ const delta = modelValues.delta || 0;
1764
+ const zscore = modelValues.zscore || 0;
1765
+ const mom = modelValues.momentum || 0;
1766
+
1767
+ // Check if any symbol has an open position
1768
+ const totalPosition = Object.values(stats.symbolStats).reduce((sum, s) => sum + Math.abs(s.position || 0), 0);
1769
+
1770
+ if (totalPosition === 0) {
1771
+ // Not in position - show market analysis (varied messages)
1772
+ const smartLogs = require('./smart-logs');
1773
+ const stateLog = smartLogs.getMarketStateLog(ofi, zscore, mom, delta);
1774
+ if (stateLog.details) {
1775
+ ui.addLog('analysis', `${stateLog.message} - ${stateLog.details}`);
1776
+ } else {
1777
+ ui.addLog('info', stateLog.message);
1778
+ }
1779
+ }
1780
+ // When IN POSITION: Don't spam logs every second
1781
+ } else {
1782
+ // Waiting for data - log every 5 seconds only
1783
+ if (now - lastHeartbeat > 5000) {
1784
+ const smartLogs = require('./smart-logs');
1785
+ const scanLog = smartLogs.getScanningLog(true);
1786
+ ui.addLog('info', `${scanLog.message} ${tps} ticks/s`);
1787
+ }
1788
+ }
1789
+ lastHeartbeat = now;
1790
+ tps = 0;
1791
+ }
1792
+
1746
1793
  ui.render(stats);
1747
1794
  });
1748
1795