hedgequantx 1.2.93 → 1.2.95
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 +30 -18
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -205,18 +205,25 @@ const selectSymbolMenu = async (service, account) => {
|
|
|
205
205
|
|
|
206
206
|
// Format symbols for display
|
|
207
207
|
const symbolChoices = availableSymbols.map(symbol => {
|
|
208
|
-
// Extract short code and description
|
|
209
208
|
const name = symbol.name || symbol.symbol || symbol.id;
|
|
210
|
-
|
|
211
|
-
let displayName = name;
|
|
212
|
-
let code = symbol.symbol || '';
|
|
209
|
+
const symbolCode = symbol.symbol || symbol.id || '';
|
|
213
210
|
|
|
214
|
-
//
|
|
215
|
-
const
|
|
216
|
-
|
|
211
|
+
// Extract base symbol (e.g., NQ from NQH6) and month code
|
|
212
|
+
const baseMatch = symbolCode.match(/^([A-Z]{1,4})([FGHJKMNQUVXZ])(\d{1,2})$/i);
|
|
213
|
+
let baseSymbol = symbolCode;
|
|
214
|
+
let monthYear = '';
|
|
217
215
|
|
|
216
|
+
if (baseMatch) {
|
|
217
|
+
baseSymbol = baseMatch[1];
|
|
218
|
+
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' };
|
|
219
|
+
const monthCode = baseMatch[2].toUpperCase();
|
|
220
|
+
const year = baseMatch[3].length === 1 ? '2' + baseMatch[3] : baseMatch[3];
|
|
221
|
+
monthYear = (monthCodes[monthCode] || monthCode) + year;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Format: "NQ Mar26 E-mini NASDAQ-100 Mar26"
|
|
218
225
|
return {
|
|
219
|
-
name: chalk.yellow(
|
|
226
|
+
name: chalk.yellow(baseSymbol.padEnd(5)) + chalk.cyan(monthYear.padEnd(7)) + chalk.white(name),
|
|
220
227
|
value: symbol
|
|
221
228
|
};
|
|
222
229
|
});
|
|
@@ -597,26 +604,31 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
597
604
|
console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
|
|
598
605
|
console.log(chalk.cyan(BOT));
|
|
599
606
|
|
|
600
|
-
// Logs (without borders) - newest first
|
|
607
|
+
// Logs (without borders) - newest first, fixed number of lines
|
|
608
|
+
const MAX_VISIBLE_LOGS = 15;
|
|
601
609
|
console.log();
|
|
610
|
+
|
|
602
611
|
if (logs.length === 0) {
|
|
603
|
-
console.log(chalk.gray(' Waiting for activity...') + '\x1B[K');
|
|
612
|
+
console.log(chalk.gray(' Waiting for activity...') + '\x1B[K');
|
|
613
|
+
// Fill remaining lines with empty
|
|
614
|
+
for (let i = 0; i < MAX_VISIBLE_LOGS - 1; i++) {
|
|
615
|
+
console.log('\x1B[K');
|
|
616
|
+
}
|
|
604
617
|
} else {
|
|
605
|
-
//
|
|
606
|
-
const reversedLogs = [...logs].reverse();
|
|
618
|
+
// Show newest first (reverse), limited to MAX_VISIBLE_LOGS
|
|
619
|
+
const reversedLogs = [...logs].reverse().slice(0, MAX_VISIBLE_LOGS);
|
|
607
620
|
reversedLogs.forEach(log => {
|
|
608
621
|
const color = typeColors[log.type] || chalk.white;
|
|
609
622
|
const icon = getIcon(log.type);
|
|
610
|
-
// Pad message and clear to end of line to avoid artifacts
|
|
611
623
|
const logLine = ` [${log.timestamp}] ${icon} ${log.message}`;
|
|
612
624
|
console.log(color(logLine) + '\x1B[K');
|
|
613
625
|
});
|
|
626
|
+
// Fill remaining lines with empty to keep fixed height
|
|
627
|
+
for (let i = reversedLogs.length; i < MAX_VISIBLE_LOGS; i++) {
|
|
628
|
+
console.log('\x1B[K');
|
|
629
|
+
}
|
|
614
630
|
}
|
|
615
|
-
//
|
|
616
|
-
for (let i = 0; i < 30; i++) {
|
|
617
|
-
console.log('\x1B[K');
|
|
618
|
-
}
|
|
619
|
-
// Clear remaining lines below
|
|
631
|
+
// Clear anything below
|
|
620
632
|
process.stdout.write('\x1B[J');
|
|
621
633
|
};
|
|
622
634
|
|