hedgequantx 2.9.203 → 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.203",
3
+ "version": "2.9.205",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -169,40 +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 smart-logs messages
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
- // 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
+ // 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
+ }
190
189
 
191
- // Add quant metrics suffix
192
- const zStr = zScore.toFixed(2);
190
+ // Ready - use rich QUANT context messages
191
+ // Determine market context from QUANT metrics
192
+ // zScore: mean reversion indicator (-3 to +3)
193
+ // vpin: toxicity 0-1 (higher = more informed trading)
194
+ // ofi: order flow imbalance -1 to +1 (positive = buying pressure)
195
+ const absZ = Math.abs(zScore);
196
+ const ofiAbs = Math.abs(ofi);
197
+ const zScoreAbs = absZ.toFixed(1);
193
198
  const vpinPct = (vpin * 100).toFixed(0);
194
- const ofiPct = (ofi * 100).toFixed(0);
195
- const metrics = chalk.gray(` | Z:${zStr} VPIN:${vpinPct}% OFI:${ofiPct}%`);
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
+ };
211
+
212
+ let logType = 'analysis';
213
+ let message;
214
+
215
+ if (absZ >= 2.0) {
216
+ // Strong signal zone - use bull/bear messages
217
+ logType = 'signal';
218
+ message = zScore < 0 ? QUANT.bull(d) : QUANT.bear(d);
219
+ } else if (absZ >= 1.5) {
220
+ // Approaching threshold - use ready messages
221
+ logType = 'signal';
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);
226
+ } else {
227
+ // Normal market - use neutral messages
228
+ message = QUANT.neutral(d);
229
+ }
196
230
 
197
231
  return {
198
- type: 'analysis',
199
- message: `[${sym}] ${liveMessage}${metrics}`,
232
+ type: logType,
233
+ message,
200
234
  logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0
201
235
  };
202
236
  }
203
237
  return null;
204
238
  }
205
239
 
240
+ // HQX-2B strategy: event-based logging
206
241
  // No events = no log (SILENCE)
207
242
  if (events.length === 0) {
208
243
  return null;