emmanuelmaekekioko/Nifty50-historical-analytics
4
NIFTY 50 Analysis
A Streamlit-based web application for analyzing historical stock trends and market insights for NIFTY 50 companies. The app provides interactive visualizations, technical indicators, and news updates.
Features
- Sector and Company Analysis: Select a sector or specific NIFTY 50 company to analyze historical stock performance.
- Time Frames: Choose from 1D, 5D, 1M, 5M, 6M, YTD, 1Y, or 5Y periods, or specify a custom date range.
- Technical Indicators: Includes Bollinger Bands, MACD, RSI, and ATR for volatility and momentum analysis.
- Market Movers: Displays top gainers, losers, and most active stocks.
- Investment Growth: Simulates investment growth based on historical data.
- News Integration: Fetches recent news articles for selected companies or sectors using the News API.
- Interactive Visuals: Candlestick charts, scatter plots, and correlation matrices powered by Plotly.
Installation
- Clone the repository:
git clone https://github.com/mtotowajemo0/nifty50-analysis.git
cd nifty50-analysis- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Obtain a News API key from newsapi.org and replace the placeholder in
app.py:
newsapi = NewsApiClient(api_key="your-api-key-here")- Run the Streamlit app:
streamlit run app.pyDeployment on Hugging Face
- Create a new Space on Hugging Face and select "Streamlit" as the app type.
- Push your repository to Hugging Face:
git remote add huggingface https://huggingface.co/spaces/mtotowajemo/nifty50-analysis
git push huggingface main- Set the News API key as a secret in your Hugging Face Space settings under
Settings > Repository secrets. - Hugging Face will automatically deploy the app using
app.pyandrequirements.txt.
Requirements
See requirements.txt for the full list of dependencies with versions.
Usage
- Select a sector and company from the sidebar.
- Choose a time frame or custom date range.
- Check options for technical indicators and visualizations.
- Click "Analyze" to view results, including candlestick charts, metrics, and news.
Notes
- This tool is for informational purposes only and does not constitute financial advice.
- Ensure your News API key is kept secure and not exposed in the code.
- Some features (e.g., 1D data) are tailored for Indian market hours (9:30 AM to 3:30 PM IST).
Contributing
Contributions are welcome! Please submit a pull request or open an issue for suggestions.
License
This project is licensed under the MIT License.
