aboutsummaryrefslogtreecommitdiff
path: root/components/news.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/news.py')
-rw-r--r--components/news.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/components/news.py b/components/news.py
index cea678e..522826c 100644
--- a/components/news.py
+++ b/components/news.py
@@ -7,11 +7,11 @@ from services.fmp_service import get_company_news as get_fmp_news
def _sentiment_badge(sentiment: str) -> str:
badges = {
- "bullish": "🟢 Bullish",
- "bearish": "🔴 Bearish",
- "neutral": "⚪ Neutral",
+ "bullish": "🟢 Bullish (heuristic)",
+ "bearish": "🔴 Bearish (heuristic)",
+ "neutral": "⚪ Neutral (heuristic)",
}
- return badges.get(sentiment.lower(), "⚪ Neutral")
+ return badges.get(sentiment.lower(), "⚪ Neutral (heuristic)")
def _classify_sentiment(article: dict) -> str:
@@ -52,8 +52,9 @@ def render_news(ticker: str):
col1.metric("Articles (7d)", buzz.get("articlesInLastWeek", "—"))
bull_pct = score.get("bullishPercent")
bear_pct = score.get("bearishPercent")
- col2.metric("Bullish %", f"{bull_pct * 100:.1f}%" if bull_pct else "—")
- col3.metric("Bearish %", f"{bear_pct * 100:.1f}%" if bear_pct else "—")
+ col2.metric("Bullish %", f"{bull_pct * 100:.1f}%" if bull_pct is not None else "—")
+ col3.metric("Bearish %", f"{bear_pct * 100:.1f}%" if bear_pct is not None else "—")
+ st.caption("Sentiment tags below are rule-based headline heuristics, not model-scored article sentiment.")
st.divider()
# Fetch articles — Finnhub first, FMP as fallback