Fixed a UI bug calculating equity percentage incorrectly.
This commit is contained in:
@@ -139,3 +139,22 @@ def test_render_dashboard_contains_requested_sections() -> None:
|
||||
assert "FILLED</span>" in html
|
||||
assert "orderside.sell" not in html
|
||||
assert "orderstatus.filled" not in html
|
||||
|
||||
|
||||
def test_portfolio_percentage_uses_current_portfolio_total() -> None:
|
||||
html = render_dashboard(
|
||||
DashboardSnapshot(
|
||||
refreshed_at=datetime(2026, 8, 11, 10, 0, tzinfo=UTC),
|
||||
performance=[
|
||||
PerformancePoint(date(2026, 8, 11), 10_000.0, 10_000.0),
|
||||
],
|
||||
portfolio=[
|
||||
PortfolioRow("CASH", "cash", None, 100.0, None, None, None),
|
||||
PortfolioRow("SPY", "us_equity", 10.0, 10_000.0, 900.0, 1_000.0, 1_000.0),
|
||||
],
|
||||
trades=[],
|
||||
)
|
||||
)
|
||||
|
||||
assert "99.01%" in html
|
||||
assert "100.00%" not in html
|
||||
|
||||
Reference in New Issue
Block a user