risk: add kill-switch refresh retry policy and tests (#377)
All checks were successful
Gitea CI / test (push) Successful in 33s
Gitea CI / test (pull_request) Successful in 34s

This commit is contained in:
agentson
2026-03-02 09:38:39 +09:00
parent 1c41379815
commit ba2370e40e
6 changed files with 123 additions and 7 deletions

View File

@@ -1384,6 +1384,7 @@ async def _refresh_order_state_for_kill_switch(
overseas_broker: OverseasBroker,
markets: list[MarketInfo],
) -> None:
failures: list[str] = []
seen_overseas: set[str] = set()
for market in markets:
try:
@@ -1399,6 +1400,9 @@ async def _refresh_order_state_for_kill_switch(
market.exchange_code,
exc,
)
failures.append(f"{market.code}/{market.exchange_code}: {exc}")
if failures:
raise RuntimeError("; ".join(failures[:3]))
def _reduce_risk_for_kill_switch() -> None: