Add initial funds to fleet stats and color total PnL.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 12:51:47 +08:00
parent 51aef1c2fb
commit 60b3743e8d
4 changed files with 37 additions and 0 deletions
+9
View File
@@ -79,6 +79,14 @@ def build_stats_summary(db: Any | None = None) -> dict[str, Any]:
except Exception:
latest_funds = 0.0
try:
initial_funds = float(
database.get_setting("initial_equity", str(s.initial_equity))
or s.initial_equity
)
except Exception:
initial_funds = float(s.initial_equity)
return {
"mode": mode,
"show_slip": mode == "SIM",
@@ -92,6 +100,7 @@ def build_stats_summary(db: Any | None = None) -> dict[str, Any]:
"total_slip": total_slip if mode == "SIM" else 0.0,
"close_reasons": reasons,
"equity_curve": curve,
"initial_funds": initial_funds,
"latest_funds": latest_funds,
"max_single_loss": max_single_loss,
"loss_streak": _current_loss_streak(curve),