hedgequantx 1.2.114 → 1.2.116
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 +33 -98
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -207,124 +207,59 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
} catch (e) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
for (const micro of microContracts) {
|
|
214
|
-
const hasMicro = availableSymbols.some(s =>
|
|
215
|
-
(s.symbol && s.symbol.toUpperCase().startsWith(micro.symbol)) ||
|
|
216
|
-
(s.name && s.name.toUpperCase().includes(micro.symbol))
|
|
217
|
-
);
|
|
218
|
-
if (!hasMicro) {
|
|
219
|
-
// Add micro contract with front month
|
|
220
|
-
availableSymbols.push({
|
|
221
|
-
id: `${micro.symbol}${currentMonthCode}${yearCode}`,
|
|
222
|
-
name: `${micro.symbol}${currentMonthCode}${yearCode}`,
|
|
223
|
-
symbol: `${micro.symbol}${currentMonthCode}${yearCode}`,
|
|
224
|
-
description: micro.name,
|
|
225
|
-
exchange: 'CME'
|
|
226
|
-
});
|
|
227
|
-
}
|
|
210
|
+
spinner.fail('Failed to load symbols from API: ' + e.message);
|
|
211
|
+
return;
|
|
228
212
|
}
|
|
229
213
|
|
|
230
|
-
//
|
|
214
|
+
// Only use REAL data from API - no mock/static data
|
|
231
215
|
if (availableSymbols.length === 0) {
|
|
232
|
-
spinner.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
name: s.name,
|
|
236
|
-
symbol: s.value,
|
|
237
|
-
searchText: s.searchText
|
|
238
|
-
}));
|
|
239
|
-
} else {
|
|
240
|
-
spinner.succeed(`Found ${availableSymbols.length} available contracts`);
|
|
216
|
+
spinner.fail('No contracts available from API');
|
|
217
|
+
console.log(chalk.red(' Please check your connection and try again'));
|
|
218
|
+
return;
|
|
241
219
|
}
|
|
242
220
|
|
|
243
|
-
|
|
221
|
+
spinner.succeed(`Found ${availableSymbols.length} available contracts`);
|
|
244
222
|
|
|
245
|
-
|
|
246
|
-
const symbolDescriptions = {
|
|
247
|
-
'NQ': 'E-mini NASDAQ-100',
|
|
248
|
-
'MNQ': 'Micro E-mini NASDAQ-100',
|
|
249
|
-
'ES': 'E-mini S&P 500',
|
|
250
|
-
'MES': 'Micro E-mini S&P 500',
|
|
251
|
-
'YM': 'E-mini Dow Jones',
|
|
252
|
-
'MYM': 'Micro E-mini Dow Jones',
|
|
253
|
-
'RTY': 'E-mini Russell 2000',
|
|
254
|
-
'M2K': 'Micro E-mini Russell 2000',
|
|
255
|
-
'CL': 'Crude Oil WTI',
|
|
256
|
-
'MCL': 'Micro Crude Oil',
|
|
257
|
-
'NG': 'Natural Gas',
|
|
258
|
-
'QG': 'E-mini Natural Gas',
|
|
259
|
-
'QM': 'E-mini Crude Oil',
|
|
260
|
-
'GC': 'Gold',
|
|
261
|
-
'MGC': 'Micro Gold',
|
|
262
|
-
'SI': 'Silver',
|
|
263
|
-
'SIL': 'Micro Silver',
|
|
264
|
-
'HG': 'Copper',
|
|
265
|
-
'PL': 'Platinum',
|
|
266
|
-
'6E': 'Euro FX',
|
|
267
|
-
'M6E': 'Micro Euro FX',
|
|
268
|
-
'6B': 'British Pound',
|
|
269
|
-
'6J': 'Japanese Yen',
|
|
270
|
-
'6A': 'Australian Dollar',
|
|
271
|
-
'6C': 'Canadian Dollar',
|
|
272
|
-
'6M': 'Mexican Peso',
|
|
273
|
-
'6S': 'Swiss Franc',
|
|
274
|
-
'ZB': '30-Year T-Bond',
|
|
275
|
-
'ZN': '10-Year T-Note',
|
|
276
|
-
'ZF': '5-Year T-Note',
|
|
277
|
-
'ZT': '2-Year T-Note',
|
|
278
|
-
'ZC': 'Corn',
|
|
279
|
-
'ZS': 'Soybeans',
|
|
280
|
-
'ZW': 'Wheat'
|
|
281
|
-
};
|
|
223
|
+
console.log();
|
|
282
224
|
|
|
283
|
-
// Format symbols for display -
|
|
284
|
-
const
|
|
225
|
+
// Format symbols for display - show ALL contracts from API (REAL DATA ONLY)
|
|
226
|
+
const seenIds = new Set();
|
|
285
227
|
const symbolChoices = [];
|
|
286
228
|
|
|
287
|
-
for (const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const baseMatch = symbolCode.match(/^([A-Z0-9]{1,4})([FGHJKMNQUVXZ])(\d{1,2})$/i);
|
|
293
|
-
let baseSymbol = symbolCode;
|
|
294
|
-
let monthYear = '';
|
|
229
|
+
for (const contract of availableSymbols) {
|
|
230
|
+
// Skip duplicates by contract ID
|
|
231
|
+
const contractId = contract.id || '';
|
|
232
|
+
if (seenIds.has(contractId)) continue;
|
|
233
|
+
seenIds.add(contractId);
|
|
295
234
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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);
|
|
235
|
+
// Get the symbol code from API - 'name' field contains code like "NQH6"
|
|
236
|
+
const symbolCode = contract.name || contract.symbol || '';
|
|
237
|
+
if (!symbolCode) continue;
|
|
308
238
|
|
|
309
|
-
// Get description
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
description = symbol.description.split(':')[0].trim();
|
|
239
|
+
// Get description from API ONLY
|
|
240
|
+
let description = contract.description || '';
|
|
241
|
+
if (description.includes(':')) {
|
|
242
|
+
// API format: "E-mini NASDAQ-100: March 2026" -> keep full description
|
|
243
|
+
description = description.trim();
|
|
315
244
|
}
|
|
316
245
|
if (!description) {
|
|
317
|
-
description =
|
|
246
|
+
description = symbolCode; // Fallback to symbol code if no description
|
|
318
247
|
}
|
|
319
248
|
|
|
320
|
-
// Format: "NQH6 E-mini NASDAQ-100"
|
|
321
|
-
// Show full symbol code so user knows exactly what they're trading
|
|
249
|
+
// Format: "NQH6 E-mini NASDAQ-100: March 2026"
|
|
322
250
|
symbolChoices.push({
|
|
323
251
|
name: chalk.yellow(symbolCode.padEnd(12)) + chalk.white(description),
|
|
324
|
-
value:
|
|
252
|
+
value: contract
|
|
325
253
|
});
|
|
326
254
|
}
|
|
327
255
|
|
|
256
|
+
// Sort by symbol code for better organization
|
|
257
|
+
symbolChoices.sort((a, b) => {
|
|
258
|
+
const aCode = a.value.name || a.value.symbol || '';
|
|
259
|
+
const bCode = b.value.name || b.value.symbol || '';
|
|
260
|
+
return aCode.localeCompare(bCode);
|
|
261
|
+
});
|
|
262
|
+
|
|
328
263
|
symbolChoices.push(new inquirer.Separator());
|
|
329
264
|
symbolChoices.push({ name: chalk.yellow('< Back'), value: 'back' });
|
|
330
265
|
|