fix corporate action replay and trade filtering

This commit is contained in:
2026-09-13 14:17:32 +09:00
parent cb19c35d23
commit 925c6b4fa4
3 changed files with 20 additions and 2 deletions
+2
View File
@@ -1332,6 +1332,8 @@ def create_corporate_action(portfolio_id: str, payload: CorporateActionRequest,
return CorporateActionResponse(**saved.__dict__)
except ValueError as exc:
code = str(exc)
if code == "portfolio not found":
raise HTTPException(status_code=404, detail="Portfolio not found") from exc
raise HTTPException(status_code=409 if code.startswith(("IDEMPOTENCY", "CORPORATE_ACTION_")) else 400, detail=code) from exc
finally:
_close_repo(repo)