[verified] Implement account valuation history for issue 12

This commit is contained in:
2026-10-06 08:25:43 +00:00
parent 5813dd4841
commit 8df7c26c84
30 changed files with 1950 additions and 121 deletions
+16
View File
@@ -50,6 +50,12 @@ def create_ci_fixture_db(db_path: str | Path) -> dict[str, Any]:
if not account.get("success"):
raise RuntimeError(f"fixture account seed failed: {account.get('error_code')}")
account_id = account["account"]["id"]
verified = service.register_account_valuation(
account_id, "2026-06-30", 1_250_000, verification_status="verified",
source_type="manual", source_ref="ci-fixture", idempotency_key="ci-checking-v1", db_path=str(path),
)
if not verified.get("success"):
raise RuntimeError(f"fixture valuation seed failed: {verified.get('error_code')}")
for account_spec in [
dict(name="CI Synthetic Investment", type="investment", institution="CI Synthetic Securities", last_balance=5_000_000, liquidity_bucket="investment"),
@@ -64,6 +70,16 @@ def create_ci_fixture_db(db_path: str | Path) -> dict[str, Any]:
)
if not result.get("success"):
raise RuntimeError(f"fixture account seed failed: {result.get('error_code')}")
if account_spec.get("last_balance") is not None:
value = service.register_account_valuation(
result["account"]["id"], "2026-06-30", account_spec["last_balance"],
valuation_kind="loan_balance" if account_spec["type"] == "loan" else "cash_balance",
representative_liability_definition="principal_only" if account_spec["type"] == "loan" else None,
verification_status="verified", source_type="manual", source_ref="ci-fixture",
idempotency_key=f"ci-{account_spec['name']}-v1", db_path=str(path),
)
if not value.get("success"):
raise RuntimeError(f"fixture valuation seed failed: {value.get('error_code')}")
budget = service.create_ledger_budget("2026-06", "식비", 50_000, memo="ci synthetic budget", db_path=str(path))
if not budget.get("success"):