feat: single-row funds strip on header and system settings page

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 10:09:51 +08:00
parent e82fd15bb7
commit 75aa4b1391
10 changed files with 185 additions and 73 deletions
+11 -3
View File
@@ -1047,6 +1047,13 @@ function sumOrdersFloatPnl(orders){
return found ? total : null;
}
function formatOptionsFundingLabel(usdc, usdt) {
const parts = [];
if (usdc !== null && usdc !== undefined) parts.push(`${Number(usdc).toFixed(2)} USDC`);
if (usdt !== null && usdt !== undefined) parts.push(`${Number(usdt).toFixed(2)} USDT`);
return parts.length ? parts.join(" · ") : "—";
}
function refreshAccountSnapshot(){
fetch("/api/account_snapshot").then(r=>r.json()).then(data=>{
if (typeof data.funding_usdt !== "undefined") {
@@ -1061,10 +1068,9 @@ function refreshAccountSnapshot(){
const el = document.getElementById("current-capital");
if(el) el.innerText = `${Number(data.current_capital).toFixed(2)}U`;
}
if (typeof data.options_funding_usdc !== "undefined") {
if (typeof data.options_funding_usdc !== "undefined" || typeof data.options_funding_usdt !== "undefined") {
const el = document.getElementById("options-funding-usdc");
if (el) el.innerText = (data.options_funding_usdc === null || data.options_funding_usdc === undefined)
? "—" : `${Number(data.options_funding_usdc).toFixed(2)} USDC`;
if (el) el.innerText = formatOptionsFundingLabel(data.options_funding_usdc, data.options_funding_usdt);
}
if (typeof data.options_trading_usdc !== "undefined") {
const el = document.getElementById("options-trading-usdc");
@@ -1179,6 +1185,8 @@ if(window.ManualOrderRrPreview){
});
refreshAccountSnapshot();
const settingsRefreshFunds = document.getElementById("settings-refresh-funds");
if (settingsRefreshFunds) settingsRefreshFunds.addEventListener("click", refreshAccountSnapshot);
if (window.AccountRiskBadge) AccountRiskBadge.startTicker();
const _journalFormEl = document.getElementById("journal-form");
if(_journalFormEl){