hedgequantx 2.6.147 → 2.6.149

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.147",
3
+ "version": "2.6.149",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -2038,10 +2038,26 @@ const launchMultiSymbolRithmic = async (service, account, contracts, config) =>
2038
2038
  ui.render(stats);
2039
2039
 
2040
2040
  for (const [symbolName, symStats] of Object.entries(stats.symbolStats)) {
2041
- const posQty = Math.abs(symStats.position || 0);
2041
+ // Get position from positionManager (more reliable than stats)
2042
+ const pm = positionManagers[symbolName];
2043
+ const pmPosition = pm?.currentPosition;
2044
+
2045
+ // Use PM position if available, otherwise fallback to stats
2046
+ let posQty = 0;
2047
+ let closeSide = 0;
2048
+
2049
+ if (pmPosition && pmPosition.size > 0) {
2050
+ posQty = pmPosition.size;
2051
+ closeSide = pmPosition.side === 0 ? 1 : 0; // Sell if long (0), Buy if short (1)
2052
+ } else if (symStats.position && symStats.position !== 0) {
2053
+ // Fallback: use stats but sanitize the value
2054
+ posQty = Math.min(Math.abs(Number(symStats.position) || 0), 10); // Max 10 contracts safety
2055
+ if (posQty === 0) posQty = 1; // Default to 1 if we think there's a position
2056
+ closeSide = symStats.position > 0 ? 1 : 0;
2057
+ }
2058
+
2042
2059
  if (posQty === 0) continue;
2043
2060
 
2044
- const closeSide = symStats.position > 0 ? 1 : 0; // Sell if long, Buy if short
2045
2061
  const sideStr = closeSide === 1 ? 'SELL' : 'BUY';
2046
2062
 
2047
2063
  ui.addLog('info', `Closing [${symbolName}] ${sideStr} ${posQty}x...`);
@@ -2177,11 +2193,13 @@ const launchMultiSymbolRithmic = async (service, account, contracts, config) =>
2177
2193
  // Close log file with session summary
2178
2194
  try { ui.closeLog(stats); } catch {}
2179
2195
 
2180
- try { ui.cleanup(); } catch {}
2181
-
2182
2196
  // ═══════════════════════════════════════════════════════════════════════════
2183
2197
  // SESSION SUMMARY (duration already calculated above)
2184
2198
  // ═══════════════════════════════════════════════════════════════════════════
2199
+ // Clear screen, show cursor, and render summary
2200
+ process.stdout.write('\x1B[?25h'); // Show cursor
2201
+ console.clear();
2202
+
2185
2203
  // Render multi-symbol summary with same style as single-symbol
2186
2204
  renderMultiSymbolSummary(stats, stopReason, stats.symbolStats);
2187
2205