This API provides real-time sentiment analysis for stock market news related to a given stock symbol (e.g., AAPL, GOOGL, TSLA). It fetches financial news, analyzes sentiment, and returns insights to help investors make data-driven decisions.
- 🔍 Real-time News Fetching – Retrieves the latest financial news articles.
- 🧠 Sentiment Analysis – Classifies news as Positive, Negative, or Neutral.
- 📈 Stock Insights – Helps investors gauge market sentiment.
- ⚡ Fast & Scalable – Built using Flask and Gunicorn.
- Backend: Flask (Python)
- Data Processing: Pandas, NLTK (or Google Gemini for AI-based sentiment)
- API Hosting: Render / Heroku
- Database (if needed): PostgreSQL
git clone https://github.com/eziraa/stock_sentiment_analysis.git
cd stock-sentiment-analysis
pip install -r requirements.txt
Create a .env
file and add the necessary API keys:
NEWS_API_KEY=your_news_api_key
GOOGLE_GEMINI_API_KEY=your_google_gemini_key # If using Google AI
python app.py # OR
flask run
The API will be available at: http://127.0.0.1:5000/
Endpoint:
GET /sentiment/{stock_symbol}
Example Request:
GET /sentiment/GOOGL
Response:
{
"stock": "GOOGL",
"average_sentiment": "Positive",
"news": [
{
"title": "Google expands AI research in Europe",
"sentiment": "Positive"
},
{
"title": "EU fines Google for antitrust violations",
"sentiment": "Negative"
}
]
}
MIT License
Pull requests are welcome! Open an issue for bug fixes or feature requests.
- GitHub: Ezira Tigab
- Email: [email protected]