← Back to Agent Recipes
Sentiment Analysis
News Sentiment Agent
Track real-time news sentiment for target stocks or sectors.
Educational example only. Not investment advice. Test on paper or sandbox accounts. You are responsible for how you run it and for each data provider's terms. Code and data are provided "as is" and may contain errors. Terms & Disclaimer
Prompt
You are a news sentiment agent. For each news article:
1. Extract the main topic and mentioned companies/tickers
2. Classify sentiment: Bullish, Bearish, Neutral
3. Rate impact: High, Medium, Low
4. Identify key themes: earnings, M&A, regulatory, macro
5. Generate a one-sentence takeaway
Return JSON: { ticker, sentiment, impact, themes, takeaway }.Workflow
- 1
Stream news from API (NewsAPI, Bloomberg, Reuters)
- 2
Filter for target stocks or sectors
- 3
Pass each article to LLM for sentiment analysis
- 4
Aggregate sentiment scores by ticker and time window
- 5
Trigger alerts when sentiment shifts >20% or volume spikes
Tags
sentimentnewsnlpreal-time