hedgequantx 2.9.238 → 2.9.239

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.
@@ -158,40 +158,41 @@ class HQXUltraScalpingStrategy extends EventEmitter {
158
158
  }
159
159
 
160
160
  /**
161
- * Process a tick - aggregates into bars then runs strategy
161
+ * Process a tick - TICK-BY-TICK processing (matches Python backtest)
162
+ * Each tick is treated as a single-tick "bar" for model calculations
162
163
  */
163
164
  processTick(tick) {
164
165
  const contractId = tick.contractId;
166
+ const price = tick.price;
167
+ const volume = tick.volume || 1;
168
+ const timestamp = tick.timestamp || Date.now();
165
169
 
166
170
  if (!this.barHistory.has(contractId)) {
167
171
  this.initialize(contractId);
168
172
  }
169
-
170
- // Add tick to buffer
171
- let ticks = this.tickBuffer.get(contractId);
172
- ticks.push(tick);
173
173
 
174
- // Track total ticks and last price for status log interval
174
+ // Track total ticks and last price
175
175
  this._totalTicks = (this._totalTicks || 0) + 1;
176
- this._lastPrice = tick.price;
176
+ this._lastPrice = price;
177
177
  this._currentContractId = contractId;
178
178
 
179
- // Check if we should form a new bar
180
- const lastBar = this.lastBarTime.get(contractId);
179
+ // Create single-tick bar (matches Python backtest behavior)
180
+ const bar = {
181
+ timestamp,
182
+ open: price,
183
+ high: price,
184
+ low: price,
185
+ close: price,
186
+ volume
187
+ };
181
188
 
182
- if (now - lastBar >= this.barIntervalMs && ticks.length > 0) {
183
- const bar = this._aggregateTicksToBar(ticks, now);
184
- this.tickBuffer.set(contractId, []);
185
- this.lastBarTime.set(contractId, now);
186
-
187
- if (bar) {
188
- const signal = this.processBar(contractId, bar);
189
- if (signal) {
190
- this.emit('signal', signal);
191
- return signal;
192
- }
193
- }
189
+ // Process bar and emit signal if generated
190
+ const signal = this.processBar(contractId, bar);
191
+ if (signal) {
192
+ this.emit('signal', signal);
193
+ return signal;
194
194
  }
195
+
195
196
  return null;
196
197
  }
197
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.238",
3
+ "version": "2.9.239",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {