This is a web application that visualizes stock market data and predicts future prices. I built it using Python (Dash) for the interface and added a C++ extension to make the forecasting calculations run faster.
The app has three main sections:
- Visualization: You can pick a stock (like Apple, Amazon, Nvidia) and see its price history, volume, and gross profit over different time ranges.
- Forecasting: This predicts where the stock price might go next. The app currently uses:
- ElasticNet: A linear model that uses past prices to predict future ones (using C++ backend).
- ARIMA: A standard time-series model (simplified for speed).
- Kalman Filter (HFT): A recursive state estimator commonly used in High-Frequency Trading (implemented in C++ for maximum speed).
- Monte Carlo (HFT): Runs 1000 geometric brownian motion simulations to estimate the average future price path (implemented in C++).
- Decomposition: This breaks down the stock price into three parts: the overall trend, seasonal patterns, and random noise.
- Real-Time Data: The app fetches live data from Yahoo Finance. You can enter any stock ticker (e.g., TSLA, NVDA) or cryptocurrency (e.g., BTC-USD) into the input box.
- Auto-Refresh: The dashboard automatically updates every 60 seconds to ensure you always have the latest price information without needing to reload the page.
You'll need Python installed. Here is how to get it running on your machine:
First, grab all the necessary Python libraries.
pip install -r requirements.txtI moved the heavy number-crunching to C++ to speed things up. You need to compile it once before running the app:
python3 setup.py build_ext --inplaceIf you skip this, the app will still work, but it will fall back to the slower Python version.
Run the main script:
python3 app.pyThen open your browser and go to http://127.0.0.1:8050/.
We compared different models to see which one predicted stock prices best (using Mean Absolute Error):
- ElasticNet: 0.615 (Best Performer)
- LSTM: 0.757
- Baseline Naive: 0.996
- ARIMA: 0.716
ElasticNet worked the best for our tests, which is why it's the main focus of this app.
- Luke Denoncourt (Team Lead): LSTM, Regression, Model Predictions. - GitHub
- Michael Casey: Time series decomposition and visualization. - GitHub
- Durgesh Tiwari: ARIMA, Kalman Filter (HFT), Monte Carlo (HFT) implementations, and C++ optimization. - GitHub
- Python: The main logic and UI (Dash, Plotly, Pandas, yfinance).
- C++: Used for the recursive forecasting loop (pybind11).
- Dash Bootstrap Components: For the dark-themed UI layout.