A machine learning project for predicting stock prices using LSTM neural networks. The project includes data collection, feature engineering, model training, and real-time predictions.
- Historical stock data collection using yfinance
- Technical indicator calculation (RSI, MACD, Bollinger Bands, etc.)
- LSTM model for time series prediction
- Feature normalization and preprocessing
- Model training with validation
- Real-time predictions
stock_prediction/
├── src/
│ ├── data/
│ │ ├── __init__.py
│ │ └── collect_data.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── base_model.py
│ │ └── lstm_model.py
│ ├── utils/
│ │ ├── __init__.py
│ │ └── features.py
│ └── api/
│ ├── __init__.py
│ ├── main.py
│ └── dashboard.py
├── data/
├── models/
├── results/
├── requirements.txt
└── README.md
- Clone the repository:
git clone https://github.com/yourusername/stock_prediction.git
cd stock_prediction- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Collect historical stock data:
python src/data/collect_data.py --symbol AAPL --start 2020-01-01- Train the model:
python src/models/train.py --model lstm --symbol AAPL --start 2020-01-01- Make predictions:
python test_model.py- Start the API server:
uvicorn src.api.main:app --reload- Launch the dashboard:
streamlit run src.api.dashboardFeel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is licensed under the MIT License - see the LICENSE file for details.