hedgequantx 1.2.72 → 1.2.73
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 +28 -6
package/package.json
CHANGED
package/src/pages/algo.js
CHANGED
|
@@ -307,6 +307,8 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
307
307
|
let algoRunning = false;
|
|
308
308
|
let stopReason = null;
|
|
309
309
|
let latency = 0;
|
|
310
|
+
let spinnerFrame = 0;
|
|
311
|
+
const spinnerChars = ['\u280B', '\u2819', '\u2839', '\u2838', '\u283C', '\u2834', '\u2826', '\u2827', '\u2807', '\u280F'];
|
|
310
312
|
|
|
311
313
|
// Stats
|
|
312
314
|
let stats = {
|
|
@@ -509,19 +511,29 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
509
511
|
console.log(chalk.cyan(V) + row2 + chalk.cyan(V));
|
|
510
512
|
console.log(chalk.cyan(MID));
|
|
511
513
|
|
|
512
|
-
// Activity log header
|
|
513
|
-
|
|
514
|
+
// Activity log header with spinner and centered date
|
|
515
|
+
spinnerFrame = (spinnerFrame + 1) % spinnerChars.length;
|
|
516
|
+
const spinner = spinnerChars[spinnerFrame];
|
|
517
|
+
const actLeft = ` Activity Log ${chalk.cyan(spinner)}`;
|
|
518
|
+
const actLeftPlain = ` Activity Log ${spinner}`;
|
|
514
519
|
const actRight = 'Press X to stop ';
|
|
515
|
-
const
|
|
516
|
-
|
|
520
|
+
const dateCentered = `- ${dateStr} -`;
|
|
521
|
+
const leftLen = actLeftPlain.length;
|
|
522
|
+
const rightLen = actRight.length;
|
|
523
|
+
const midSpace = W - leftLen - rightLen;
|
|
524
|
+
const datePad = Math.floor((midSpace - dateCentered.length) / 2);
|
|
525
|
+
const dateSection = ' '.repeat(datePad) + chalk.gray(dateCentered) + ' '.repeat(midSpace - datePad - dateCentered.length);
|
|
526
|
+
console.log(chalk.cyan(V) + chalk.white(actLeft) + dateSection + chalk.yellow(actRight) + chalk.cyan(V));
|
|
517
527
|
console.log(chalk.cyan(BOT));
|
|
518
528
|
|
|
519
|
-
// Logs (without borders)
|
|
529
|
+
// Logs (without borders) - newest first
|
|
520
530
|
console.log();
|
|
521
531
|
if (logs.length === 0) {
|
|
522
532
|
console.log(chalk.gray(' Waiting for activity...'));
|
|
523
533
|
} else {
|
|
524
|
-
|
|
534
|
+
// Reverse to show newest first
|
|
535
|
+
const reversedLogs = [...logs].reverse();
|
|
536
|
+
reversedLogs.forEach(log => {
|
|
525
537
|
const color = typeColors[log.type] || chalk.white;
|
|
526
538
|
const icon = getIcon(log.type);
|
|
527
539
|
console.log(color(` [${log.timestamp}] ${icon} ${log.message}`));
|
|
@@ -529,6 +541,13 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
529
541
|
}
|
|
530
542
|
};
|
|
531
543
|
|
|
544
|
+
// Spinner interval to refresh UI
|
|
545
|
+
const spinnerInterval = setInterval(() => {
|
|
546
|
+
if (algoRunning) {
|
|
547
|
+
displayUI();
|
|
548
|
+
}
|
|
549
|
+
}, 100);
|
|
550
|
+
|
|
532
551
|
// Connect to HQX Server
|
|
533
552
|
const spinner = ora('Authenticating with HQX Server...').start();
|
|
534
553
|
|
|
@@ -703,6 +722,9 @@ const launchAlgo = async (service, account, contract, numContracts, dailyTarget,
|
|
|
703
722
|
}
|
|
704
723
|
});
|
|
705
724
|
|
|
725
|
+
// Clear spinner interval
|
|
726
|
+
clearInterval(spinnerInterval);
|
|
727
|
+
|
|
706
728
|
// Stop algo
|
|
707
729
|
console.log();
|
|
708
730
|
if (!stopReason) {
|