Add ProofLine criteria documentation and Strategy Catalog v1 implementation
- Add acceptance criteria documentation (AC-0013 through AC-0023) - Add Line-0003 discovery documentation - Implement Strategy Catalog v1 with new database migration - Update portfolio API endpoints and schemas - Refactor strategy and portfolio services - Add strategy management CLI commands - Update domain models with strategy catalog support - Add comprehensive tests for v1 strategies - Update design documentation (data model, interfaces, runtime flows)
This commit is contained in:
@@ -583,8 +583,11 @@ class _PortfolioServiceFakeRepo:
|
||||
"""FakeRepo for PortfolioService catalog validation tests."""
|
||||
|
||||
def __init__(self, asset: Asset | None = None) -> None:
|
||||
from app.domain.models import StrategySet
|
||||
|
||||
self._asset = asset
|
||||
self._strategy_sets: dict = {}
|
||||
strategy = StrategySet(id="set-1", name="target_value", config="{}", nick="target_value:default")
|
||||
self._strategy_sets: dict = {strategy.id: strategy}
|
||||
self._portfolios: dict = {}
|
||||
|
||||
def get_asset_by_id(self, asset_id: str) -> Asset | None:
|
||||
@@ -625,7 +628,7 @@ class _PortfolioServiceFakeRepo:
|
||||
return p
|
||||
|
||||
def get_strategy_set(self, id: str):
|
||||
return None
|
||||
return self._strategy_sets.get(id)
|
||||
|
||||
def list_recent_trades(self, portfolio_id: str, *, limit: int = 5):
|
||||
return []
|
||||
@@ -633,7 +636,7 @@ class _PortfolioServiceFakeRepo:
|
||||
def list_comments(self, portfolio_id: str):
|
||||
return []
|
||||
|
||||
def list_strategy_sets(self):
|
||||
def list_strategy_sets(self, *, include_inactive: bool = True):
|
||||
return []
|
||||
|
||||
def list_portfolios(self, **kwargs):
|
||||
@@ -669,6 +672,7 @@ def test_portfolio_create_with_active_asset() -> None:
|
||||
name="Test_Portfolio",
|
||||
asset_id=_CATALOG_ASSET_ID,
|
||||
broker="kis",
|
||||
strategy_id="set-1",
|
||||
),
|
||||
owner_user_id="user-1",
|
||||
)
|
||||
@@ -688,6 +692,7 @@ def test_portfolio_create_unknown_asset() -> None:
|
||||
name="Test_Portfolio",
|
||||
asset_id="nonexistent-uuid",
|
||||
broker="kis",
|
||||
strategy_id="set-1",
|
||||
),
|
||||
owner_user_id="user-1",
|
||||
)
|
||||
@@ -706,6 +711,7 @@ def test_portfolio_create_inactive_asset() -> None:
|
||||
name="Test_Portfolio",
|
||||
asset_id=_CATALOG_ASSET_ID,
|
||||
broker="kis",
|
||||
strategy_id="set-1",
|
||||
),
|
||||
owner_user_id="user-1",
|
||||
)
|
||||
@@ -745,6 +751,8 @@ def test_portfolio_create_by_symbol() -> None:
|
||||
"portfolio", "create", "Test_Portfolio",
|
||||
"--user", "alice",
|
||||
"--symbol", "005930",
|
||||
"--strategy-id",
|
||||
"set-1",
|
||||
"--force",
|
||||
])
|
||||
assert result.exit_code == 0, result.output
|
||||
|
||||
Reference in New Issue
Block a user