A comprehensive stock prediction application built with React.js frontend, Flask backend, and LSTM machine learning models for accurate 30-day stock price predictions.
- Real-time Stock Charts: Interactive charts using Chart.js and Recharts for visualizing stock price data
- LSTM Predictions: Advanced machine learning models achieving ~87% accuracy on 30-day predictions
- User Authentication: Secure JWT-based authentication system
- Portfolio Management: Track your stock holdings and performance
- Price Alerts: Set custom alerts for price changes (above/below thresholds)
- Watchlist: Add and manage stocks you're interested in
- Reports: Generate PDF reports for portfolio performance, predictions, and transaction history
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- React.js with Hooks
- Axios for API calls
- Chart.js and Recharts for data visualization
- CSS3 with responsive design
- Context API for state management
- Flask with SQLAlchemy
- PostgreSQL database
- JWT for authentication
- Flask-CORS for cross-origin requests
- RESTful API design
- TensorFlow/Keras LSTM models
- Pandas and NumPy for data processing
- Scikit-learn for preprocessing
- Yahoo Finance API for historical data
- Python 3.8+
- Node.js 14+
- PostgreSQL
- Git
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up the database:
# Create PostgreSQL database named 'stockpredictor' # Update .env file with your database credentials
-
Run the Flask app:
python app.py
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Navigate to the ml_model directory:
cd ml_model -
Train the models:
python train.py
Create a .env file in the root directory with the following variables:
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
JWT_SECRET_KEY=your-jwt-secret-key-here
DATABASE_URL=postgresql://username:password@localhost/stockpredictor
CORS_ORIGINS=http://localhost:3000
DEBUG=True
POST /api/auth/register- Register a new userPOST /api/auth/login- Login user
GET /api/stocks/<symbol>- Get historical stock data
GET /api/predictions/<symbol>- Get 30-day price predictions
GET /api/watchlist- Get user's watchlistPOST /api/watchlist- Add stock to watchlistDELETE /api/watchlist/<item_id>- Remove from watchlist
GET /api/alerts- Get user's alertsPOST /api/alerts- Create new alertDELETE /api/alerts/<alert_id>- Delete alert
GET /api/reports/<report_type>- Generate PDF report
- Register/Login to access the application
- Search for stocks using the search bar on the dashboard
- View real-time charts and predictions
- Set up price alerts for stocks you're interested in
- Add stocks to your watchlist
- Generate reports for your portfolio and predictions
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License.