Speed up CTP account display: refresh equity on fast snapshot without waiting for full position sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-01 15:02:37 +08:00
parent a34bcb6bfc
commit 658982d2b9
3 changed files with 101 additions and 14 deletions
+5 -1
View File
@@ -264,7 +264,7 @@
posFastPollTimer = setInterval(function () {
pollPositions();
posFastPollCount += 1;
if (posFastPollCount >= 90) stopPosFastPoll();
if (posFastPollCount >= 120) stopPosFastPoll();
}, 1000);
}
@@ -272,6 +272,10 @@
if (!data) return;
var cap = document.getElementById('cap-display');
if (cap && data.capital != null) cap.textContent = Number(data.capital).toFixed(2);
var avail = document.getElementById('avail-display');
if (avail && data.account_available != null) {
avail.textContent = Number(data.account_available).toFixed(2);
}
var connected = data.ctp_status && data.ctp_status.connected;
var connecting = data.ctp_status && data.ctp_status.connecting;
var cooldownSec = (data.ctp_status && data.ctp_status.login_cooldown_sec) || 0;