Financial Insight is a Python-based stock analysis tool that provides comprehensive insights into stock performance by combining financial data, news sentiment, and intelligent rating generation.
- Fetch real-time stock data using Yahoo Finance
- Retrieve latest financial news articles
- Perform sentiment analysis on news articles
- Generate stock ratings (Buy/Sell/Hold)
- Detailed financial highlights
- JSON output for easy integration
- Python 3.8+
- NewsAPI API Key
- Clone the repository:
git clone https://github.com/yourusername/fin_insight.git
cd fin_insight- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`- Install dependencies:
pip install -r requirements.txt- Set up NewsAPI Key:
export NEWS_API_KEY='your_newsapi_key_here' # On Windows use `set NEWS_API_KEY=your_key`python fin_insight.py AAPL # Replace AAPL with desired stock ticker{
"ticker": "AAPL",
"latest_price": 175.23,
"sentiment_summary": "Positive sentiment in news articles",
"financialHighlights": {
"revenueGrowthPercentage": "12.50%",
"earningsGrowthPercentage": "15.75%",
"forwardPERatio": "22.30",
"debtToEquityRatio": "1.10"
},
"rating": "Buy"
}get_stock_data(): Retrieves stock financial dataget_financial_news(): Fetches recent news articlesanalyze_sentiment(): Performs sentiment analysisgenerate_rating(): Calculates stock recommendation
Adjust rating thresholds and weights in generate_rating() function for custom analysis.
- Validates ticker symbols
- Checks for missing API keys
- Provides detailed error messages
- yfinance: Stock data retrieval
- requests: News article fetching
- vaderSentiment: Sentiment analysis
- pandas: Data manipulation
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License
This tool provides financial insights for informational purposes only. Always conduct your own research and consult financial advisors before making investment decisions.