summaryrefslogtreecommitdiff
path: root/services/news-collector/src
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/news-collector/src
parent17540c99d5e28576a6642e23d7bd6b297513e2d8 (diff)
style: fix lint and formatting issues across news collector and shared
Diffstat (limited to 'services/news-collector/src')
-rw-r--r--services/news-collector/src/news_collector/collectors/fear_greed.py5
-rw-r--r--services/news-collector/src/news_collector/collectors/fed.py23
-rw-r--r--services/news-collector/src/news_collector/collectors/reddit.py4
-rw-r--r--services/news-collector/src/news_collector/collectors/sec_edgar.py43
-rw-r--r--services/news-collector/src/news_collector/collectors/truth_social.py4
5 files changed, 56 insertions, 23 deletions
diff --git a/services/news-collector/src/news_collector/collectors/fear_greed.py b/services/news-collector/src/news_collector/collectors/fear_greed.py
index 305d416..f79f716 100644
--- a/services/news-collector/src/news_collector/collectors/fear_greed.py
+++ b/services/news-collector/src/news_collector/collectors/fear_greed.py
@@ -7,7 +7,6 @@ from typing import Optional
import aiohttp
from news_collector.collectors.base import BaseCollector
-from shared.models import NewsItem
logger = logging.getLogger(__name__)
@@ -31,7 +30,9 @@ class FearGreedCollector(BaseCollector):
headers = {"User-Agent": "Mozilla/5.0"}
try:
async with aiohttp.ClientSession() as session:
- async with session.get(FEAR_GREED_URL, headers=headers, timeout=aiohttp.ClientTimeout(total=10)) as resp:
+ async with session.get(
+ FEAR_GREED_URL, headers=headers, timeout=aiohttp.ClientTimeout(total=10)
+ ) as resp:
if resp.status != 200:
return None
return await resp.json()
diff --git a/services/news-collector/src/news_collector/collectors/fed.py b/services/news-collector/src/news_collector/collectors/fed.py
index 47b70f5..fce4842 100644
--- a/services/news-collector/src/news_collector/collectors/fed.py
+++ b/services/news-collector/src/news_collector/collectors/fed.py
@@ -17,12 +17,27 @@ logger = logging.getLogger(__name__)
_FED_RSS_URL = "https://www.federalreserve.gov/feeds/press_all.xml"
_HAWKISH_KEYWORDS = [
- "rate hike", "interest rate increase", "tighten", "tightening", "inflation",
- "hawkish", "restrictive", "raise rates", "hike rates",
+ "rate hike",
+ "interest rate increase",
+ "tighten",
+ "tightening",
+ "inflation",
+ "hawkish",
+ "restrictive",
+ "raise rates",
+ "hike rates",
]
_DOVISH_KEYWORDS = [
- "rate cut", "interest rate decrease", "easing", "ease", "stimulus",
- "dovish", "accommodative", "lower rates", "cut rates", "quantitative easing",
+ "rate cut",
+ "interest rate decrease",
+ "easing",
+ "ease",
+ "stimulus",
+ "dovish",
+ "accommodative",
+ "lower rates",
+ "cut rates",
+ "quantitative easing",
]
diff --git a/services/news-collector/src/news_collector/collectors/reddit.py b/services/news-collector/src/news_collector/collectors/reddit.py
index 11b855c..226a2f9 100644
--- a/services/news-collector/src/news_collector/collectors/reddit.py
+++ b/services/news-collector/src/news_collector/collectors/reddit.py
@@ -39,7 +39,9 @@ class RedditCollector(BaseCollector):
headers = {"User-Agent": "TradingPlatform/1.0 (research@example.com)"}
try:
async with aiohttp.ClientSession() as session:
- async with session.get(url, headers=headers, timeout=aiohttp.ClientTimeout(total=10)) as resp:
+ async with session.get(
+ url, headers=headers, timeout=aiohttp.ClientTimeout(total=10)
+ ) as resp:
if resp.status == 200:
data = await resp.json()
return data.get("data", {}).get("children", [])
diff --git a/services/news-collector/src/news_collector/collectors/sec_edgar.py b/services/news-collector/src/news_collector/collectors/sec_edgar.py
index a00abb5..ca1d070 100644
--- a/services/news-collector/src/news_collector/collectors/sec_edgar.py
+++ b/services/news-collector/src/news_collector/collectors/sec_edgar.py
@@ -12,9 +12,16 @@ from news_collector.collectors.base import BaseCollector
logger = logging.getLogger(__name__)
TRACKED_CIKS = {
- "0000320193": "AAPL", "0000789019": "MSFT", "0001652044": "GOOGL",
- "0001018724": "AMZN", "0001318605": "TSLA", "0001045810": "NVDA",
- "0001326801": "META", "0000019617": "JPM", "0000078003": "PFE", "0000021344": "KO",
+ "0000320193": "AAPL",
+ "0000789019": "MSFT",
+ "0001652044": "GOOGL",
+ "0001018724": "AMZN",
+ "0001318605": "TSLA",
+ "0001045810": "NVDA",
+ "0001326801": "META",
+ "0000019617": "JPM",
+ "0000078003": "PFE",
+ "0000021344": "KO",
}
SEC_USER_AGENT = "TradingPlatform research@example.com"
@@ -37,7 +44,9 @@ class SecEdgarCollector(BaseCollector):
for cik, ticker in TRACKED_CIKS.items():
try:
url = f"https://data.sec.gov/submissions/CIK{cik}.json"
- async with session.get(url, headers=headers, timeout=aiohttp.ClientTimeout(total=10)) as resp:
+ async with session.get(
+ url, headers=headers, timeout=aiohttp.ClientTimeout(total=10)
+ ) as resp:
if resp.status == 200:
data = await resp.json()
data["tickers"] = [{"ticker": ticker}]
@@ -72,16 +81,20 @@ class SecEdgarCollector(BaseCollector):
accession = accessions[i] if i < len(accessions) else ""
headline = f"{company_name} ({', '.join(tickers)}): {form} - {desc}"
- items.append(NewsItem(
- source=self.name,
- headline=headline,
- summary=desc,
- url=f"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&accession={accession}",
- published_at=datetime.strptime(filing_date, "%Y-%m-%d").replace(tzinfo=timezone.utc),
- symbols=tickers,
- sentiment=self._vader.polarity_scores(headline)["compound"],
- category=NewsCategory.FILING,
- raw_data={"form": form, "accession": accession},
- ))
+ items.append(
+ NewsItem(
+ source=self.name,
+ headline=headline,
+ summary=desc,
+ url=f"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&accession={accession}",
+ published_at=datetime.strptime(filing_date, "%Y-%m-%d").replace(
+ tzinfo=timezone.utc
+ ),
+ symbols=tickers,
+ sentiment=self._vader.polarity_scores(headline)["compound"],
+ category=NewsCategory.FILING,
+ raw_data={"form": form, "accession": accession},
+ )
+ )
return items
diff --git a/services/news-collector/src/news_collector/collectors/truth_social.py b/services/news-collector/src/news_collector/collectors/truth_social.py
index 2205257..33ebc86 100644
--- a/services/news-collector/src/news_collector/collectors/truth_social.py
+++ b/services/news-collector/src/news_collector/collectors/truth_social.py
@@ -37,7 +37,9 @@ class TruthSocialCollector(BaseCollector):
headers = {"User-Agent": "TradingPlatform/1.0 (research@example.com)"}
try:
async with aiohttp.ClientSession() as session:
- async with session.get(_API_URL, headers=headers, timeout=aiohttp.ClientTimeout(total=10)) as resp:
+ async with session.get(
+ _API_URL, headers=headers, timeout=aiohttp.ClientTimeout(total=10)
+ ) as resp:
if resp.status == 200:
return await resp.json()
except Exception as exc: