hedgequantx 1.2.114 → 1.2.115
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 +1 -1
- package/src/pages/algo.js +28 -30
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -280,51 +280,49 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
280
280
|
'ZW': 'Wheat'
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
// Format symbols for display -
|
|
284
|
-
const
|
|
283
|
+
// Format symbols for display - show ALL contracts from API
|
|
284
|
+
const seenIds = new Set();
|
|
285
285
|
const symbolChoices = [];
|
|
286
286
|
|
|
287
|
-
for (const
|
|
288
|
-
|
|
287
|
+
for (const contract of availableSymbols) {
|
|
288
|
+
// Skip duplicates by contract ID
|
|
289
|
+
const contractId = contract.id || '';
|
|
290
|
+
if (seenIds.has(contractId)) continue;
|
|
291
|
+
seenIds.add(contractId);
|
|
289
292
|
|
|
290
|
-
//
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
let baseSymbol = symbolCode;
|
|
294
|
-
let monthYear = '';
|
|
293
|
+
// Get the symbol code - API returns 'name' field with code like "NQH6"
|
|
294
|
+
const symbolCode = contract.name || contract.symbol || '';
|
|
295
|
+
if (!symbolCode) continue;
|
|
295
296
|
|
|
296
|
-
|
|
297
|
-
baseSymbol = baseMatch[1];
|
|
298
|
-
const monthCodes = { F: 'Jan', G: 'Feb', H: 'Mar', J: 'Apr', K: 'May', M: 'Jun', N: 'Jul', Q: 'Aug', U: 'Sep', V: 'Oct', X: 'Nov', Z: 'Dec' };
|
|
299
|
-
const monthCode = baseMatch[2].toUpperCase();
|
|
300
|
-
const year = baseMatch[3].length === 1 ? '2' + baseMatch[3] : baseMatch[3];
|
|
301
|
-
monthYear = (monthCodes[monthCode] || monthCode) + year;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Create unique key to deduplicate
|
|
305
|
-
const uniqueKey = `${baseSymbol}-${monthYear}`;
|
|
306
|
-
if (seenSymbols.has(uniqueKey)) continue;
|
|
307
|
-
seenSymbols.add(uniqueKey);
|
|
308
|
-
|
|
309
|
-
// Get description: prefer API description, then our mapping, then symbol name
|
|
310
|
-
// API description format: "E-mini NASDAQ-100: March 2026"
|
|
297
|
+
// Get description from API or our mapping
|
|
311
298
|
let description = '';
|
|
312
|
-
if (
|
|
313
|
-
//
|
|
314
|
-
description =
|
|
299
|
+
if (contract.description) {
|
|
300
|
+
// API format: "E-mini NASDAQ-100: March 2026" -> extract instrument name
|
|
301
|
+
description = contract.description.split(':')[0].trim();
|
|
315
302
|
}
|
|
303
|
+
|
|
304
|
+
// Fallback to our symbol descriptions
|
|
316
305
|
if (!description) {
|
|
317
|
-
|
|
306
|
+
// Extract base symbol (NQ from NQH6)
|
|
307
|
+
const baseMatch = symbolCode.match(/^([A-Z0-9]{1,4})[FGHJKMNQUVXZ]\d{1,2}$/i);
|
|
308
|
+
const baseSymbol = baseMatch ? baseMatch[1] : symbolCode;
|
|
309
|
+
description = symbolDescriptions[baseSymbol] || symbolCode;
|
|
318
310
|
}
|
|
319
311
|
|
|
320
312
|
// Format: "NQH6 E-mini NASDAQ-100"
|
|
321
|
-
// Show full symbol code so user knows exactly what they're trading
|
|
322
313
|
symbolChoices.push({
|
|
323
314
|
name: chalk.yellow(symbolCode.padEnd(12)) + chalk.white(description),
|
|
324
|
-
value:
|
|
315
|
+
value: contract
|
|
325
316
|
});
|
|
326
317
|
}
|
|
327
318
|
|
|
319
|
+
// Sort by symbol code for better organization
|
|
320
|
+
symbolChoices.sort((a, b) => {
|
|
321
|
+
const aCode = a.value.name || a.value.symbol || '';
|
|
322
|
+
const bCode = b.value.name || b.value.symbol || '';
|
|
323
|
+
return aCode.localeCompare(bCode);
|
|
324
|
+
});
|
|
325
|
+
|
|
328
326
|
symbolChoices.push(new inquirer.Separator());
|
|
329
327
|
symbolChoices.push({ name: chalk.yellow('< Back'), value: 'back' });
|
|
330
328
|
|