summaryrefslogtreecommitdiff
path: root/services/strategy-engine/tests/test_stock_selector.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 14:17:43 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 14:17:43 +0900
commit35aa61c651217663406c9cd6df404f85338b2d68 (patch)
tree9d85dd87e725984d45d7b6bdfef8b316ddfc4ae7 /services/strategy-engine/tests/test_stock_selector.py
parent17540c99d5e28576a6642e23d7bd6b297513e2d8 (diff)
style: fix lint and formatting issues across news collector and shared
Diffstat (limited to 'services/strategy-engine/tests/test_stock_selector.py')
-rw-r--r--services/strategy-engine/tests/test_stock_selector.py40
1 files changed, 21 insertions, 19 deletions
diff --git a/services/strategy-engine/tests/test_stock_selector.py b/services/strategy-engine/tests/test_stock_selector.py
index a2f5bca..ff9d09c 100644
--- a/services/strategy-engine/tests/test_stock_selector.py
+++ b/services/strategy-engine/tests/test_stock_selector.py
@@ -1,12 +1,8 @@
"""Tests for stock selector engine."""
-import pytest
-from unittest.mock import AsyncMock, MagicMock, patch
+from unittest.mock import AsyncMock, MagicMock
from datetime import datetime, timezone
-from decimal import Decimal
-from shared.models import OrderSide
-from shared.sentiment_models import SymbolScore, MarketSentiment, SelectedStock, Candidate
from strategy_engine.stock_selector import (
SentimentCandidateSource,
@@ -17,10 +13,12 @@ from strategy_engine.stock_selector import (
async def test_sentiment_candidate_source():
mock_db = MagicMock()
- mock_db.get_top_symbol_scores = AsyncMock(return_value=[
- {"symbol": "AAPL", "composite": 0.8, "news_count": 5},
- {"symbol": "NVDA", "composite": 0.6, "news_count": 3},
- ])
+ mock_db.get_top_symbol_scores = AsyncMock(
+ return_value=[
+ {"symbol": "AAPL", "composite": 0.8, "news_count": 5},
+ {"symbol": "NVDA", "composite": 0.6, "news_count": 3},
+ ]
+ )
source = SentimentCandidateSource(mock_db)
candidates = await source.get_candidates()
@@ -64,15 +62,19 @@ def test_parse_llm_selections_with_markdown():
async def test_selector_blocks_on_risk_off():
mock_db = MagicMock()
- mock_db.get_latest_market_sentiment = AsyncMock(return_value={
- "fear_greed": 15,
- "fear_greed_label": "Extreme Fear",
- "vix": 35.0,
- "fed_stance": "neutral",
- "market_regime": "risk_off",
- "updated_at": datetime.now(timezone.utc),
- })
-
- selector = StockSelector(db=mock_db, broker=MagicMock(), alpaca=MagicMock(), anthropic_api_key="test")
+ mock_db.get_latest_market_sentiment = AsyncMock(
+ return_value={
+ "fear_greed": 15,
+ "fear_greed_label": "Extreme Fear",
+ "vix": 35.0,
+ "fed_stance": "neutral",
+ "market_regime": "risk_off",
+ "updated_at": datetime.now(timezone.utc),
+ }
+ )
+
+ selector = StockSelector(
+ db=mock_db, broker=MagicMock(), alpaca=MagicMock(), anthropic_api_key="test"
+ )
result = await selector.select()
assert result == []