hedgequantx 2.9.70 → 2.9.72
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
CHANGED
|
@@ -325,16 +325,25 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
325
325
|
timestamp: tick.timestamp || Date.now()
|
|
326
326
|
});
|
|
327
327
|
|
|
328
|
-
|
|
328
|
+
// Calculate network latency from tick timestamp (if available)
|
|
329
|
+
if (tick.timestamp) {
|
|
330
|
+
const tickTime = typeof tick.timestamp === 'number' ? tick.timestamp : Date.parse(tick.timestamp);
|
|
331
|
+
if (!isNaN(tickTime)) {
|
|
332
|
+
stats.latency = Math.max(0, Date.now() - tickTime);
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
// Fallback: processing latency
|
|
336
|
+
stats.latency = Date.now() - latencyStart;
|
|
337
|
+
}
|
|
329
338
|
});
|
|
330
339
|
|
|
331
340
|
marketFeed.on('connected', () => {
|
|
332
341
|
stats.connected = true;
|
|
333
|
-
ui.addLog('connected', 'Market data connected
|
|
334
|
-
ui.addLog('info', 'Subscribing to market data...');
|
|
342
|
+
ui.addLog('connected', 'Market data connected');
|
|
335
343
|
});
|
|
336
|
-
marketFeed.on('subscribed', (symbol) => ui.addLog('
|
|
337
|
-
|
|
344
|
+
marketFeed.on('subscribed', (symbol) => ui.addLog('system', `Subscribed: ${symbol}`));
|
|
345
|
+
// Suppress debug logs - not needed in production
|
|
346
|
+
// marketFeed.on('debug', (msg) => ui.addLog('debug', msg));
|
|
338
347
|
marketFeed.on('error', (err) => ui.addLog('error', `Market: ${err.message}`));
|
|
339
348
|
marketFeed.on('disconnected', () => { stats.connected = false; ui.addLog('error', 'Market disconnected'); });
|
|
340
349
|
|
|
@@ -346,7 +355,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
346
355
|
}
|
|
347
356
|
await marketFeed.connect(rithmicCredentials);
|
|
348
357
|
await marketFeed.subscribe(symbolCode, contract.exchange || 'CME');
|
|
349
|
-
ui.addLog('info', `Symbol code: ${symbolCode}`);
|
|
350
358
|
} catch (e) {
|
|
351
359
|
ui.addLog('error', `Failed to connect: ${e.message}`);
|
|
352
360
|
}
|
package/src/pages/algo/ui.js
CHANGED
|
@@ -288,10 +288,10 @@ class AlgoUI {
|
|
|
288
288
|
const { W, logs, maxLogs } = this;
|
|
289
289
|
|
|
290
290
|
// Activity header - HF style with animated spinner
|
|
291
|
-
const elapsed = Math.floor((Date.now() - (this.startTime || Date.now())) / 100);
|
|
292
291
|
if (!this.startTime) this.startTime = Date.now();
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
if (!this.spinnerFrame) this.spinnerFrame = 0;
|
|
293
|
+
this.spinnerFrame = (this.spinnerFrame + 1) % SPINNER.length;
|
|
294
|
+
const spinner = SPINNER[this.spinnerFrame];
|
|
295
295
|
const now = new Date();
|
|
296
296
|
const timeStr = now.toLocaleTimeString('en-US', { hour12: false });
|
|
297
297
|
const dateStr = now.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
|