hedgequantx 2.9.168 → 2.9.170
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
|
@@ -123,11 +123,33 @@ const fetchAllFrontMonths = (service) => {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// Handler for FrontMonth responses
|
|
126
|
+
let frontMonthMsgCount = 0;
|
|
127
|
+
let template114Count = 0;
|
|
128
|
+
const templateIdsSeen = new Map();
|
|
126
129
|
const frontMonthHandler = (msg) => {
|
|
127
130
|
msgCount++;
|
|
131
|
+
frontMonthMsgCount++;
|
|
132
|
+
|
|
133
|
+
// Track all templateIds seen
|
|
134
|
+
const tid = msg.templateId;
|
|
135
|
+
templateIdsSeen.set(tid, (templateIdsSeen.get(tid) || 0) + 1);
|
|
136
|
+
|
|
128
137
|
if (msg.templateId !== 114) return;
|
|
138
|
+
template114Count++;
|
|
129
139
|
|
|
130
140
|
const decoded = decodeFrontMonthContract(msg.data);
|
|
141
|
+
|
|
142
|
+
// Log first few responses to diagnose
|
|
143
|
+
if (template114Count <= 5) {
|
|
144
|
+
brokerLog('FrontMonth response', {
|
|
145
|
+
template114Count,
|
|
146
|
+
rpCode: decoded.rpCode,
|
|
147
|
+
tradingSymbol: decoded.tradingSymbol,
|
|
148
|
+
userMsg: decoded.userMsg,
|
|
149
|
+
exchange: decoded.exchange
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
131
153
|
if (decoded.rpCode[0] === '0' && decoded.tradingSymbol) {
|
|
132
154
|
contracts.set(decoded.userMsg, {
|
|
133
155
|
symbol: decoded.tradingSymbol,
|
|
@@ -165,6 +187,7 @@ const fetchAllFrontMonths = (service) => {
|
|
|
165
187
|
brokerLog('WARNING: No products collected - TICKER may not be responding', {});
|
|
166
188
|
}
|
|
167
189
|
|
|
190
|
+
let sentCount = 0;
|
|
168
191
|
for (const product of productsToCheck.values()) {
|
|
169
192
|
try {
|
|
170
193
|
service.tickerConn.send('RequestFrontMonthContract', {
|
|
@@ -173,10 +196,12 @@ const fetchAllFrontMonths = (service) => {
|
|
|
173
196
|
symbol: product.productCode,
|
|
174
197
|
exchange: product.exchange,
|
|
175
198
|
});
|
|
199
|
+
sentCount++;
|
|
176
200
|
} catch (err) {
|
|
177
201
|
brokerLog('Failed to send RequestFrontMonthContract', { product: product.productCode, error: err.message });
|
|
178
202
|
}
|
|
179
203
|
}
|
|
204
|
+
brokerLog('RequestFrontMonthContract sent', { sentCount, totalProducts: productsToCheck.size });
|
|
180
205
|
|
|
181
206
|
// Collect results after timeout
|
|
182
207
|
setTimeout(() => {
|
|
@@ -202,7 +227,18 @@ const fetchAllFrontMonths = (service) => {
|
|
|
202
227
|
// Sort alphabetically by base symbol
|
|
203
228
|
results.sort((a, b) => a.baseSymbol.localeCompare(b.baseSymbol));
|
|
204
229
|
|
|
205
|
-
|
|
230
|
+
// Convert Map to object for logging
|
|
231
|
+
const templateStats = {};
|
|
232
|
+
for (const [tid, count] of templateIdsSeen) {
|
|
233
|
+
templateStats[`t${tid}`] = count;
|
|
234
|
+
}
|
|
235
|
+
brokerLog('FrontMonth phase complete', {
|
|
236
|
+
contractsFound: results.length,
|
|
237
|
+
totalMsgs: msgCount,
|
|
238
|
+
frontMonthMsgs: frontMonthMsgCount,
|
|
239
|
+
template114Received: template114Count,
|
|
240
|
+
templateIds: templateStats
|
|
241
|
+
});
|
|
206
242
|
resolve(results);
|
|
207
243
|
}, TIMEOUTS.RITHMIC_PRODUCTS);
|
|
208
244
|
}, TIMEOUTS.RITHMIC_CONTRACTS);
|