A multi-stock LSTM-based stock prediction and backtesting application.
- Multi-Stock Support: Train a single LSTM model on up to 8 stocks simultaneously
- Advanced Technical Indicators: RSI, Moving Averages, VWAP, EMA, Volatility
- Portfolio Management: Buy/sell signals with position management
- Performance Metrics: Total return, Sharpe ratio, maximum drawdown, win rate
- Interactive UI: Select stocks from popular tickers, adjust sequence length
- Real-time Training: Server-sent events for live progress updates
- Backend: Flask API with LSTM model training and prediction
- Frontend: React with Tailwind CSS for modern UI
- Model: Multi-stock TensorFlow model with LSTM, Dense and Dropout layers
- Data: Yahoo Finance API for historical stock data
git clone https://github.com/xv786vx/lstm-visualizer
cd lstm-visualizercd backend
pip install -r requirements.txt
python app.pycd frontend
npm install
npm start- Select a desired model (LSTM v2 or LSTM Vertige)
- Choose sequence length (10-100 days)
- Set date range (default: 2020-01-01 to 2025-01-01)
- Click "Generate Predictions"
- View performance metrics and prediction plots
POST /train- Submit training requestGET /train/stream- Stream training progress and resultsPOST /validate-tickers- Validate stock tickersGET /earliest-start-date- Get earliest available date for a ticker
The LSTM model uses:
- Sequence length: 10-100 days (user configurable)
- Features: Close price, daily returns, 50MA, 200MA, volatility, RSI, VWAP, 20EMA
- Architecture: LSTM(64) → Dropout(0.2) → LSTM(32) → Dropout(0.2) → Dense(16) → Dense(1)
- Training: Adam optimizer, MSE loss, 20 epochs
- Total Return: Strategy performance vs buy-and-hold
- Sharpe Ratio: Risk-adjusted returns
- Maximum Drawdown: Largest peak-to-trough decline
- Win Rate: Percentage of profitable trades
- Final Portfolio Value: Total value after trading period