hedgequantx 2.9.120 → 2.9.122
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/pages/algo/algo-executor.js +27 -13
package/package.json
CHANGED
|
@@ -34,9 +34,9 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
34
34
|
const accountName = showName
|
|
35
35
|
? (account.accountName || account.rithmicAccountId || account.accountId)
|
|
36
36
|
: 'HQX *****';
|
|
37
|
-
const symbolName = contract.name
|
|
38
|
-
const symbolCode = contract.symbol || contract.id; // Rithmic symbol
|
|
39
|
-
const contractId = contract.id;
|
|
37
|
+
const symbolName = contract.name || contract.baseSymbol || 'Unknown';
|
|
38
|
+
const symbolCode = contract.symbol || contract.baseSymbol || contract.id; // Rithmic symbol for subscription
|
|
39
|
+
const contractId = contract.symbol || contract.baseSymbol || contract.id; // For strategy tracking
|
|
40
40
|
const tickSize = contract.tickSize || 0.25;
|
|
41
41
|
|
|
42
42
|
const ui = new AlgoUI({
|
|
@@ -87,6 +87,10 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
87
87
|
risk: maxRisk
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
// Log detailed contract info for debugging
|
|
91
|
+
sessionLogger.log('CONFIG', `symbolCode=${symbolCode} contractId=${contractId} exchange=${contract.exchange} tickSize=${tickSize}`);
|
|
92
|
+
sessionLogger.log('CONFIG', `account=${account.accountId} rithmicId=${account.rithmicAccountId || 'N/A'}`);
|
|
93
|
+
|
|
90
94
|
strategy.on('log', (log) => {
|
|
91
95
|
const type = log.type === 'debug' ? 'debug' : log.type === 'info' ? 'analysis' : 'system';
|
|
92
96
|
ui.addLog(type, log.message);
|
|
@@ -233,7 +237,7 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
233
237
|
let lastLogSecond = 0;
|
|
234
238
|
let buyVolume = 0;
|
|
235
239
|
let sellVolume = 0;
|
|
236
|
-
|
|
240
|
+
|
|
237
241
|
|
|
238
242
|
let lastTickTime = 0;
|
|
239
243
|
let tickLatencies = [];
|
|
@@ -243,6 +247,12 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
243
247
|
const now = Date.now();
|
|
244
248
|
const currentSecond = Math.floor(now / 1000);
|
|
245
249
|
|
|
250
|
+
// Debug first 5 ticks to verify data
|
|
251
|
+
if (tickCount <= 5) {
|
|
252
|
+
const p = Number(tick.price) || Number(tick.tradePrice) || 'NULL';
|
|
253
|
+
sessionLogger.log('TICK', `#${tickCount} price=${p} symbol=${tick.symbol || tick.contractId || 'N/A'}`);
|
|
254
|
+
}
|
|
255
|
+
|
|
246
256
|
// Count ticks per second
|
|
247
257
|
if (currentSecond === lastTickSecond) {
|
|
248
258
|
ticksPerSecond++;
|
|
@@ -293,9 +303,10 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
293
303
|
if (currentSecond % 30 === 0) {
|
|
294
304
|
const state = strategy.getAnalysisState?.(contractId, price);
|
|
295
305
|
if (state) {
|
|
296
|
-
|
|
306
|
+
const bars = state.barsProcessed || 0;
|
|
307
|
+
sessionLogger.state(state.activeZones || 0, state.swingsDetected || 0, bars, lastBias);
|
|
297
308
|
if (!state.ready) {
|
|
298
|
-
ui.addLog('system', state.message);
|
|
309
|
+
ui.addLog('system', `${state.message} (${bars} bars)`);
|
|
299
310
|
} else {
|
|
300
311
|
const resStr = state.nearestResistance ? state.nearestResistance.toFixed(2) : '--';
|
|
301
312
|
const supStr = state.nearestSupport ? state.nearestSupport.toFixed(2) : '--';
|
|
@@ -346,13 +357,16 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
346
357
|
lastBid = bid;
|
|
347
358
|
lastAsk = ask;
|
|
348
359
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
360
|
+
// Only process tick if we have a valid price
|
|
361
|
+
if (price && price > 0) {
|
|
362
|
+
strategy.processTick({
|
|
363
|
+
contractId: tick.contractId || contractId,
|
|
364
|
+
price: price, bid: bid, ask: ask,
|
|
365
|
+
volume: volume,
|
|
366
|
+
side: tick.side || tick.lastTradeSide || 'unknown',
|
|
367
|
+
timestamp: tick.timestamp || Date.now()
|
|
368
|
+
});
|
|
369
|
+
}
|
|
356
370
|
|
|
357
371
|
// Calculate latency from Rithmic ssboe/usecs or inter-tick timing
|
|
358
372
|
if (tick.ssboe && tick.usecs !== undefined) {
|