diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-02 14:17:43 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-02 14:17:43 +0900 |
| commit | 35aa61c651217663406c9cd6df404f85338b2d68 (patch) | |
| tree | 9d85dd87e725984d45d7b6bdfef8b316ddfc4ae7 /shared/src | |
| parent | 17540c99d5e28576a6642e23d7bd6b297513e2d8 (diff) | |
style: fix lint and formatting issues across news collector and shared
Diffstat (limited to 'shared/src')
| -rw-r--r-- | shared/src/shared/db.py | 10 | ||||
| -rw-r--r-- | shared/src/shared/notifier.py | 3 | ||||
| -rw-r--r-- | shared/src/shared/sentiment.py | 6 |
3 files changed, 7 insertions, 12 deletions
diff --git a/shared/src/shared/db.py b/shared/src/shared/db.py index 55f93b4..9cc8686 100644 --- a/shared/src/shared/db.py +++ b/shared/src/shared/db.py @@ -299,11 +299,7 @@ class Database: async def get_top_symbol_scores(self, limit: int = 20) -> list[dict]: """Retrieve top symbol scores ordered by composite descending.""" - stmt = ( - select(SymbolScoreRow) - .order_by(SymbolScoreRow.composite.desc()) - .limit(limit) - ) + stmt = select(SymbolScoreRow).order_by(SymbolScoreRow.composite.desc()).limit(limit) async with self._session_factory() as session: try: result = await session.execute(stmt) @@ -431,7 +427,9 @@ class Database: "conviction": r.conviction, "reason": r.reason, "key_news": json.loads(r.key_news) if r.key_news else [], - "sentiment_snapshot": json.loads(r.sentiment_snapshot) if r.sentiment_snapshot else {}, + "sentiment_snapshot": json.loads(r.sentiment_snapshot) + if r.sentiment_snapshot + else {}, "created_at": r.created_at, } for r in rows diff --git a/shared/src/shared/notifier.py b/shared/src/shared/notifier.py index 9630a18..3d7b6cf 100644 --- a/shared/src/shared/notifier.py +++ b/shared/src/shared/notifier.py @@ -137,8 +137,7 @@ class TelegramNotifier: for i, s in enumerate(selections, 1): emoji = side_emoji.get(s.side.value, "⚪") lines.append( - f"{i}. <b>{s.symbol}</b> {emoji} {s.side.value} " - f"(conviction: {s.conviction:.0%})" + f"{i}. <b>{s.symbol}</b> {emoji} {s.side.value} (conviction: {s.conviction:.0%})" ) lines.append(f" {s.reason}") if s.key_news: diff --git a/shared/src/shared/sentiment.py b/shared/src/shared/sentiment.py index a20227e..449eb76 100644 --- a/shared/src/shared/sentiment.py +++ b/shared/src/shared/sentiment.py @@ -2,7 +2,7 @@ import logging from dataclasses import dataclass, field -from datetime import datetime, timedelta, timezone +from datetime import datetime, timezone from shared.sentiment_models import SymbolScore @@ -82,9 +82,7 @@ class SentimentAggregator: + filing_score * self.WEIGHTS["filing"] ) - def aggregate( - self, news_items: list[dict], now: datetime - ) -> dict[str, SymbolScore]: + def aggregate(self, news_items: list[dict], now: datetime) -> dict[str, SymbolScore]: """Aggregate news items into per-symbol scores. Each dict needs: symbols, sentiment, category, published_at. |
