hedgequantx 2.9.204 → 2.9.205

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.205",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -169,72 +169,75 @@ 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
+ if (this.strategyId === 'ultra-scalping') {
174
174
  const timeSinceLastLog = now - this.lastLogTime;
175
175
 
176
176
  // Log every 5 seconds with quant metrics
177
177
  if (timeSinceLastLog >= CONFIG.LOG_INTERVAL_SECONDS * 1000) {
178
178
  this.lastLogTime = now;
179
179
 
180
+ // Still warming up - use building messages from QUANT pool
181
+ if (state.bars < 50) {
182
+ const d = { sym, ticks: state.bars || 0, price };
183
+ return {
184
+ type: 'system',
185
+ message: QUANT.building(d),
186
+ logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
187
+ };
188
+ }
189
+
190
+ // Ready - use rich QUANT context messages
180
191
  // Determine market context from QUANT metrics
181
192
  // zScore: mean reversion indicator (-3 to +3)
182
193
  // vpin: toxicity 0-1 (higher = more informed trading)
183
194
  // ofi: order flow imbalance -1 to +1 (positive = buying pressure)
184
195
  const absZ = Math.abs(zScore);
185
196
  const ofiAbs = Math.abs(ofi);
197
+ const zScoreAbs = absZ.toFixed(1);
198
+ const vpinPct = (vpin * 100).toFixed(0);
199
+ const ofiPct = (ofi > 0 ? '+' : '') + (ofi * 100).toFixed(0) + '%';
200
+
201
+ // Build data object for QUANT message pools
202
+ const d = {
203
+ sym, price,
204
+ zScore: zScore.toFixed(1),
205
+ zScoreAbs,
206
+ rawZScore: zScore,
207
+ vpin: vpinPct,
208
+ ofi: ofiPct,
209
+ ticks: state.bars || 0
210
+ };
186
211
 
187
- let contextMessage;
188
212
  let logType = 'analysis';
213
+ let message;
189
214
 
190
215
  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`;
216
+ // Strong signal zone - use bull/bear messages
197
217
  logType = 'signal';
218
+ message = zScore < 0 ? QUANT.bull(d) : QUANT.bear(d);
198
219
  } 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`;
220
+ // Approaching threshold - use ready messages
203
221
  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`;
222
+ message = QUANT.ready(d);
223
+ } else if (absZ >= 1.0 || ofiAbs >= 0.2) {
224
+ // Building edge - use zones messages
225
+ message = QUANT.zones(d);
216
226
  } 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
- });
227
+ // Normal market - use neutral messages
228
+ message = QUANT.neutral(d);
227
229
  }
228
230
 
229
231
  return {
230
232
  type: logType,
231
- message: `[${sym}] ${contextMessage}`,
233
+ message,
232
234
  logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
233
235
  };
234
236
  }
235
237
  return null;
236
238
  }
237
239
 
240
+ // HQX-2B strategy: event-based logging
238
241
  // No events = no log (SILENCE)
239
242
  if (events.length === 0) {
240
243
  return null;