hedgequantx 1.2.132 → 1.2.134

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": "1.2.132",
3
+ "version": "1.2.134",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/pages/algo.js CHANGED
@@ -1880,13 +1880,23 @@ const launchCopyTrading = async (config) => {
1880
1880
  });
1881
1881
 
1882
1882
  hqxServer.on('error', (data) => {
1883
- addLog('error', data.message || 'Unknown error');
1883
+ const errorMsg = data.message || 'Unknown error';
1884
+ addLog('error', errorMsg);
1885
+
1886
+ // If algo failed to start, switch to monitor mode
1887
+ if (errorMsg.includes('Failed to start') || errorMsg.includes('WebSocket failed') || errorMsg.includes('Échec')) {
1888
+ if (hqxConnected) {
1889
+ hqxConnected = false;
1890
+ addLog('warning', 'Switching to Monitor Mode (watching Lead positions)');
1891
+ displayUI();
1892
+ }
1893
+ }
1884
1894
  });
1885
1895
 
1886
1896
  hqxServer.on('disconnected', () => {
1887
1897
  hqxConnected = false;
1888
1898
  if (!stopReason) {
1889
- addLog('error', 'HQX Server disconnected');
1899
+ addLog('warning', 'HQX Server disconnected - Switching to Monitor Mode');
1890
1900
  }
1891
1901
  });
1892
1902
 
@@ -1896,6 +1906,19 @@ const launchCopyTrading = async (config) => {
1896
1906
 
1897
1907
  const propfirmToken = lead.service.getToken ? lead.service.getToken() : null;
1898
1908
  const propfirmId = lead.service.getPropfirm ? lead.service.getPropfirm() : (lead.account.propfirm || 'topstep');
1909
+
1910
+ // Get Rithmic credentials if this is a Rithmic account
1911
+ let rithmicCredentials = null;
1912
+ if (lead.service.getRithmicCredentials) {
1913
+ rithmicCredentials = lead.service.getRithmicCredentials();
1914
+ } else if (lead.account.rithmicUserId && lead.account.rithmicPassword) {
1915
+ rithmicCredentials = {
1916
+ userId: lead.account.rithmicUserId,
1917
+ password: lead.account.rithmicPassword,
1918
+ systemName: lead.account.rithmicSystem || 'Apex',
1919
+ gateway: lead.account.rithmicGateway || 'wss://rprotocol.rithmic.com:443'
1920
+ };
1921
+ }
1899
1922
 
1900
1923
  hqxServer.startAlgo({
1901
1924
  accountId: lead.account.accountId,
@@ -1906,6 +1929,7 @@ const launchCopyTrading = async (config) => {
1906
1929
  maxRisk: maxRisk,
1907
1930
  propfirm: propfirmId,
1908
1931
  propfirmToken: propfirmToken,
1932
+ rithmicCredentials: rithmicCredentials,
1909
1933
  copyTrading: true, // Flag for copy trading mode
1910
1934
  followerSymbol: follower.symbol.value,
1911
1935
  followerContracts: follower.contracts
@@ -275,7 +275,13 @@ class HQXServerService {
275
275
  dailyTarget: config.dailyTarget,
276
276
  maxRisk: config.maxRisk,
277
277
  propfirm: config.propfirm,
278
- propfirmToken: config.propfirmToken
278
+ propfirmToken: config.propfirmToken,
279
+ // Rithmic credentials (for Apex, TopstepTrader Rithmic, etc.)
280
+ rithmicCredentials: config.rithmicCredentials || null,
281
+ // Copy trading mode
282
+ copyTrading: config.copyTrading || false,
283
+ followerSymbol: config.followerSymbol,
284
+ followerContracts: config.followerContracts
279
285
  });
280
286
  }
281
287
 
@@ -625,6 +625,26 @@ class RithmicService extends EventEmitter {
625
625
  return this.loginInfo ? 'connected' : null;
626
626
  }
627
627
 
628
+ /**
629
+ * Get propfirm name
630
+ */
631
+ getPropfirm() {
632
+ return this.propfirmKey || 'apex';
633
+ }
634
+
635
+ /**
636
+ * Get Rithmic credentials for HQX Server
637
+ */
638
+ getRithmicCredentials() {
639
+ if (!this.credentials) return null;
640
+ return {
641
+ userId: this.credentials.username,
642
+ password: this.credentials.password,
643
+ systemName: this.propfirm.systemName,
644
+ gateway: this.propfirm.gateway || 'wss://rprotocol.rithmic.com:443'
645
+ };
646
+ }
647
+
628
648
  /**
629
649
  * Search contracts (stub - would need TICKER_PLANT)
630
650
  */