fix: aggregate investment totals across ledger sources

This commit is contained in:
2026-08-19 17:34:13 +09:00
parent 02bfa60299
commit 5eb8c04266
7 changed files with 158 additions and 18 deletions
+18 -6
View File
@@ -222,10 +222,22 @@ class ManualLedgerHistoryResponse(BaseModel):
class PortfolioReturnSummaryResponse(BaseModel):
portfolio_id: str
total_invested: float = 0.0
total_withdrawn: float = 0.0
net_contributed_capital: float = 0.0
cumulative_profit_withdrawn: float = 0.0
total_invested: float = Field(
default=0.0,
description="총투자원금: source와 무관한 유효 INVEST의 gross 합계",
)
total_withdrawn: float = Field(
default=0.0,
description="총회수원금: source와 무관한 유효 WITHDRAW 합계",
)
net_contributed_capital: float = Field(
default=0.0,
description="순투자원금: total_invested - total_withdrawn (PROFIT 제외)",
)
cumulative_profit_withdrawn: float = Field(
default=0.0,
description="누적 수익 인출액: source와 무관한 유효 PROFIT 합계 (원금 계산 제외)",
)
# ---------------------------------------------------------------------------
@@ -273,11 +285,11 @@ class PortfolioItem(BaseModel):
profit_buffer: float = 0.0
net_contributed_capital: float = Field(
default=0.0,
description="순투자현금: 유효 manual INVEST 합계 - 유효 manual WITHDRAW 합계",
description="순투자원금: source와 무관한 유효 INVEST 합계 - 유효 WITHDRAW 합계 (PROFIT 제외)",
)
cumulative_profit_withdrawn: float = Field(
default=0.0,
description="누적 수익 인출액: 유효 manual PROFIT 합계",
description="누적 수익 인출액: source와 무관한 유효 PROFIT 합계 (원금 계산 제외)",
)
tag_ids: list[str] = Field(default_factory=list)
managed_by_daemon_id: str | None = None