feat: use broker-authoritative qty in slots RPC holdings

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-08-24 14:15:43 +00:00
committed by GitHub
co-authored by genichin
parent 832dcb5fbb
commit 30bcbe1d12
11 changed files with 303 additions and 15 deletions
+13
View File
@@ -217,6 +217,19 @@ class AccountSnapshotService:
)
return list(snapshot.holdings)
def holdings_for_slots_rpc(self) -> tuple[list[BalanceItem], datetime]:
"""Return freshness-validated snapshot holdings for strategy slots reads.
Unlike ``holdings_for_sell()``, this read path never performs a live broker
call and therefore cannot mutate broker state or mask snapshot staleness.
"""
snapshot = self._load_current()
self._age(snapshot.holdings_captured_at, self._sell_max_age)
captured_at = snapshot.holdings_captured_at
if captured_at is None:
raise AccountSnapshotUnavailable("not_ready")
return list(snapshot.holdings), captured_at
def buy_guard(
self,
*,