A comprehensive stock tracking and analysis application built with Streamlit featuring advanced technical analysis, portfolio management, price alerts, and AI-powered predictions.
# 1. Clone the repository
git clone https://github.com/yourusername/StockTracker.git
cd StockTracker
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the application
streamlit run app.py
# 4. Open your browser to http://localhost:8501That's it! No API keys, no configuration files, no database setup required. Just install and run!
# Windows
start.bat
# Linux/Mac
./start.shVisit the live application: Enhanced Stock Tracker
- Real-time Stock Data: Fetch current and historical stock prices using Yahoo Finance
- Interactive Charts: Beautiful, interactive candlestick charts powered by Plotly
- 15+ Technical Indicators: SMA, EMA, RSI, MACD, Bollinger Bands, Stochastic, ATR, CCI, Williams %R, VWAP, OBV, and more
- Trading Signals: Automated buy/sell/neutral signals based on technical analysis
- Support & Resistance: Automatic identification of key price levels
- Fibonacci Retracement: Calculate and display Fibonacci levels
- Holdings Tracking: Add and manage stock holdings with purchase dates and prices
- Performance Analytics: Real-time portfolio value, gains/losses, and percentage returns
- Allocation Analysis: Visual portfolio allocation with pie charts and performance graphs
- Dividend Tracking: Monitor dividend income and yields
- Export Functionality: Download portfolio data as CSV files
- Rebalancing Suggestions: AI-powered portfolio rebalancing recommendations
- Price Alerts: Set alerts for price above/below thresholds
- Percentage Change Alerts: Get notified on significant price movements
- Email Notifications: Receive alert notifications via email
- Alert History: Track triggered alerts and statistics
- Multiple Alert Types: Support for various alert conditions
- Machine Learning Models: Random Forest and Linear Regression for price forecasting
- Customizable Timeframes: Predict prices 1-90 days into the future
- Model Accuracy Metrics: MAE, RMSE, and performance indicators
- Visual Predictions: Interactive charts showing predicted vs historical prices
- Prediction Export: Download predictions as CSV data
- Secure Authentication: Login system with user profiles
- Favorites System: Save and quickly access favorite stocks
- Analysis History: Track all your stock analyses
- Password Reset: Email-based password recovery
- User Preferences: Personalized settings and configurations
- SQLite Database: Robust data storage for stocks, portfolios, alerts, and analysis history
- Historical Data Storage: Automatic storage of fetched stock data
- Analysis Caching: Save and retrieve analysis results
- Portfolio History: Track portfolio performance over time
- Streamlit - Web application framework
- Yahoo Finance API - Stock data source
- Plotly - Interactive visualizations
- scikit-learn - Machine learning models
- SQLite - Database for data persistence
- Pandas - Data manipulation and analysis
- NumPy - Numerical computing
- Python 3.8+ - Core programming language
StockTracker/
βββ src/
β βββ stock_tracker/
β βββ __init__.py
β βββ main.py # Original Streamlit app
β βββ config/
β β βββ __init__.py
β β βββ auth.py # Authentication system
β β βββ settings.py # Application settings
β βββ models/
β β βββ __init__.py
β β βββ stock.py # Stock data models
β β βββ database.py # Database management
β βββ services/
β β βββ __init__.py
β β βββ email_service.py # Email notifications
β βββ utils/
β β βββ __init__.py
β β βββ technical_analysis.py # Technical indicators
β β βββ portfolio.py # Portfolio management
β β βββ alert_system.py # Price alerts system
β βββ templates/
β βββ email/ # Email templates
βββ tests/
β βββ __init__.py
β βββ test_database.py # Database tests
β βββ test_technical_analysis.py # Technical analysis tests
β βββ test_portfolio.py # Portfolio tests
β βββ test_email_service.py # Email service tests
β βββ fixtures/ # Test data fixtures
βββ data/
β βββ stocks.db # SQLite database
β βββ users.json # User data
βββ docs/ # Documentation
βββ app.py # Enhanced Streamlit application
βββ app.py # Original application
βββ auth.py # Authentication module
βββ run_tests.py # Test runner
βββ requirements.txt # Dependencies
βββ README.md # This file
- Python 3.8 or higher
- pip package manager
- Clone the repository:
git clone https://github.com/yourusername/StockTracker.git
cd StockTracker- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the enhanced application:
streamlit run app.py- Open your browser to:
http://localhost:5000
Run the comprehensive test suite:
# Verify everything works (no API keys required)
python verify_setup.py
# Run all tests
python run_tests.py
# Run tests with coverage report
python run_tests.py --coverage
# Run specific test modules
python -m pytest tests/test_database.py -v
python -m pytest tests/test_technical_analysis.py -v
python -m pytest tests/test_portfolio.py -vβ "Module not found" errors
# Make sure you're in the correct directory and dependencies are installed
pip install -r requirements.txtβ "No data available" for stocks
# Test if Yahoo Finance is accessible
python verify_setup.pyβ Email alerts not working
- This is normal! Email is completely optional
- See
docs/EMAIL_SETUP.mdif you want email notifications - All other features work without email setup
β Database errors
- The app automatically creates its SQLite database
- Delete
data/stocks.dbif you want to reset everything
For alert notifications, set up email configuration:
- Create environment variables:
# Windows
set EMAIL_ADDRESS=your-email@gmail.com
set EMAIL_PASSWORD=your-app-password
# Linux/Mac
export EMAIL_ADDRESS=your-email@gmail.com
export EMAIL_PASSWORD=your-app-password- Or create
.streamlit/secrets.toml:
[email]
EMAIL_ADDRESS = "your-email@gmail.com"
EMAIL_PASSWORD = "your-app-password"The application automatically creates a SQLite database in the data/ directory. No additional configuration required.
This application uses Yahoo Finance (yfinance) which provides free stock data without requiring any API keys or subscriptions. Simply install the requirements and start using the app!
- Create an account or login with existing credentials
- Analyze stocks by entering symbols (e.g., AAPL, GOOGL, MSFT)
- Add to portfolio to track your investments
- Set up alerts for price movements
- Explore technical analysis with advanced indicators
- Generate predictions using AI models
- Enter any stock symbol (e.g., AAPL, GOOGL, TSLA)
- Choose analysis timeframe (1mo to 5y)
- View real-time data, charts, and key metrics
- Get automated trading signals
- Add holdings with purchase price and date
- Monitor real-time performance
- View allocation and returns
- Export data for external analysis
- Set price threshold alerts
- Configure percentage change notifications
- Receive email notifications (if configured)
- Track alert history and statistics
- 15+ technical indicators
- Support and resistance levels
- Fibonacci retracement levels
- Advanced charting with multiple timeframes
- Machine learning price forecasting
- Multiple model options (Random Forest, Linear Regression)
- Customizable prediction timeframes
- Model accuracy metrics
This app is deployed on Streamlit Community Cloud. To deploy your own version:
- Fork this repository
- Go to share.streamlit.io
- Connect your GitHub account
- Select your forked repository
- Set the main file path to
app.py(orbase_app.pyfor basic version) - Deploy!
No API keys required! The app uses Yahoo Finance which provides free data.
The app uses environment variables for sensitive data. Create a .streamlit/secrets.toml file for local development (optional):
[email]
GMAIL_EMAIL = "your-email@gmail.com"
GMAIL_APP_PASSWORD = "your-app-password"Email configuration is only needed if you want to receive alert notifications.
Try these popular symbols in the app:
- AAPL - Apple Inc.
- GOOGL - Alphabet Inc.
- MSFT - Microsoft Corporation
- TSLA - Tesla Inc.
- AMZN - Amazon.com Inc.
- NVDA - NVIDIA Corporation
Q: Do I need any API keys?
A: No! The app uses Yahoo Finance which provides free data without requiring API keys.
Q: Do I need to set up email?
A: No, email is completely optional. It's only needed if you want to receive price alert notifications.
Q: What databases do I need to install?
A: None! The app uses SQLite which is built into Python. The database file is created automatically.
Q: Can I use this for real trading?
A: This is for educational and analysis purposes only. Always consult with financial professionals before making investment decisions.
Q: Does this work offline?
A: You need an internet connection to fetch current stock data, but the analysis and portfolio features work with cached data.
Q: Is my data safe?
A: All data is stored locally on your computer in a SQLite database. Nothing is sent to external servers except for fetching stock prices from Yahoo Finance.
This tool is for informational purposes only and should not be considered as financial advice. Always do your own research before making investment decisions.
This project is licensed under the MIT License - see the LICENSE file for details.