feat: consolidate ledger trade writes into portfolio_ledger

- add ledger consolidation migration and remove ledger_trades usage
- return portfolio state after v1 ledger trade writes
- deprecate legacy buy/sell endpoints with deprecation headers
- add BAT-016, DCY-006, and REQ-036~038 documentation
- update repository models and tests for unified ledger entries
This commit is contained in:
2026-06-05 20:55:24 +09:00
parent 2470c0a00c
commit 44f2102d26
23 changed files with 1254 additions and 115 deletions
+4 -2
View File
@@ -122,8 +122,8 @@ class LedgerTradeRequest(BaseModel):
class LedgerTradeResponse(BaseModel):
ledger_entry_id: int
portfolio_id: str
order_id: str
execution_id: str
order_id: str | None
execution_id: str | None
side: str
quantity: float
price: float
@@ -131,6 +131,8 @@ class LedgerTradeResponse(BaseModel):
tax_amount: float
executed_at: datetime
recorded_at: datetime | None = None
cash_balance_after: float = 0.0
asset_quantity_after: float = 0.0
status: Literal["new", "duplicate"] = "new"