fix(ledger): keep legacy amount wire type and preserve dividend tax decimals

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-09 13:00:23 +00:00
committed by GitHub
co-authored by genichin
parent fde5b33f05
commit d3601d32dc
8 changed files with 131 additions and 19 deletions
+6 -2
View File
@@ -703,6 +703,7 @@ class PostgresPortfolioRepository:
@staticmethod
def _row_to_ledger_entry_legacy(row: Any) -> LedgerEntry:
raw_tax = row[6]
return LedgerEntry(
ledger_entry_id=0,
portfolio_id=row[0],
@@ -713,7 +714,8 @@ class PostgresPortfolioRepository:
price=float(row[3]),
price_decimal=Decimal(str(row[3])) if row[3] is not None else None,
fee_amount=float(row[5]),
tax_amount=float(row[6]),
tax_amount=float(raw_tax),
tax_amount_decimal=Decimal(str(raw_tax)) if raw_tax is not None else None,
executed_at=row[1],
recorded_at=row[1],
cash_balance_after=float(row[7]),
@@ -1866,6 +1868,7 @@ class PostgresPortfolioRepository:
if row is None:
raise ValueError("원장 항목을 찾을 수 없습니다")
raw_price = row[6]
raw_tax = row[8]
return LedgerEntry(
ledger_entry_id=int(row[0]),
portfolio_id=row[1],
@@ -1876,7 +1879,8 @@ class PostgresPortfolioRepository:
price=float(raw_price),
price_decimal=Decimal(str(raw_price)) if raw_price is not None else None,
fee_amount=float(row[7]),
tax_amount=float(row[8]),
tax_amount=float(raw_tax),
tax_amount_decimal=Decimal(str(raw_tax)) if raw_tax is not None else None,
executed_at=row[9],
recorded_at=row[10],
cash_balance_after=float(row[11]),