fix: don't fabricate last_equity for Tradier — realized P&L read $0 forever
Dashboard realized = broker equity delta (equity - last_equity). Tradier balances carry no prior-session-close field and translate_balances echoed current equity, making the delta permanently zero (win rate populated from closed events while dollars showed $0). Absent last_equity now routes the projection to its closed-events fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
80422d91cd
commit
c5b43364be
1 file changed
+7
-1
@@ -164,7 +164,13 @@ def translate_balances(b: dict) -> dict:
|
||||
)
|
||||
return {
|
||||
"equity": _s(b.get("total_equity") or 0),
|
||||
"last_equity": _s(b.get("total_equity") or 0),
|
||||
# Tradier has NO prior-session-close equity field. Do NOT fake it with
|
||||
# current equity: the dashboard's realized P&L is the broker equity
|
||||
# delta (equity - last_equity), which then reads $0 forever. Absent
|
||||
# last_equity makes the projection fall back to summing
|
||||
# position_closed events — honest, and correct now that fills/closes
|
||||
# are journaled reliably.
|
||||
"last_equity": None,
|
||||
"cash": _s(b.get("total_cash") or 0),
|
||||
"buying_power": _s(buying_power),
|
||||
"status": "ACTIVE",
|
||||
|
||||
Reference in new issue
Block a user