hedgequantx 2.9.204 → 2.9.206

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.204",
3
+ "version": "2.9.206",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -169,72 +169,77 @@ class SmartLogsEngine {
169
169
  const events = this._detectEvents(state, this.lastState);
170
170
  this.lastState = { ...state };
171
171
 
172
- // For QUANT strategy: use rich QUANT-specific smart-logs
173
- if (this.strategyId === 'ultra-scalping' && state.bars >= 5) {
172
+ // For QUANT strategy: ALWAYS use rich QUANT-specific smart-logs with metrics
173
+ // HQX Scalping is TICK-BASED, not bar-based - use tickCount for display
174
+ if (this.strategyId === 'ultra-scalping') {
174
175
  const timeSinceLastLog = now - this.lastLogTime;
176
+ const ticks = state.tickCount || state.bars || 0; // Prefer tickCount for scalping
175
177
 
176
178
  // Log every 5 seconds with quant metrics
177
179
  if (timeSinceLastLog >= CONFIG.LOG_INTERVAL_SECONDS * 1000) {
178
180
  this.lastLogTime = now;
179
181
 
182
+ // Still warming up (need ~250 ticks for QUANT models to stabilize)
183
+ if (ticks < 250) {
184
+ const d = { sym, ticks, price };
185
+ return {
186
+ type: 'system',
187
+ message: QUANT.building(d),
188
+ logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
189
+ };
190
+ }
191
+
192
+ // Ready - use rich QUANT context messages
180
193
  // Determine market context from QUANT metrics
181
194
  // zScore: mean reversion indicator (-3 to +3)
182
195
  // vpin: toxicity 0-1 (higher = more informed trading)
183
196
  // ofi: order flow imbalance -1 to +1 (positive = buying pressure)
184
197
  const absZ = Math.abs(zScore);
185
198
  const ofiAbs = Math.abs(ofi);
199
+ const zScoreAbs = absZ.toFixed(1);
200
+ const vpinPct = (vpin * 100).toFixed(0);
201
+ const ofiPct = (ofi > 0 ? '+' : '') + (ofi * 100).toFixed(0) + '%';
202
+
203
+ // Build data object for QUANT message pools
204
+ const d = {
205
+ sym, price,
206
+ zScore: zScore.toFixed(1),
207
+ zScoreAbs,
208
+ rawZScore: zScore,
209
+ vpin: vpinPct,
210
+ ofi: ofiPct,
211
+ ticks
212
+ };
186
213
 
187
- let contextMessage;
188
214
  let logType = 'analysis';
215
+ let message;
189
216
 
190
217
  if (absZ >= 2.0) {
191
- // Strong mean reversion signal zone
192
- const dir = zScore < 0 ? 'LONG' : 'SHORT';
193
- const ofiConfirms = (zScore < 0 && ofi > 0.1) || (zScore > 0 && ofi < -0.1);
194
- contextMessage = ofiConfirms
195
- ? `Z-Score extreme (${zScore.toFixed(1)}σ) + OFI confirms ${dir} setup forming`
196
- : `Z-Score extreme (${zScore.toFixed(1)}σ) - awaiting OFI confirmation`;
218
+ // Strong signal zone - use bull/bear messages
197
219
  logType = 'signal';
220
+ message = zScore < 0 ? QUANT.bull(d) : QUANT.bear(d);
198
221
  } else if (absZ >= 1.5) {
199
- // Approaching signal threshold
200
- contextMessage = zScore > 0
201
- ? `Price extended above mean (+${zScore.toFixed(1)}σ) - watching for SHORT setup`
202
- : `Price below mean (${zScore.toFixed(1)}σ) - watching for LONG setup`;
222
+ // Approaching threshold - use ready messages
203
223
  logType = 'signal';
204
- } else if (absZ >= 1.0) {
205
- // Building deviation
206
- const vpinStatus = vpin > 0.6 ? 'high toxicity' : vpin > 0.4 ? 'moderate flow' : 'clean flow';
207
- contextMessage = `Z-Score building (${zScore.toFixed(1)}σ) | VPIN: ${vpinStatus} | OFI: ${ofi > 0 ? '+' : ''}${(ofi * 100).toFixed(0)}%`;
208
- } else if (ofiAbs >= 0.3) {
209
- // Strong orderflow imbalance
210
- contextMessage = ofi > 0
211
- ? `Strong buying pressure (OFI: +${(ofi * 100).toFixed(0)}%) - bulls in control`
212
- : `Strong selling pressure (OFI: ${(ofi * 100).toFixed(0)}%) - bears in control`;
213
- } else if (vpin > 0.6) {
214
- // High toxicity warning
215
- contextMessage = `VPIN elevated (${(vpin * 100).toFixed(0)}%) - informed trading detected, caution`;
224
+ message = QUANT.ready(d);
225
+ } else if (absZ >= 1.0 || ofiAbs >= 0.2) {
226
+ // Building edge - use zones messages
227
+ message = QUANT.zones(d);
216
228
  } else {
217
- // Normal market - use trend from OFI
218
- const trend = ofi > 0.1 ? 'bullish' : ofi < -0.1 ? 'bearish' : 'neutral';
219
- contextMessage = smartLogs.getLiveAnalysisLog({
220
- trend,
221
- bars: state.bars || 0,
222
- swings: 0,
223
- zones: absZ >= 1.0 ? 1 : 0,
224
- nearZone: absZ >= 1.5,
225
- setupForming: absZ >= 2.0,
226
- });
229
+ // Normal market - use neutral messages
230
+ message = QUANT.neutral(d);
227
231
  }
228
232
 
229
233
  return {
230
234
  type: logType,
231
- message: `[${sym}] ${contextMessage}`,
235
+ message,
232
236
  logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
233
237
  };
234
238
  }
235
239
  return null;
236
240
  }
237
241
 
242
+ // HQX-2B strategy: event-based logging
238
243
  // No events = no log (SILENCE)
239
244
  if (events.length === 0) {
240
245
  return null;