An interactive React dashboard for visualizing stock market anomalies detected by a TensorFlow autoencoder model.
- Time series visualization with anomaly detection
- Reconstruction error analysis
- Latent space visualization
- Original vs. reconstructed data comparison for anomalies
- Node.js (v14 or newer)
- npm or yarn
- Python 3.6+ (for the anomaly detection model)
- Clone the repository
git clone https://github.com/yourusername/stock-anomaly-dashboard.git
cd stock-anomaly-dashboard
- Install the React app dependencies
npm install
# or
yarn install
- Install Python dependencies (optional, for running the model)
pip install numpy pandas matplotlib tensorflow scikit-learn plotly yfinance
- Start the React development server
npm start
# or
yarn start
This will open the dashboard in your browser at http://localhost:3000.
- Run the Python anomaly detection model (optional)
python stockwatch_updated.py
This will:
- Download stock data
- Train the autoencoder model
- Detect anomalies
- Export results to
public/data/anomaly_results.json
The dashboard will automatically load data from public/data/anomaly_results.json
if available. If not, it will use sample data for demonstration purposes.
To connect your own anomaly detection results:
- Export your results as a JSON file in the following format:
{
"stockPrices": [
{"date": "2023-01-01", "price": 3000.0, "trend": 3050.0},
...
],
"anomalies": [
{"date": "2023-01-15", "error": 0.075},
...
],
"reconstructionErrors": [
{"date": "2023-01-01", "error": 0.02, "is_anomaly": false, "threshold": 0.05},
...
],
"statistics": {
"mean": 3050.0,
"std": 150.5,
"min": 2800.0,
"max": 3300.0,
"current": 3100.0,
"totalAnomalies": 8,
"anomalyRate": 5.2,
"threshold": 0.05
}
}
- Place the file at
public/data/anomaly_results.json
This project is licensed under the MIT License - see the LICENSE file for details.
- TensorFlow for the autoencoder model
- Recharts for the visualization components