hedgequantx 2.9.228 → 2.9.229
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/dist/lib/m/ultra-scalping.js +23 -8
- package/package.json +1 -1
|
@@ -136,6 +136,26 @@ class HQXUltraScalpingStrategy extends EventEmitter {
|
|
|
136
136
|
this.tickBuffer.set(contractId, []);
|
|
137
137
|
this.lastBarTime.set(contractId, 0);
|
|
138
138
|
this.kalmanStates.set(contractId, { estimate: 0, errorCovariance: 1.0 });
|
|
139
|
+
|
|
140
|
+
// Start status log interval - emits every second regardless of tick flow
|
|
141
|
+
this._currentContractId = contractId;
|
|
142
|
+
this._lastPrice = 0;
|
|
143
|
+
if (this._statusInterval) clearInterval(this._statusInterval);
|
|
144
|
+
this._statusInterval = setInterval(() => {
|
|
145
|
+
if (this._lastPrice > 0) {
|
|
146
|
+
this._emitStatusLog(this._currentContractId, this._lastPrice);
|
|
147
|
+
}
|
|
148
|
+
}, 1000);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Stop the strategy and clean up interval
|
|
153
|
+
*/
|
|
154
|
+
stop() {
|
|
155
|
+
if (this._statusInterval) {
|
|
156
|
+
clearInterval(this._statusInterval);
|
|
157
|
+
this._statusInterval = null;
|
|
158
|
+
}
|
|
139
159
|
}
|
|
140
160
|
|
|
141
161
|
/**
|
|
@@ -152,15 +172,10 @@ class HQXUltraScalpingStrategy extends EventEmitter {
|
|
|
152
172
|
let ticks = this.tickBuffer.get(contractId);
|
|
153
173
|
ticks.push(tick);
|
|
154
174
|
|
|
155
|
-
// Track total ticks for status log
|
|
175
|
+
// Track total ticks and last price for status log interval
|
|
156
176
|
this._totalTicks = (this._totalTicks || 0) + 1;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const now = Date.now();
|
|
160
|
-
if (!this._lastStatusLog || now - this._lastStatusLog >= 1000) {
|
|
161
|
-
this._lastStatusLog = now;
|
|
162
|
-
this._emitStatusLog(contractId, tick.price);
|
|
163
|
-
}
|
|
177
|
+
this._lastPrice = tick.price;
|
|
178
|
+
this._currentContractId = contractId;
|
|
164
179
|
|
|
165
180
|
// Check if we should form a new bar
|
|
166
181
|
const lastBar = this.lastBarTime.get(contractId);
|