hedgequantx 2.6.56 → 2.6.58

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.6.56",
3
+ "version": "2.6.58",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -359,6 +359,7 @@ class CopyEngine {
359
359
 
360
360
  if (successCount === this.followers.length) {
361
361
  this.stats.trades++;
362
+ this.stats.sessionPnl += pnl; // Track session P&L
362
363
  if (pnl >= 0) this.stats.wins++;
363
364
  else this.stats.losses++;
364
365
  }
@@ -867,6 +868,7 @@ const launchCopyTrading = async (config) => {
867
868
  target: dailyTarget,
868
869
  risk: maxRisk,
869
870
  pnl: 0,
871
+ sessionPnl: 0, // P&L from THIS session only (HQX trades)
870
872
  trades: 0,
871
873
  wins: 0,
872
874
  losses: 0,
@@ -263,6 +263,7 @@ const launchAlgo = async (service, account, contract, config) => {
263
263
  trades: 0,
264
264
  wins: 0,
265
265
  losses: 0,
266
+ sessionPnl: 0, // P&L from THIS session only (HQX trades)
266
267
  latency: 0,
267
268
  connected: false,
268
269
  startTime: Date.now(),
@@ -325,6 +326,7 @@ const launchAlgo = async (service, account, contract, config) => {
325
326
  // Calculate PnL in dollars only if tickValue is available from API
326
327
  if (pnlTicks !== null && tickValue !== null) {
327
328
  const pnlDollars = pnlTicks * tickValue;
329
+ stats.sessionPnl += pnlDollars; // Track session P&L
328
330
  if (pnlDollars >= 0) {
329
331
  stats.wins++;
330
332
  algoLogger.targetHit(ui, symbolName, exitPrice, pnlDollars);
@@ -344,6 +346,7 @@ const launchAlgo = async (service, account, contract, config) => {
344
346
  }
345
347
  stats.trades++;
346
348
  currentPosition = 0;
349
+ stats.position = 0; // Reset UI position display
347
350
  pendingOrder = false;
348
351
  algoLogger.info(ui, 'HOLD TIME', `${(holdDurationMs / 1000).toFixed(1)}s`);
349
352
  });
@@ -468,12 +468,13 @@ const renderSessionSummary = (stats, stopReason) => {
468
468
 
469
469
  console.log(chalk.cyan(GM));
470
470
 
471
- // Row 4: P&L | Target
472
- const pnl = stats.pnl || 0;
471
+ // Row 4: Session P&L | Target
472
+ // Use sessionPnl (trades from this HQX session) if available, fallback to pnl
473
+ const pnl = stats.sessionPnl !== undefined ? stats.sessionPnl : (stats.pnl || 0);
473
474
  const pnlStr = `${pnl >= 0 ? '+' : ''}$${Math.abs(pnl).toFixed(2)}`;
474
475
  const pnlColor = pnl >= 0 ? chalk.green : chalk.red;
475
476
  const targetStr = `$${(stats.target || 0).toFixed(2)}`;
476
- row('P&L', pnlStr, pnlColor, 'TARGET', targetStr, chalk.cyan);
477
+ row('Session P&L', pnlStr, pnlColor, 'TARGET', targetStr, chalk.cyan);
477
478
 
478
479
  // Bottom border
479
480
  console.log(chalk.cyan(BOX.BOT + BOX.H.repeat(W) + BOX.BR));