hedgequantx 2.9.167 → 2.9.168

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.167",
3
+ "version": "2.9.168",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -85,17 +85,23 @@ const fetchAllFrontMonths = (service) => {
85
85
 
86
86
  const tickerState = service.tickerConn.connectionState;
87
87
  const tickerConnected = service.tickerConn.isConnected;
88
- log.debug('fetchAllFrontMonths starting', { tickerState, tickerConnected });
88
+
89
+ // Direct console.log for daemon broker.log (always visible)
90
+ const brokerLog = (msg, data) => console.log(`[CONTRACTS] ${msg}`, JSON.stringify(data));
91
+
92
+ brokerLog('fetchAllFrontMonths starting', { tickerState, tickerConnected });
89
93
 
90
94
  return new Promise((resolve) => {
91
95
  const contracts = new Map();
92
96
  const productsToCheck = new Map();
93
97
  let msgCount = 0;
98
+ let productMsgCount = 0;
94
99
 
95
100
  // Handler for ProductCodes responses
96
101
  const productHandler = (msg) => {
97
102
  msgCount++;
98
103
  if (msg.templateId !== 112) return;
104
+ productMsgCount++;
99
105
 
100
106
  const decoded = decodeProductCodes(msg.data);
101
107
  if (!decoded.productCode || !decoded.exchange) return;
@@ -135,23 +141,28 @@ const fetchAllFrontMonths = (service) => {
135
141
  service.tickerConn.on('message', frontMonthHandler);
136
142
 
137
143
  // Request all product codes
138
- log.debug('Sending RequestProductCodes');
144
+ brokerLog('Sending RequestProductCodes', { templateId: 111 });
139
145
  try {
140
146
  service.tickerConn.send('RequestProductCodes', {
141
147
  templateId: 111,
142
148
  userMsg: ['get-products'],
143
149
  });
150
+ brokerLog('RequestProductCodes sent OK', {});
144
151
  } catch (err) {
145
- log.warn('Failed to send RequestProductCodes', { error: err.message });
152
+ brokerLog('FAILED to send RequestProductCodes', { error: err.message });
146
153
  }
147
154
 
148
155
  // After timeout, request front months
149
156
  setTimeout(() => {
150
157
  service.tickerConn.removeListener('message', productHandler);
151
- log.debug('Collected products', { count: productsToCheck.size, totalMsgs: msgCount });
158
+ brokerLog('ProductCodes phase complete', {
159
+ productsFound: productsToCheck.size,
160
+ totalMsgs: msgCount,
161
+ productMsgs: productMsgCount
162
+ });
152
163
 
153
164
  if (productsToCheck.size === 0) {
154
- log.warn('No products collected - TICKER may not be working');
165
+ brokerLog('WARNING: No products collected - TICKER may not be responding', {});
155
166
  }
156
167
 
157
168
  for (const product of productsToCheck.values()) {
@@ -163,7 +174,7 @@ const fetchAllFrontMonths = (service) => {
163
174
  exchange: product.exchange,
164
175
  });
165
176
  } catch (err) {
166
- log.warn('Failed to send RequestFrontMonthContract', { product: product.productCode, error: err.message });
177
+ brokerLog('Failed to send RequestFrontMonthContract', { product: product.productCode, error: err.message });
167
178
  }
168
179
  }
169
180
 
@@ -191,7 +202,7 @@ const fetchAllFrontMonths = (service) => {
191
202
  // Sort alphabetically by base symbol
192
203
  results.sort((a, b) => a.baseSymbol.localeCompare(b.baseSymbol));
193
204
 
194
- log.debug('Got contracts from API', { count: results.length, totalMsgs: msgCount });
205
+ brokerLog('FrontMonth phase complete', { contractsFound: results.length, totalMsgs: msgCount });
195
206
  resolve(results);
196
207
  }, TIMEOUTS.RITHMIC_PRODUCTS);
197
208
  }, TIMEOUTS.RITHMIC_CONTRACTS);