hedgequantx 2.9.71 → 2.9.73

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.71",
3
+ "version": "2.9.73",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -10,6 +10,8 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ const chalk = require('chalk');
14
+
13
15
  // Track recently used messages to avoid repetition
14
16
  const recentMessages = new Map();
15
17
  const MAX_RECENT = 8; // Increased to handle larger pools
@@ -377,7 +379,8 @@ function getMarketBiasLog(direction, delta, buyPressure) {
377
379
  }
378
380
 
379
381
  const message = getVariedMessage(`bias_${direction}`, pool, `${direction} bias`);
380
- const arrow = direction === 'LONG' ? '▲' : direction === 'SHORT' ? '▼' : '=';
382
+ // Colored arrows: cyan for bullish, magenta for bearish
383
+ const arrow = direction === 'LONG' ? chalk.cyan.bold('▲') : direction === 'SHORT' ? chalk.magenta.bold('▼') : '=';
381
384
 
382
385
  let details;
383
386
  if (delta !== undefined && buyPressure !== undefined) {
@@ -325,7 +325,16 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
325
325
  timestamp: tick.timestamp || Date.now()
326
326
  });
327
327
 
328
- stats.latency = Date.now() - latencyStart;
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', () => {
@@ -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
- const spinnerIdx = elapsed % SPINNER.length;
294
- const spinner = SPINNER[spinnerIdx];
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' });