hedgequantx 1.2.88 → 1.2.90
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 +20 -3
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -455,8 +455,17 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
// Display full UI with logs (newest first at top)
|
|
458
|
+
// Use ANSI escape codes to avoid flickering
|
|
459
|
+
let firstDraw = true;
|
|
458
460
|
const displayUI = () => {
|
|
459
|
-
|
|
461
|
+
// First time: clear screen, after: just move cursor to top
|
|
462
|
+
if (firstDraw) {
|
|
463
|
+
console.clear();
|
|
464
|
+
firstDraw = false;
|
|
465
|
+
} else {
|
|
466
|
+
// Move cursor to top-left without clearing (avoids flicker)
|
|
467
|
+
process.stdout.write('\x1B[H');
|
|
468
|
+
}
|
|
460
469
|
|
|
461
470
|
// Stats
|
|
462
471
|
const pnlColor = stats.pnl >= 0 ? chalk.green : chalk.red;
|
|
@@ -584,16 +593,24 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
584
593
|
// Logs (without borders) - newest first
|
|
585
594
|
console.log();
|
|
586
595
|
if (logs.length === 0) {
|
|
587
|
-
console.log(chalk.gray(' Waiting for activity...'));
|
|
596
|
+
console.log(chalk.gray(' Waiting for activity...') + '\x1B[K'); // Clear to end of line
|
|
588
597
|
} else {
|
|
589
598
|
// Reverse to show newest first
|
|
590
599
|
const reversedLogs = [...logs].reverse();
|
|
591
600
|
reversedLogs.forEach(log => {
|
|
592
601
|
const color = typeColors[log.type] || chalk.white;
|
|
593
602
|
const icon = getIcon(log.type);
|
|
594
|
-
|
|
603
|
+
// Pad message and clear to end of line to avoid artifacts
|
|
604
|
+
const logLine = ` [${log.timestamp}] ${icon} ${log.message}`;
|
|
605
|
+
console.log(color(logLine) + '\x1B[K');
|
|
595
606
|
});
|
|
596
607
|
}
|
|
608
|
+
// Add 30 empty lines so old logs scroll down further
|
|
609
|
+
for (let i = 0; i < 30; i++) {
|
|
610
|
+
console.log('\x1B[K');
|
|
611
|
+
}
|
|
612
|
+
// Clear remaining lines below
|
|
613
|
+
process.stdout.write('\x1B[J');
|
|
597
614
|
};
|
|
598
615
|
|
|
599
616
|
// Spinner interval to refresh UI
|