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 +1 -1
- package/src/lib/smart-logs-engine.js +53 -18
package/package.json
CHANGED
|
@@ -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
|
|
173
|
-
if (this.strategyId === 'ultra-scalping'
|
|
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
|
-
//
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
//
|
|
192
|
-
|
|
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
|
-
|
|
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:
|
|
199
|
-
message
|
|
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;
|