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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pages/algo.js +33 -98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.114",
3
+ "version": "1.2.116",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/pages/algo.js CHANGED
@@ -207,124 +207,59 @@ const selectSymbolMenu = async (service, account) => {
207
207
  }
208
208
  }
209
209
  } catch (e) {
210
- // Fallback to static list
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
- // If no symbols found from API, use static list
214
+ // Only use REAL data from API - no mock/static data
231
215
  if (availableSymbols.length === 0) {
232
- spinner.warn('Using default symbol list');
233
- availableSymbols = FUTURES_SYMBOLS.map(s => ({
234
- id: s.value,
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
- console.log();
221
+ spinner.succeed(`Found ${availableSymbols.length} available contracts`);
244
222
 
245
- // Symbol name descriptions
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 - deduplicate by base symbol + month
284
- const seenSymbols = new Set();
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 symbol of availableSymbols) {
288
- const symbolCode = symbol.symbol || symbol.name || symbol.id || '';
289
-
290
- // Extract base symbol (e.g., NQ from NQH6) and month code
291
- // Handles: NQH6, MNQH6, ESH26, MESH26, etc.
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
- if (baseMatch) {
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);
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: prefer API description, then our mapping, then symbol name
310
- // API description format: "E-mini NASDAQ-100: March 2026"
311
- let description = '';
312
- if (symbol.description) {
313
- // Extract just the instrument name (before the colon)
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 = symbolDescriptions[baseSymbol] || baseSymbol;
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: symbol
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