hedgequantx 2.9.214 → 2.9.215
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 +3 -67
package/package.json
CHANGED
|
@@ -54,7 +54,6 @@ class SmartLogsEngine {
|
|
|
54
54
|
this.symbolCode = symbol;
|
|
55
55
|
this.counter = 0;
|
|
56
56
|
this.lastState = null;
|
|
57
|
-
this.lastLogTime = 0;
|
|
58
57
|
|
|
59
58
|
// State tracking for event detection (both strategies)
|
|
60
59
|
this.lastBias = null;
|
|
@@ -69,10 +68,6 @@ class SmartLogsEngine {
|
|
|
69
68
|
// QUANT specific
|
|
70
69
|
this.lastZRegime = null;
|
|
71
70
|
this.lastVpinToxic = false;
|
|
72
|
-
this.lastPrice = 0;
|
|
73
|
-
this.lastLoggedZ = null;
|
|
74
|
-
this.lastLoggedOfi = null;
|
|
75
|
-
this.recentMessages = [];
|
|
76
71
|
}
|
|
77
72
|
|
|
78
73
|
setSymbol(s) { this.symbolCode = s; }
|
|
@@ -235,66 +230,12 @@ class SmartLogsEngine {
|
|
|
235
230
|
this.lastVpinToxic = vpinToxic;
|
|
236
231
|
|
|
237
232
|
if (event && message) {
|
|
238
|
-
this.lastLogTime = Date.now();
|
|
239
|
-
this.lastPrice = state.price;
|
|
240
|
-
this.lastLoggedZ = zScore;
|
|
241
|
-
this.lastLoggedOfi = ofi;
|
|
242
233
|
return { type: logType, message, logToSession: event === 'z_regime' || event === 'bias_flip' };
|
|
243
234
|
}
|
|
244
235
|
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const price = state.price || 0;
|
|
249
|
-
const priceChange = this.lastPrice ? price - this.lastPrice : 0;
|
|
250
|
-
const zChange = this.lastLoggedZ !== null ? zScore - this.lastLoggedZ : 0;
|
|
251
|
-
const ofiChange = this.lastLoggedOfi !== null ? ofi - this.lastLoggedOfi : 0;
|
|
252
|
-
|
|
253
|
-
this.lastLogTime = now;
|
|
254
|
-
this.lastPrice = price;
|
|
255
|
-
this.lastLoggedZ = zScore;
|
|
256
|
-
this.lastLoggedOfi = ofi;
|
|
257
|
-
|
|
258
|
-
// Build contextual message based on what's actually happening
|
|
259
|
-
const zStr = zScore >= 0 ? `+${zScore.toFixed(1)}` : zScore.toFixed(1);
|
|
260
|
-
const ofiPct = (ofi * 100).toFixed(0);
|
|
261
|
-
const vpinPct = (vpin * 100).toFixed(0);
|
|
262
|
-
|
|
263
|
-
// Determine what's notable RIGHT NOW
|
|
264
|
-
let context;
|
|
265
|
-
if (Math.abs(priceChange) >= 0.5) {
|
|
266
|
-
// Price moved significantly
|
|
267
|
-
const dir = priceChange > 0 ? 'uptick' : 'downtick';
|
|
268
|
-
const ticks = Math.abs(priceChange / 0.25).toFixed(0);
|
|
269
|
-
context = `${dir} ${ticks}t`;
|
|
270
|
-
} else if (Math.abs(zChange) >= 0.3) {
|
|
271
|
-
// Z-Score shifting
|
|
272
|
-
context = zChange > 0 ? 'Z expanding' : 'Z contracting';
|
|
273
|
-
} else if (Math.abs(ofiChange) >= 0.05) {
|
|
274
|
-
// OFI shifting
|
|
275
|
-
context = ofiChange > 0 ? 'buying pressure' : 'selling pressure';
|
|
276
|
-
} else if (absZ >= 1.5) {
|
|
277
|
-
// In signal zone
|
|
278
|
-
const dir = zScore < 0 ? 'LONG zone' : 'SHORT zone';
|
|
279
|
-
context = dir;
|
|
280
|
-
} else if (Math.abs(ofi) >= 0.15) {
|
|
281
|
-
// Strong flow
|
|
282
|
-
context = ofi > 0 ? 'bid strength' : 'offer strength';
|
|
283
|
-
} else if (vpin > 0.4) {
|
|
284
|
-
// Elevated VPIN
|
|
285
|
-
context = 'elevated toxicity';
|
|
286
|
-
} else {
|
|
287
|
-
// Get instrument-specific neutral message
|
|
288
|
-
context = getContextualMessage(this.symbolCode, this.strategyId, 'neutral');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
type: 'analysis',
|
|
293
|
-
message: `[${sym}] ${price.toFixed(2)} | Z: ${zStr}σ | OFI: ${ofiPct}% | ${context}`,
|
|
294
|
-
logToSession: false
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
236
|
+
// EVENT-DRIVEN ONLY: No spam, no repetitive logs
|
|
237
|
+
// Silence = system is scanning, nothing notable happening
|
|
238
|
+
// This is professional HF behavior
|
|
298
239
|
return null;
|
|
299
240
|
}
|
|
300
241
|
|
|
@@ -303,7 +244,6 @@ class SmartLogsEngine {
|
|
|
303
244
|
this.counter = 0;
|
|
304
245
|
this.lastBias = null;
|
|
305
246
|
this.warmupLogged = false;
|
|
306
|
-
this.lastLogTime = 0;
|
|
307
247
|
// HQX-2B
|
|
308
248
|
this.lastBars = 0;
|
|
309
249
|
this.lastSwings = 0;
|
|
@@ -312,10 +252,6 @@ class SmartLogsEngine {
|
|
|
312
252
|
// QUANT
|
|
313
253
|
this.lastZRegime = null;
|
|
314
254
|
this.lastVpinToxic = false;
|
|
315
|
-
this.lastPrice = 0;
|
|
316
|
-
this.lastLoggedZ = null;
|
|
317
|
-
this.lastLoggedOfi = null;
|
|
318
|
-
this.recentMessages = [];
|
|
319
255
|
}
|
|
320
256
|
}
|
|
321
257
|
|