hedgequantx 2.9.201 → 2.9.203

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.201",
3
+ "version": "2.9.203",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -9,12 +9,14 @@
9
9
  const chalk = require('chalk');
10
10
  const HQX2B = require('./smart-logs-hqx2b');
11
11
  const QUANT = require('./smart-logs-quant');
12
+ const smartLogs = require('./smart-logs');
12
13
 
13
14
  const CONFIG = {
14
15
  SESSION_LOG_INTERVAL: 10,
15
16
  PRICE_CHANGE_TICKS: 4, // Log when price moves 4+ ticks
16
17
  DELTA_CHANGE_THRESHOLD: 200, // Log when delta changes 200+
17
18
  ZONE_APPROACH_TICKS: 5, // Log when within 5 ticks of zone
19
+ LOG_INTERVAL_SECONDS: 5, // Log every N seconds with quant data
18
20
  };
19
21
 
20
22
  const SYMBOLS = {
@@ -146,9 +148,11 @@ class SmartLogsEngine {
146
148
 
147
149
  getLog(state = {}) {
148
150
  this.counter++;
149
- const { position = 0, delta = 0 } = state;
151
+ const { position = 0, delta = 0, zScore = 0, vpin = 0, ofi = 0 } = state;
150
152
  const sym = getSym(this.symbolCode);
151
153
  const price = state.price > 0 ? state.price.toFixed(2) : '-.--';
154
+ const T = this.strategyId === 'hqx-2b' ? HQX2B : QUANT;
155
+ const now = Date.now();
152
156
 
153
157
  // Active position - always log
154
158
  if (position !== 0) {
@@ -165,6 +169,40 @@ class SmartLogsEngine {
165
169
  const events = this._detectEvents(state, this.lastState);
166
170
  this.lastState = { ...state };
167
171
 
172
+ // For QUANT strategy: use rich smart-logs messages
173
+ if (this.strategyId === 'ultra-scalping' && state.bars >= 5) {
174
+ const timeSinceLastLog = now - this.lastLogTime;
175
+
176
+ // Log every 5 seconds with quant metrics
177
+ if (timeSinceLastLog >= CONFIG.LOG_INTERVAL_SECONDS * 1000) {
178
+ this.lastLogTime = now;
179
+
180
+ // Use getLiveAnalysisLog for rich contextual messages
181
+ const trend = zScore > 0.5 ? 'bullish' : zScore < -0.5 ? 'bearish' : 'neutral';
182
+ const liveMessage = smartLogs.getLiveAnalysisLog({
183
+ trend,
184
+ bars: state.bars || 0,
185
+ swings: state.swings || 0,
186
+ zones: state.zones || 0,
187
+ nearZone: state.nearZone || false,
188
+ setupForming: Math.abs(zScore) >= 1.5,
189
+ });
190
+
191
+ // Add quant metrics suffix
192
+ const zStr = zScore.toFixed(2);
193
+ const vpinPct = (vpin * 100).toFixed(0);
194
+ const ofiPct = (ofi * 100).toFixed(0);
195
+ const metrics = chalk.gray(` | Z:${zStr} VPIN:${vpinPct}% OFI:${ofiPct}%`);
196
+
197
+ return {
198
+ type: 'analysis',
199
+ message: `[${sym}] ${liveMessage}${metrics}`,
200
+ logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
201
+ };
202
+ }
203
+ return null;
204
+ }
205
+
168
206
  // No events = no log (SILENCE)
169
207
  if (events.length === 0) {
170
208
  return null;