hedgequantx 2.6.79 → 2.6.81
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/one-account.js +2 -2
- package/src/pages/algo/ui.js +25 -21
package/package.json
CHANGED
|
@@ -981,8 +981,8 @@ const launchAlgo = async (service, account, contract, config) => {
|
|
|
981
981
|
};
|
|
982
982
|
|
|
983
983
|
// Start polling and UI refresh
|
|
984
|
-
// UI refreshes every
|
|
985
|
-
const refreshInterval = setInterval(() => { if (running) ui.render(stats); },
|
|
984
|
+
// UI refreshes every 1000ms (reduced to prevent flicker on VPS/SSH), P&L polling every 10s
|
|
985
|
+
const refreshInterval = setInterval(() => { if (running) ui.render(stats); }, 1000);
|
|
986
986
|
const pnlInterval = setInterval(() => { if (running) pollPnL(); }, 10000);
|
|
987
987
|
pollPnL(); // Initial poll
|
|
988
988
|
|
package/src/pages/algo/ui.js
CHANGED
|
@@ -329,19 +329,17 @@ class AlgoUI {
|
|
|
329
329
|
_drawLogs() {
|
|
330
330
|
const { W, logs, maxLogs } = this;
|
|
331
331
|
|
|
332
|
-
// Activity header - HF style
|
|
333
|
-
//
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
this.
|
|
337
|
-
this.lastSpinnerUpdate = now;
|
|
332
|
+
// Activity header - HF style (NO SPINNER/TIME - causes flicker on VPS/SSH)
|
|
333
|
+
// Date is cached on first draw to prevent changes
|
|
334
|
+
if (!this.cachedDate) {
|
|
335
|
+
const nowDate = new Date();
|
|
336
|
+
this.cachedDate = nowDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }).toUpperCase();
|
|
338
337
|
}
|
|
339
|
-
const
|
|
340
|
-
const nowDate = new Date();
|
|
341
|
-
const timeStr = nowDate.toLocaleTimeString('en-US', { hour12: false });
|
|
342
|
-
const dateStr = nowDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
|
338
|
+
const dateStr = this.cachedDate;
|
|
343
339
|
|
|
344
|
-
|
|
340
|
+
// Static indicator instead of spinner
|
|
341
|
+
const indicator = '●';
|
|
342
|
+
const leftText = ` EXECUTION LOG ${indicator}`;
|
|
345
343
|
const rightText = `[X] STOP `;
|
|
346
344
|
|
|
347
345
|
const totalFixed = leftText.length + rightText.length;
|
|
@@ -349,8 +347,8 @@ class AlgoUI {
|
|
|
349
347
|
const centerPadLeft = Math.floor((centerSpace - dateStr.length) / 2);
|
|
350
348
|
const centerPadRight = centerSpace - dateStr.length - centerPadLeft;
|
|
351
349
|
|
|
352
|
-
const left = ` ${chalk.bold('EXECUTION LOG')} ${chalk.
|
|
353
|
-
const center = ' '.repeat(Math.max(0, centerPadLeft)) + chalk.white.bold(dateStr
|
|
350
|
+
const left = ` ${chalk.bold('EXECUTION LOG')} ${chalk.green(indicator)}`;
|
|
351
|
+
const center = ' '.repeat(Math.max(0, centerPadLeft)) + chalk.white.bold(dateStr) + ' '.repeat(Math.max(0, centerPadRight));
|
|
354
352
|
const right = chalk.yellow.bold('[X] STOP') + ' ';
|
|
355
353
|
|
|
356
354
|
this._line(chalk.cyan(BOX.V) + chalk.white(left) + center + right + chalk.cyan(BOX.V));
|
|
@@ -388,7 +386,7 @@ class AlgoUI {
|
|
|
388
386
|
if (this.isDrawing) return;
|
|
389
387
|
this.isDrawing = true;
|
|
390
388
|
|
|
391
|
-
// Quick hash to detect meaningful changes
|
|
389
|
+
// Quick hash to detect meaningful changes
|
|
392
390
|
const statsHash = JSON.stringify({
|
|
393
391
|
pnl: stats.pnl,
|
|
394
392
|
openPnl: stats.openPnl,
|
|
@@ -412,8 +410,9 @@ class AlgoUI {
|
|
|
412
410
|
this.lines = [];
|
|
413
411
|
|
|
414
412
|
if (this.firstDraw) {
|
|
415
|
-
//
|
|
416
|
-
|
|
413
|
+
// Clear screen once, hide cursor
|
|
414
|
+
console.clear();
|
|
415
|
+
process.stdout.write('\x1B[?25l');
|
|
417
416
|
this.firstDraw = false;
|
|
418
417
|
}
|
|
419
418
|
|
|
@@ -422,13 +421,17 @@ class AlgoUI {
|
|
|
422
421
|
this._drawStats(stats);
|
|
423
422
|
this._drawLogs();
|
|
424
423
|
|
|
425
|
-
// Build output
|
|
424
|
+
// Build output
|
|
426
425
|
const output = this.lines.join('\n');
|
|
427
426
|
|
|
428
|
-
// Only write if content changed
|
|
427
|
+
// Only write if content changed
|
|
429
428
|
if (output !== this.lastOutput) {
|
|
430
|
-
//
|
|
431
|
-
|
|
429
|
+
// Write each line at fixed position (no full screen redraw)
|
|
430
|
+
const lines = this.lines;
|
|
431
|
+
for (let i = 0; i < lines.length; i++) {
|
|
432
|
+
// Move to line i+1, column 1, then write line and clear to end
|
|
433
|
+
process.stdout.write(`\x1B[${i + 1};1H${lines[i]}\x1B[K`);
|
|
434
|
+
}
|
|
432
435
|
this.lastOutput = output;
|
|
433
436
|
}
|
|
434
437
|
}
|
|
@@ -437,7 +440,8 @@ class AlgoUI {
|
|
|
437
440
|
}
|
|
438
441
|
|
|
439
442
|
cleanup() {
|
|
440
|
-
process.stdout.write('\x1B[?
|
|
443
|
+
process.stdout.write('\x1B[?25h');
|
|
444
|
+
console.clear();
|
|
441
445
|
}
|
|
442
446
|
}
|
|
443
447
|
|