hedgequantx 2.9.200 → 2.9.202
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.
|
@@ -579,7 +579,8 @@ class HQXUltraScalpingStrategy extends EventEmitter {
|
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
//
|
|
583
|
-
|
|
582
|
+
// Export class (not instance) - consistent with HQX-2B pattern
|
|
583
|
+
// M1 is the class, use new M1() to create instances
|
|
584
|
+
const M1 = HQXUltraScalpingStrategy;
|
|
584
585
|
|
|
585
586
|
module.exports = { M1, HQXUltraScalpingStrategy, OrderSide, SignalStrength };
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ const CONFIG = {
|
|
|
15
15
|
PRICE_CHANGE_TICKS: 4, // Log when price moves 4+ ticks
|
|
16
16
|
DELTA_CHANGE_THRESHOLD: 200, // Log when delta changes 200+
|
|
17
17
|
ZONE_APPROACH_TICKS: 5, // Log when within 5 ticks of zone
|
|
18
|
+
LOG_INTERVAL_SECONDS: 5, // Log every N seconds with quant data
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const SYMBOLS = {
|
|
@@ -146,9 +147,11 @@ class SmartLogsEngine {
|
|
|
146
147
|
|
|
147
148
|
getLog(state = {}) {
|
|
148
149
|
this.counter++;
|
|
149
|
-
const { position = 0, delta = 0 } = state;
|
|
150
|
+
const { position = 0, delta = 0, zScore = 0, vpin = 0, ofi = 0 } = state;
|
|
150
151
|
const sym = getSym(this.symbolCode);
|
|
151
152
|
const price = state.price > 0 ? state.price.toFixed(2) : '-.--';
|
|
153
|
+
const T = this.strategyId === 'hqx-2b' ? HQX2B : QUANT;
|
|
154
|
+
const now = Date.now();
|
|
152
155
|
|
|
153
156
|
// Active position - always log
|
|
154
157
|
if (position !== 0) {
|
|
@@ -165,6 +168,40 @@ class SmartLogsEngine {
|
|
|
165
168
|
const events = this._detectEvents(state, this.lastState);
|
|
166
169
|
this.lastState = { ...state };
|
|
167
170
|
|
|
171
|
+
// For QUANT strategy: use rich messages with Z-score, VPIN, OFI
|
|
172
|
+
if (this.strategyId === 'ultra-scalping' && state.bars >= 5) {
|
|
173
|
+
const timeSinceLastLog = now - this.lastLogTime;
|
|
174
|
+
|
|
175
|
+
// Log every 5 seconds with quant metrics
|
|
176
|
+
if (timeSinceLastLog >= CONFIG.LOG_INTERVAL_SECONDS * 1000) {
|
|
177
|
+
this.lastLogTime = now;
|
|
178
|
+
|
|
179
|
+
// Use rich QUANT messages with actual metrics
|
|
180
|
+
const zStr = zScore.toFixed(2);
|
|
181
|
+
const vpinStr = (vpin * 100).toFixed(0);
|
|
182
|
+
const ofiStr = (ofi * 100).toFixed(0);
|
|
183
|
+
|
|
184
|
+
// Choose message based on z-score level
|
|
185
|
+
let message;
|
|
186
|
+
if (Math.abs(zScore) >= 1.5) {
|
|
187
|
+
// Near signal threshold - use zones message
|
|
188
|
+
message = T.zones({
|
|
189
|
+
sym, price, zScore: zStr, vpin: vpinStr, ofi: ofiStr,
|
|
190
|
+
ticks: state.tickCount || state.bars
|
|
191
|
+
});
|
|
192
|
+
} else if (Math.abs(zScore) >= 0.8) {
|
|
193
|
+
// Building - use building message
|
|
194
|
+
message = T.building({ sym, ticks: state.tickCount || state.bars });
|
|
195
|
+
} else {
|
|
196
|
+
// Neutral - use simpler analysis
|
|
197
|
+
message = T.priceMove({ sym, price, dir: zScore > 0 ? 'up' : 'down', ticks: Math.abs(zScore).toFixed(1) });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return { type: 'analysis', message, logToSession: this.counter % CONFIG.SESSION_LOG_INTERVAL === 0 };
|
|
201
|
+
}
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
|
|
168
205
|
// No events = no log (SILENCE)
|
|
169
206
|
if (events.length === 0) {
|
|
170
207
|
return null;
|
|
@@ -27,7 +27,7 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
27
27
|
const strategyId = strategyInfo?.id || 'ultra-scalping';
|
|
28
28
|
const strategyName = strategyInfo?.name || 'HQX Scalping';
|
|
29
29
|
const strategyModule = loadStrategy(strategyId);
|
|
30
|
-
const StrategyClass = strategyModule.M1;
|
|
30
|
+
const StrategyClass = strategyModule.M1;
|
|
31
31
|
|
|
32
32
|
const supervisionEnabled = supervisionConfig?.supervisionEnabled && supervisionConfig?.agents?.length > 0;
|
|
33
33
|
const supervisionEngine = supervisionEnabled ? new SupervisionEngine(supervisionConfig) : null;
|