hedgequantx 1.2.94 → 1.2.96
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 +59 -14
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -203,13 +203,50 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
203
203
|
|
|
204
204
|
console.log();
|
|
205
205
|
|
|
206
|
+
// Symbol name descriptions
|
|
207
|
+
const symbolDescriptions = {
|
|
208
|
+
'NQ': 'E-mini NASDAQ-100',
|
|
209
|
+
'MNQ': 'Micro E-mini NASDAQ-100',
|
|
210
|
+
'ES': 'E-mini S&P 500',
|
|
211
|
+
'MES': 'Micro E-mini S&P 500',
|
|
212
|
+
'YM': 'E-mini Dow Jones',
|
|
213
|
+
'MYM': 'Micro E-mini Dow Jones',
|
|
214
|
+
'RTY': 'E-mini Russell 2000',
|
|
215
|
+
'M2K': 'Micro E-mini Russell 2000',
|
|
216
|
+
'CL': 'Crude Oil WTI',
|
|
217
|
+
'MCL': 'Micro Crude Oil',
|
|
218
|
+
'NG': 'Natural Gas',
|
|
219
|
+
'QG': 'E-mini Natural Gas',
|
|
220
|
+
'QM': 'E-mini Crude Oil',
|
|
221
|
+
'GC': 'Gold',
|
|
222
|
+
'MGC': 'Micro Gold',
|
|
223
|
+
'SI': 'Silver',
|
|
224
|
+
'SIL': 'Micro Silver',
|
|
225
|
+
'HG': 'Copper',
|
|
226
|
+
'PL': 'Platinum',
|
|
227
|
+
'6E': 'Euro FX',
|
|
228
|
+
'M6E': 'Micro Euro FX',
|
|
229
|
+
'6B': 'British Pound',
|
|
230
|
+
'6J': 'Japanese Yen',
|
|
231
|
+
'6A': 'Australian Dollar',
|
|
232
|
+
'6C': 'Canadian Dollar',
|
|
233
|
+
'6M': 'Mexican Peso',
|
|
234
|
+
'6S': 'Swiss Franc',
|
|
235
|
+
'ZB': '30-Year T-Bond',
|
|
236
|
+
'ZN': '10-Year T-Note',
|
|
237
|
+
'ZF': '5-Year T-Note',
|
|
238
|
+
'ZT': '2-Year T-Note',
|
|
239
|
+
'ZC': 'Corn',
|
|
240
|
+
'ZS': 'Soybeans',
|
|
241
|
+
'ZW': 'Wheat'
|
|
242
|
+
};
|
|
243
|
+
|
|
206
244
|
// Format symbols for display
|
|
207
245
|
const symbolChoices = availableSymbols.map(symbol => {
|
|
208
|
-
const name = symbol.name || symbol.symbol || symbol.id;
|
|
209
246
|
const symbolCode = symbol.symbol || symbol.id || '';
|
|
210
247
|
|
|
211
248
|
// Extract base symbol (e.g., NQ from NQH6) and month code
|
|
212
|
-
const baseMatch = symbolCode.match(/^([A-
|
|
249
|
+
const baseMatch = symbolCode.match(/^([A-Z0-9]{1,4})([FGHJKMNQUVXZ])(\d{1,2})$/i);
|
|
213
250
|
let baseSymbol = symbolCode;
|
|
214
251
|
let monthYear = '';
|
|
215
252
|
|
|
@@ -221,9 +258,12 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
221
258
|
monthYear = (monthCodes[monthCode] || monthCode) + year;
|
|
222
259
|
}
|
|
223
260
|
|
|
224
|
-
//
|
|
261
|
+
// Get descriptive name from mapping
|
|
262
|
+
const description = symbolDescriptions[baseSymbol] || symbol.name || baseSymbol;
|
|
263
|
+
|
|
264
|
+
// Format: "NQ Mar26 E-mini NASDAQ-100"
|
|
225
265
|
return {
|
|
226
|
-
name: chalk.yellow(baseSymbol.padEnd(5)) + chalk.cyan(monthYear.padEnd(7)) + chalk.white(
|
|
266
|
+
name: chalk.yellow(baseSymbol.padEnd(5)) + chalk.cyan(monthYear.padEnd(7)) + chalk.white(description),
|
|
227
267
|
value: symbol
|
|
228
268
|
};
|
|
229
269
|
});
|
|
@@ -604,26 +644,31 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
604
644
|
console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
|
|
605
645
|
console.log(chalk.cyan(BOT));
|
|
606
646
|
|
|
607
|
-
// Logs (without borders) - newest first
|
|
647
|
+
// Logs (without borders) - newest first, fixed number of lines
|
|
648
|
+
const MAX_VISIBLE_LOGS = 15;
|
|
608
649
|
console.log();
|
|
650
|
+
|
|
609
651
|
if (logs.length === 0) {
|
|
610
|
-
console.log(chalk.gray(' Waiting for activity...') + '\x1B[K');
|
|
652
|
+
console.log(chalk.gray(' Waiting for activity...') + '\x1B[K');
|
|
653
|
+
// Fill remaining lines with empty
|
|
654
|
+
for (let i = 0; i < MAX_VISIBLE_LOGS - 1; i++) {
|
|
655
|
+
console.log('\x1B[K');
|
|
656
|
+
}
|
|
611
657
|
} else {
|
|
612
|
-
//
|
|
613
|
-
const reversedLogs = [...logs].reverse();
|
|
658
|
+
// Show newest first (reverse), limited to MAX_VISIBLE_LOGS
|
|
659
|
+
const reversedLogs = [...logs].reverse().slice(0, MAX_VISIBLE_LOGS);
|
|
614
660
|
reversedLogs.forEach(log => {
|
|
615
661
|
const color = typeColors[log.type] || chalk.white;
|
|
616
662
|
const icon = getIcon(log.type);
|
|
617
|
-
// Pad message and clear to end of line to avoid artifacts
|
|
618
663
|
const logLine = ` [${log.timestamp}] ${icon} ${log.message}`;
|
|
619
664
|
console.log(color(logLine) + '\x1B[K');
|
|
620
665
|
});
|
|
666
|
+
// Fill remaining lines with empty to keep fixed height
|
|
667
|
+
for (let i = reversedLogs.length; i < MAX_VISIBLE_LOGS; i++) {
|
|
668
|
+
console.log('\x1B[K');
|
|
669
|
+
}
|
|
621
670
|
}
|
|
622
|
-
//
|
|
623
|
-
for (let i = 0; i < 30; i++) {
|
|
624
|
-
console.log('\x1B[K');
|
|
625
|
-
}
|
|
626
|
-
// Clear remaining lines below
|
|
671
|
+
// Clear anything below
|
|
627
672
|
process.stdout.write('\x1B[J');
|
|
628
673
|
};
|
|
629
674
|
|