feat: apply rel-001 feedback cleanup

This commit is contained in:
2026-06-05 13:57:46 +09:00
parent 84de34c301
commit 2470c0a00c
28 changed files with 992 additions and 32 deletions
+1 -1
View File
@@ -253,7 +253,7 @@ class PortfolioRepository(Protocol):
def insert_ledger_trade(
self,
*,
asset_id: str,
portfolio_id: str,
order_id: str,
execution_id: str,
side: str,
+8 -8
View File
@@ -1267,7 +1267,7 @@ class PostgresPortfolioRepository:
def insert_ledger_trade(
self,
*,
asset_id: str,
portfolio_id: str,
order_id: str,
execution_id: str,
side: str,
@@ -1282,17 +1282,17 @@ class PostgresPortfolioRepository:
cur.execute(
"""
INSERT INTO ledger_trades
(asset_id, order_id, execution_id, side, quantity, price,
(portfolio_id, order_id, execution_id, side, quantity, price,
fee_amount, tax_amount, executed_at)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
ON CONFLICT ON CONSTRAINT uq_ledger_trades_idempotency DO NOTHING
RETURNING
ledger_entry_id, asset_id, order_id, execution_id, side,
ledger_entry_id, portfolio_id, order_id, execution_id, side,
quantity::float8, price::float8,
fee_amount::float8, tax_amount::float8,
executed_at, recorded_at
""",
(asset_id, order_id, execution_id, side, quantity, price,
(portfolio_id, order_id, execution_id, side, quantity, price,
fee_amount, tax_amount, executed_at),
)
row = cur.fetchone()
@@ -1302,14 +1302,14 @@ class PostgresPortfolioRepository:
cur.execute(
"""
SELECT
ledger_entry_id, asset_id, order_id, execution_id, side,
ledger_entry_id, portfolio_id, order_id, execution_id, side,
quantity::float8, price::float8,
fee_amount::float8, tax_amount::float8,
executed_at, recorded_at
FROM ledger_trades
WHERE asset_id = %s AND order_id = %s AND execution_id = %s
WHERE portfolio_id = %s AND order_id = %s AND execution_id = %s
""",
(asset_id, order_id, execution_id),
(portfolio_id, order_id, execution_id),
)
row = cur.fetchone()
return self._row_to_ledger_trade(row), False
@@ -1319,7 +1319,7 @@ class PostgresPortfolioRepository:
from app.domain.models import LedgerTrade
return LedgerTrade(
ledger_entry_id=row[0],
asset_id=row[1],
portfolio_id=row[1],
order_id=row[2],
execution_id=row[3],
side=row[4],