hedgequantx 2.6.76 → 2.6.78
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
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 250ms, P&L polling every 10s
|
|
985
|
-
const refreshInterval = setInterval(() => { if (running) ui.render(stats); },
|
|
984
|
+
// UI refreshes every 500ms (reduced from 250ms to prevent flicker), P&L polling every 10s
|
|
985
|
+
const refreshInterval = setInterval(() => { if (running) ui.render(stats); }, 500);
|
|
986
986
|
const pnlInterval = setInterval(() => { if (running) pollPnL(); }, 10000);
|
|
987
987
|
pollPnL(); // Initial poll
|
|
988
988
|
|
package/src/pages/algo/ui.js
CHANGED
|
@@ -141,7 +141,8 @@ class AlgoUI {
|
|
|
141
141
|
this.spinnerFrame = 0;
|
|
142
142
|
this.firstDraw = true;
|
|
143
143
|
this.isDrawing = false;
|
|
144
|
-
this.
|
|
144
|
+
this.lines = [];
|
|
145
|
+
this.lastOutput = '';
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
addLog(type, message) {
|
|
@@ -151,7 +152,7 @@ class AlgoUI {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
_line(text) {
|
|
154
|
-
this.
|
|
155
|
+
this.lines.push(text);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
_drawHeader() {
|
|
@@ -379,20 +380,29 @@ class AlgoUI {
|
|
|
379
380
|
if (this.isDrawing) return;
|
|
380
381
|
this.isDrawing = true;
|
|
381
382
|
|
|
382
|
-
this.
|
|
383
|
+
this.lines = [];
|
|
383
384
|
|
|
384
385
|
if (this.firstDraw) {
|
|
385
|
-
|
|
386
|
+
// Enter alternate screen, hide cursor, clear once
|
|
387
|
+
process.stdout.write('\x1B[?1049h\x1B[?25l\x1B[2J');
|
|
386
388
|
this.firstDraw = false;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
|
-
this.buffer += '\x1B[H';
|
|
390
391
|
this._line('');
|
|
391
392
|
this._drawHeader();
|
|
392
393
|
this._drawStats(stats);
|
|
393
394
|
this._drawLogs();
|
|
394
395
|
|
|
395
|
-
|
|
396
|
+
// Build output with fixed line positions
|
|
397
|
+
const output = this.lines.join('\n');
|
|
398
|
+
|
|
399
|
+
// Only write if content changed (reduces flicker significantly)
|
|
400
|
+
if (output !== this.lastOutput) {
|
|
401
|
+
// Move cursor to home, then write all lines
|
|
402
|
+
process.stdout.write('\x1B[H' + output);
|
|
403
|
+
this.lastOutput = output;
|
|
404
|
+
}
|
|
405
|
+
|
|
396
406
|
this.isDrawing = false;
|
|
397
407
|
}
|
|
398
408
|
|