hedgequantx 2.6.134 → 2.6.135

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.134",
3
+ "version": "2.6.135",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -1934,19 +1934,25 @@ const launchMultiSymbolRithmic = async (service, account, contracts, config) =>
1934
1934
  const emergencyStopAll = async () => {
1935
1935
  ui.addLog('warning', '████ EMERGENCY STOP ████');
1936
1936
 
1937
- // Close all positions
1938
- for (const [symbolName, pm] of Object.entries(positionManagers)) {
1939
- try {
1940
- if (pm.hasPosition(symbolName)) {
1941
- pm.closePosition(symbolName);
1942
- ui.addLog('info', `[${symbolName}] Closing position...`);
1937
+ try {
1938
+ // Use Rithmic emergencyStop to flatten all positions
1939
+ if (service && typeof service.emergencyStop === 'function') {
1940
+ await service.emergencyStop(rithmicAccountId);
1941
+ ui.addLog('info', 'Emergency stop executed - all positions flattened');
1942
+ } else if (service && typeof service.flattenAll === 'function') {
1943
+ await service.flattenAll(rithmicAccountId);
1944
+ ui.addLog('info', 'Flatten all executed - all positions closed');
1945
+ } else {
1946
+ // Fallback: cancel all orders
1947
+ if (service && typeof service.cancelAllOrders === 'function') {
1948
+ await service.cancelAllOrders(rithmicAccountId);
1949
+ ui.addLog('info', 'All orders cancelled');
1943
1950
  }
1944
- } catch (e) {
1945
- ui.addLog('error', `[${symbolName}] Close failed: ${e.message}`);
1946
1951
  }
1952
+ } catch (e) {
1953
+ ui.addLog('error', `Emergency stop error: ${e.message}`);
1947
1954
  }
1948
1955
 
1949
- ui.addLog('info', 'All close orders sent');
1950
1956
  ui.render(stats);
1951
1957
  };
1952
1958