feat: use broker-authoritative qty in slots RPC holdings
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
832dcb5fbb
commit
30bcbe1d12
@@ -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,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user