hedgequantx 2.9.203 → 2.9.204

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.203",
3
+ "version": "2.9.204",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -169,7 +169,7 @@ class SmartLogsEngine {
169
169
  const events = this._detectEvents(state, this.lastState);
170
170
  this.lastState = { ...state };
171
171
 
172
- // For QUANT strategy: use rich smart-logs messages
172
+ // For QUANT strategy: use rich QUANT-specific smart-logs
173
173
  if (this.strategyId === 'ultra-scalping' && state.bars >= 5) {
174
174
  const timeSinceLastLog = now - this.lastLogTime;
175
175
 
@@ -177,26 +177,58 @@ class SmartLogsEngine {
177
177
  if (timeSinceLastLog >= CONFIG.LOG_INTERVAL_SECONDS * 1000) {
178
178
  this.lastLogTime = now;
179
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
- });
180
+ // Determine market context from QUANT metrics
181
+ // zScore: mean reversion indicator (-3 to +3)
182
+ // vpin: toxicity 0-1 (higher = more informed trading)
183
+ // ofi: order flow imbalance -1 to +1 (positive = buying pressure)
184
+ const absZ = Math.abs(zScore);
185
+ const ofiAbs = Math.abs(ofi);
190
186
 
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}%`);
187
+ let contextMessage;
188
+ let logType = 'analysis';
189
+
190
+ 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`;
197
+ logType = 'signal';
198
+ } 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`;
203
+ 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`;
216
+ } 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
+ }
196
228
 
197
229
  return {
198
- type: 'analysis',
199
- message: `[${sym}] ${liveMessage}${metrics}`,
230
+ type: logType,
231
+ message: `[${sym}] ${contextMessage}`,
200
232
  logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
201
233
  };
202
234
  }