hedgequantx 1.2.112 → 1.2.114

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 +67 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.112",
3
+ "version": "1.2.114",
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
@@ -160,19 +160,17 @@ const selectSymbolMenu = async (service, account) => {
160
160
  let availableSymbols = [];
161
161
 
162
162
  // Search for common symbols to get available contracts (including micros)
163
+ // Use various search terms to find all contracts
163
164
  const commonSearches = [
164
- 'NQ', 'MNQ', // NASDAQ
165
- 'ES', 'MES', // S&P 500
166
- 'YM', 'MYM', // Dow Jones
167
- 'RTY', 'M2K', // Russell 2000
168
- 'CL', 'MCL', 'QM', // Crude Oil
169
- 'GC', 'MGC', // Gold
170
- 'SI', 'SIL', // Silver
171
- '6E', 'M6E', // Euro FX
172
- '6B', '6J', '6A', '6C', // Other currencies
173
- 'ZB', 'ZN', 'ZF', 'ZT', // Treasuries
174
- 'NG', 'QG', // Natural Gas
175
- 'HG', 'PL' // Copper, Platinum
165
+ 'NQ', 'ES', 'YM', 'RTY', // E-mini indices
166
+ 'Micro', 'MNQ', 'MES', 'MYM', 'M2K', // Micro indices (try multiple search terms)
167
+ 'CL', 'MCL', 'QM', // Crude Oil
168
+ 'GC', 'MGC', // Gold
169
+ 'SI', 'SIL', // Silver
170
+ '6E', 'M6E', '6B', '6J', '6A', '6C', // Currencies
171
+ 'ZB', 'ZN', 'ZF', 'ZT', // Treasuries
172
+ 'NG', 'QG', // Natural Gas
173
+ 'HG', 'PL' // Copper, Platinum
176
174
  ];
177
175
 
178
176
  try {
@@ -180,29 +178,31 @@ const selectSymbolMenu = async (service, account) => {
180
178
  const result = await service.searchContracts(search, false);
181
179
  if (result.success && result.contracts && result.contracts.length > 0) {
182
180
  for (const contract of result.contracts) {
183
- // Only add contracts that have valid data
184
- if (contract.id || contract.contractId || contract.name) {
185
- const contractId = contract.id || contract.contractId;
186
- const existing = availableSymbols.find(s => s.id === contractId);
187
- if (!existing) {
188
- // Extract symbol from name if not provided (e.g., "NQH6" from "CON.F.US.ENQ.H26")
189
- let symbolCode = contract.symbol || search;
190
- if (contract.name && contract.name.includes(' ')) {
191
- // Try to extract from name like "E-mini NASDAQ-100 Mar 2026"
192
- symbolCode = search;
193
- }
194
-
195
- availableSymbols.push({
196
- id: contractId,
197
- name: contract.name || contract.symbol || search,
198
- symbol: symbolCode,
199
- tickSize: contract.tickSize,
200
- tickValue: contract.tickValue,
201
- exchange: contract.exchange || 'CME',
202
- activeContract: contract.activeContract || false
203
- });
204
- }
205
- }
181
+ // ProjectX API returns:
182
+ // id: "CON.F.US.ENQ.H26" (contract ID)
183
+ // name: "NQH6" (short symbol with month/year)
184
+ // description: "E-mini NASDAQ-100: March 2026"
185
+
186
+ const contractId = contract.id || contract.contractId;
187
+ if (!contractId) continue;
188
+
189
+ const existing = availableSymbols.find(s => s.id === contractId);
190
+ if (existing) continue;
191
+
192
+ // Use 'name' field which contains the symbol code like "NQH6", "ESH6", "MNQH6"
193
+ const symbolCode = contract.name || contract.symbol || '';
194
+ if (!symbolCode) continue;
195
+
196
+ availableSymbols.push({
197
+ id: contractId,
198
+ name: symbolCode,
199
+ symbol: symbolCode,
200
+ description: contract.description || '',
201
+ tickSize: contract.tickSize,
202
+ tickValue: contract.tickValue,
203
+ exchange: contract.exchange || 'CME',
204
+ activeContract: contract.activeContract || false
205
+ });
206
206
  }
207
207
  }
208
208
  }
@@ -210,6 +210,23 @@ const selectSymbolMenu = async (service, account) => {
210
210
  // Fallback to static list
211
211
  }
212
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
+ }
228
+ }
229
+
213
230
  // If no symbols found from API, use static list
214
231
  if (availableSymbols.length === 0) {
215
232
  spinner.warn('Using default symbol list');
@@ -268,9 +285,10 @@ const selectSymbolMenu = async (service, account) => {
268
285
  const symbolChoices = [];
269
286
 
270
287
  for (const symbol of availableSymbols) {
271
- const symbolCode = symbol.symbol || symbol.id || '';
288
+ const symbolCode = symbol.symbol || symbol.name || symbol.id || '';
272
289
 
273
290
  // Extract base symbol (e.g., NQ from NQH6) and month code
291
+ // Handles: NQH6, MNQH6, ESH26, MESH26, etc.
274
292
  const baseMatch = symbolCode.match(/^([A-Z0-9]{1,4})([FGHJKMNQUVXZ])(\d{1,2})$/i);
275
293
  let baseSymbol = symbolCode;
276
294
  let monthYear = '';
@@ -288,13 +306,21 @@ const selectSymbolMenu = async (service, account) => {
288
306
  if (seenSymbols.has(uniqueKey)) continue;
289
307
  seenSymbols.add(uniqueKey);
290
308
 
291
- // Get descriptive name from mapping
292
- const description = symbolDescriptions[baseSymbol] || symbol.name || baseSymbol;
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();
315
+ }
316
+ if (!description) {
317
+ description = symbolDescriptions[baseSymbol] || baseSymbol;
318
+ }
293
319
 
294
- // Format: "NQ.Mar26 E-mini NASDAQ-100"
295
- const symbolDisplay = monthYear ? `${baseSymbol}.${monthYear}` : baseSymbol;
320
+ // Format: "NQH6 E-mini NASDAQ-100"
321
+ // Show full symbol code so user knows exactly what they're trading
296
322
  symbolChoices.push({
297
- name: chalk.yellow(symbolDisplay.padEnd(12)) + chalk.white(description),
323
+ name: chalk.yellow(symbolCode.padEnd(12)) + chalk.white(description),
298
324
  value: symbol
299
325
  });
300
326
  }