hedgequantx 2.9.128 → 2.9.129

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.128",
3
+ "version": "2.9.129",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -388,6 +388,10 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
388
388
  if (!rithmicCredentials) {
389
389
  throw new Error('Rithmic credentials not available');
390
390
  }
391
+ // Disconnect service's TICKER_PLANT to avoid conflict (Rithmic allows only 1 TICKER connection per user)
392
+ if (service.disconnectTicker) {
393
+ await service.disconnectTicker();
394
+ }
391
395
  await marketFeed.connect(rithmicCredentials);
392
396
  await marketFeed.subscribe(symbolCode, contract.exchange || 'CME');
393
397
 
@@ -207,6 +207,12 @@ class RithmicService extends EventEmitter {
207
207
 
208
208
  async connectTicker(username, password) {
209
209
  try {
210
+ // Clean up existing connection first
211
+ if (this.tickerConn) {
212
+ this.tickerConn.removeAllListeners();
213
+ try { await this.tickerConn.disconnect(); } catch (_) {}
214
+ }
215
+
210
216
  this.tickerConn = new RithmicConnection();
211
217
 
212
218
  const config = {
@@ -220,12 +226,8 @@ class RithmicService extends EventEmitter {
220
226
 
221
227
  await this.tickerConn.connect(config);
222
228
 
223
- // Auto-reconnect Ticker on disconnect
224
- this.tickerConn.on('disconnected', ({ code }) => {
225
- if (this.credentials && code !== 1000) {
226
- setTimeout(() => this.connectTicker(this.credentials.username, this.credentials.password), 3000);
227
- }
228
- });
229
+ // NO auto-reconnect for tickerConn - it's only used for contract search
230
+ // MarketDataFeed handles its own TICKER_PLANT connection for algo trading
229
231
 
230
232
  return new Promise((resolve) => {
231
233
  const timeout = setTimeout(() => {
@@ -251,6 +253,17 @@ class RithmicService extends EventEmitter {
251
253
  return false;
252
254
  }
253
255
  }
256
+
257
+ /**
258
+ * Disconnect TICKER_PLANT to allow MarketDataFeed to use it exclusively
259
+ */
260
+ async disconnectTicker() {
261
+ if (this.tickerConn) {
262
+ this.tickerConn.removeAllListeners();
263
+ try { await this.tickerConn.disconnect(); } catch (_) {}
264
+ this.tickerConn = null;
265
+ }
266
+ }
254
267
 
255
268
  // ==================== DELEGATED METHODS ====================
256
269