hedgequantx 2.9.169 → 2.9.171
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
|
@@ -125,9 +125,15 @@ const fetchAllFrontMonths = (service) => {
|
|
|
125
125
|
// Handler for FrontMonth responses
|
|
126
126
|
let frontMonthMsgCount = 0;
|
|
127
127
|
let template114Count = 0;
|
|
128
|
+
const templateIdsSeen = new Map();
|
|
128
129
|
const frontMonthHandler = (msg) => {
|
|
129
130
|
msgCount++;
|
|
130
131
|
frontMonthMsgCount++;
|
|
132
|
+
|
|
133
|
+
// Track all templateIds seen
|
|
134
|
+
const tid = msg.templateId;
|
|
135
|
+
templateIdsSeen.set(tid, (templateIdsSeen.get(tid) || 0) + 1);
|
|
136
|
+
|
|
131
137
|
if (msg.templateId !== 114) return;
|
|
132
138
|
template114Count++;
|
|
133
139
|
|
|
@@ -182,20 +188,35 @@ const fetchAllFrontMonths = (service) => {
|
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
let sentCount = 0;
|
|
185
|
-
|
|
191
|
+
let sendErrors = [];
|
|
192
|
+
// Only send for first 5 products to test
|
|
193
|
+
const productsArray = Array.from(productsToCheck.values());
|
|
194
|
+
const testProducts = productsArray.slice(0, 60); // Limit to 60 for testing
|
|
195
|
+
|
|
196
|
+
for (const product of testProducts) {
|
|
186
197
|
try {
|
|
187
|
-
|
|
198
|
+
const reqData = {
|
|
188
199
|
templateId: 113,
|
|
189
200
|
userMsg: [product.productCode],
|
|
190
201
|
symbol: product.productCode,
|
|
191
202
|
exchange: product.exchange,
|
|
192
|
-
}
|
|
203
|
+
};
|
|
204
|
+
// Log first request
|
|
205
|
+
if (sentCount === 0) {
|
|
206
|
+
brokerLog('First RequestFrontMonthContract', reqData);
|
|
207
|
+
}
|
|
208
|
+
service.tickerConn.send('RequestFrontMonthContract', reqData);
|
|
193
209
|
sentCount++;
|
|
194
210
|
} catch (err) {
|
|
195
|
-
|
|
211
|
+
sendErrors.push({ product: product.productCode, error: err.message });
|
|
196
212
|
}
|
|
197
213
|
}
|
|
198
|
-
brokerLog('RequestFrontMonthContract sent', {
|
|
214
|
+
brokerLog('RequestFrontMonthContract sent', {
|
|
215
|
+
sentCount,
|
|
216
|
+
totalProducts: productsToCheck.size,
|
|
217
|
+
limitedTo: testProducts.length,
|
|
218
|
+
errors: sendErrors.length > 0 ? sendErrors.slice(0, 3) : 'none'
|
|
219
|
+
});
|
|
199
220
|
|
|
200
221
|
// Collect results after timeout
|
|
201
222
|
setTimeout(() => {
|
|
@@ -221,11 +242,17 @@ const fetchAllFrontMonths = (service) => {
|
|
|
221
242
|
// Sort alphabetically by base symbol
|
|
222
243
|
results.sort((a, b) => a.baseSymbol.localeCompare(b.baseSymbol));
|
|
223
244
|
|
|
245
|
+
// Convert Map to object for logging
|
|
246
|
+
const templateStats = {};
|
|
247
|
+
for (const [tid, count] of templateIdsSeen) {
|
|
248
|
+
templateStats[`t${tid}`] = count;
|
|
249
|
+
}
|
|
224
250
|
brokerLog('FrontMonth phase complete', {
|
|
225
251
|
contractsFound: results.length,
|
|
226
252
|
totalMsgs: msgCount,
|
|
227
253
|
frontMonthMsgs: frontMonthMsgCount,
|
|
228
|
-
template114Received: template114Count
|
|
254
|
+
template114Received: template114Count,
|
|
255
|
+
templateIds: templateStats
|
|
229
256
|
});
|
|
230
257
|
resolve(results);
|
|
231
258
|
}, TIMEOUTS.RITHMIC_PRODUCTS);
|