diff --git a/market_service.py b/market_service.py index b11b96a..a6da64c 100644 --- a/market_service.py +++ b/market_service.py @@ -2,7 +2,6 @@ import asyncio import logging -from datetime import datetime, timezone, timedelta from typing import Any from openbb import obb diff --git a/openbb_service.py b/openbb_service.py index af2ebc4..071643d 100644 --- a/openbb_service.py +++ b/openbb_service.py @@ -1,6 +1,5 @@ import asyncio import logging -from datetime import datetime, timedelta, timezone from typing import Any import yfinance as yf diff --git a/quantitative_service.py b/quantitative_service.py index 11845fc..c5a2879 100644 --- a/quantitative_service.py +++ b/quantitative_service.py @@ -2,7 +2,6 @@ import asyncio import logging -from datetime import datetime, timezone, timedelta from typing import Any from openbb import obb diff --git a/routes_sentiment.py b/routes_sentiment.py index 4f75061..b62d399 100644 --- a/routes_sentiment.py +++ b/routes_sentiment.py @@ -76,7 +76,6 @@ async def stock_sentiment(symbol: str = Path(..., min_length=1, max_length=20)): if isinstance(upgrades_data, list) and upgrades_data: ups = sum(1 for u in upgrades_data if u.get("action") in ("up", "init")) downs = sum(1 for u in upgrades_data if u.get("action") == "down") - maintains = len(upgrades_data) - ups - downs if len(upgrades_data) > 0: upgrade_score = (ups - downs) / len(upgrades_data) scores.append(("upgrades", round(upgrade_score, 3), 0.20)) diff --git a/tests/test_akshare_service.py b/tests/test_akshare_service.py index 51884da..f7d7621 100644 --- a/tests/test_akshare_service.py +++ b/tests/test_akshare_service.py @@ -1,7 +1,6 @@ """Unit tests for akshare_service.py - written FIRST (TDD RED phase).""" -from datetime import datetime -from unittest.mock import MagicMock, patch +from unittest.mock import patch import pandas as pd import pytest diff --git a/tests/test_defi_service.py b/tests/test_defi_service.py index ebedac6..7abed05 100644 --- a/tests/test_defi_service.py +++ b/tests/test_defi_service.py @@ -7,7 +7,6 @@ from unittest.mock import AsyncMock, MagicMock, patch import pytest -import defi_service from defi_service import ( get_chain_tvls, get_dex_volumes, diff --git a/tests/test_portfolio_service.py b/tests/test_portfolio_service.py index aa980ba..2509caf 100644 --- a/tests/test_portfolio_service.py +++ b/tests/test_portfolio_service.py @@ -268,7 +268,7 @@ async def test_fetch_historical_prices_skips_none(mock_fetch_hist): # --------------------------------------------------------------------------- -def _make_prices(symbols: list[str], n_days: int = 60) -> "pd.DataFrame": +def _make_prices(symbols: list[str], n_days: int = 60): """Build a deterministic price DataFrame with enough rows for t-SNE.""" import numpy as np import pandas as pd @@ -383,7 +383,6 @@ async def test_cluster_stocks_no_data_raises(mock_fetch): @patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock) async def test_cluster_stocks_identical_returns_still_works(mock_fetch): """t-SNE should not raise even when all symbols have identical returns.""" - import numpy as np import pandas as pd import portfolio_service @@ -530,7 +529,6 @@ async def test_find_similar_stocks_no_data_raises(mock_fetch): @patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock) async def test_find_similar_stocks_target_not_in_data_raises(mock_fetch): """find_similar_stocks raises ValueError when target symbol has no data.""" - import pandas as pd import portfolio_service # Only universe symbols have data, not the target