A Streamlit-based stock market dashboard application that provides real-time market data, sector analysis, and trading strategy backtesting.
- Real-time Market Data: Live price data for major indices and stocks
- Sector Analysis: Performance analysis of sector ETFs
- Trading Strategies: Backtesting framework for trading strategies
- Interactive Charts: Candlestick charts and technical indicators
- Data Download: Robust data fetching from Yahoo Finance
stock_market_dashboard/
├── stock_market_dashboard.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── datafeed/ # Data fetching modules
│ ├── downloader.py # Yahoo Finance data downloader
│ └── etoro.py # eToro data integration
├── analyzer/ # Data analysis modules
└── strategy/ # Trading strategy modules
-
Clone the repository:
git clone <repository-url> cd stock_market_dashboard
-
Use the backtrader conda environment (recommended):
conda activate backtrader
Note: This project is configured to work with the
backtraderconda environment which has all the correct dependencies and SSL libraries installed. -
Alternative: Create a new conda environment:
conda create -n stock_dashboard python=3.9 conda activate stock_dashboard pip install -r requirements.txt
streamlit run stock_market_dashboard.pyThe dashboard will open in your browser at http://localhost:8501
The project includes a robust data downloader that fetches data from Yahoo Finance:
from datafeed.downloader import BatchPriceDownloader
from datetime import datetime, timedelta
# Download data for multiple tickers
end_date = datetime.now()
start_date = end_date - timedelta(days=30)
tickers = ['AAPL', 'MSFT', 'GOOGL']
downloader = BatchPriceDownloader(tickers, start_date, end_date, '1d')
data = downloader.get_yahoo_prices()InfoDownloader: Fetches company informationBatchPriceDownloader: Downloads historical price data for multiple tickers- Supports various intervals (1m, 5m, 15m, 30m, 1h, 1d, 1wk, 1mo, 3mo)
- Handles rate limiting and error recovery
- Streamlit web interface
- Overview section with major indices
- Sector analysis with ETF performance
- Interactive charts using Plotly and Cufflinks
- Trading strategy integration
Key packages:
streamlit: Web application frameworkyfinance: Yahoo Finance data fetchingpandas: Data manipulationplotly: Interactive chartscufflinks: Financial chartingbacktrader: Trading strategy backtesting
- SSL DLL Error: Make sure you're using the correct virtual environment
- Rate Limiting: Yahoo Finance may limit requests; the downloader includes retry logic
- Cufflinks Error: This may occur when importing the app directly; run with
streamlit run
If you encounter environment-related errors:
- Ensure you're using the correct Python environment
- Reinstall dependencies:
pip install -r requirements.txt - Check that all packages are compatible
The project is structured for easy development and testing:
- Core data fetching is isolated in
datafeed/ - Main application logic is in
stock_market_dashboard.py
This project is for educational and personal use. Please respect Yahoo Finance's terms of service when using their data.