feat(portfolio): add asset name field across API, DB, and CLI
This commit is contained in:
@@ -70,6 +70,7 @@ class Portfolio:
|
||||
portfolio_id: str
|
||||
broker: str
|
||||
status: str
|
||||
name: str
|
||||
symbol: str
|
||||
cash_balance: float = 0.0
|
||||
asset_quantity: float = 0.0
|
||||
|
||||
@@ -22,6 +22,7 @@ class PortfolioDomainRepository(Protocol):
|
||||
portfolio_id: str,
|
||||
symbol: str,
|
||||
*,
|
||||
name: str | None = None,
|
||||
broker: str = "kis",
|
||||
status: str = "enabled",
|
||||
active_strategy_id: str | None = None,
|
||||
@@ -34,6 +35,7 @@ class PortfolioDomainRepository(Protocol):
|
||||
*,
|
||||
broker: str,
|
||||
status: str,
|
||||
name: str,
|
||||
symbol: str,
|
||||
cash_balance: float,
|
||||
asset_quantity: float,
|
||||
@@ -99,6 +101,7 @@ def apply_buy(
|
||||
portfolio_id=portfolio.portfolio_id,
|
||||
broker=portfolio.broker,
|
||||
status=portfolio.status,
|
||||
name=portfolio.name,
|
||||
symbol=portfolio.symbol,
|
||||
cash_balance=float(portfolio.cash_balance) - total_cost,
|
||||
asset_quantity=float(portfolio.asset_quantity) + quantity,
|
||||
@@ -159,6 +162,7 @@ def apply_sell(
|
||||
portfolio_id=portfolio.portfolio_id,
|
||||
broker=portfolio.broker,
|
||||
status=portfolio.status,
|
||||
name=portfolio.name,
|
||||
symbol=portfolio.symbol,
|
||||
cash_balance=float(portfolio.cash_balance) + net_proceeds,
|
||||
asset_quantity=float(portfolio.asset_quantity) - quantity,
|
||||
|
||||
Reference in New Issue
Block a user