How harshnyati/marketlens-explainable-market-trend-forecasting-with-live-performance-tracking works
MarketLens collects hourly candles, builds features, trains and serves calibrated UP/DOWN/NEUTRAL forecasts, explains them with SHAP, and checks predictions against later prices. Users access forecasts, market data, explanations, trends, and live performance through the API or Streamlit dashboard. The README and source index establish several subsystem links, but unsampled implementations leave some internal details unverified; those links are omitted rather than inferred.
Main entry points: database.py Market and Prediction Data · ml_predictor.py Live Predictor · main.py FastAPI Application · scheduler.py Background Scheduler
Components 21
Market Data
- Candle Fetcher
ml/market_data_fetcher.py - Candle Ingestion
app/services/candle_ingester.py - Market and Prediction Data
app/database.py
Forecasting
- Training Data Loader
ml/data_loader.py - Features and Targets
ml/feature_engineering.py - Offline Training
ml/train_offline.py - Trained Models
ml/models
API and Explanations
- Live Predictor
app/services/ml_predictor.py - Prediction Persistence
app/services/prediction_store.py - SHAP Explanations
app/services/explainer.py - FastAPI Application
app/main.py - Market Data Route
app/routes/market_routes.py - Prediction Route
app/routes/predict.py - Explanation Route
app/routes/explain.py
Tracking and Trends
- Background Scheduler
app/scheduler.py - Outcome Tracker
app/services/outcome_tracker.py - Trend Analysis
app/analysis/trend_engine.py - Trend Persistence
app/analysis/save_trends.py
User Interfaces
- Streamlit Dashboard
dashboard/app.py
Other components
- Yahoo Finance
- User
Connections 34
- Yahoo Finance → Candle Fetcher: provides candles
ml/market_data_fetcher.py - Candle Fetcher → Candle Ingestion: fetches candles
app/services/candle_ingester.py - Candle Ingestion → Market and Prediction Data: writes candles
app/services/candle_ingester.py - Market and Prediction Data → Training Data Loader: supplies history
ml/data_loader.py - Training Data Loader → Offline Training: loads data
ml/train_offline.py - Candle Fetcher → Offline Training: fetches training candles
ml/train_offline.py - Offline Training → Features and Targets: builds training features
ml/train_offline.py - Offline Training → Trained Models: produces models
README.md - Live Predictor → Market and Prediction Data: loads candles
app/services/ml_predictor.py - Live Predictor → Candle Ingestion: requests backfill
app/services/ml_predictor.py - Live Predictor → Features and Targets: builds inference features
ml/feature_engineering.py - Live Predictor → Trained Models: loads trained model
README.md - Live Predictor → Prediction Persistence: saves prediction
app/services/ml_predictor.py - Prediction Persistence → Market and Prediction Data: writes prediction
app/services/prediction_store.py - SHAP Explanations → Live Predictor: gets prediction
app/services/explainer.py - SHAP Explanations → Features and Targets: rebuilds features
app/services/explainer.py - SHAP Explanations → Trained Models: loads tree model
README.md - FastAPI Application → Market Data Route: registers route
app/main.py - FastAPI Application → Prediction Route: registers route
app/main.py - FastAPI Application → Explanation Route: registers route
app/main.py - FastAPI Application → Background Scheduler: starts scheduler
app/main.py - Market Data Route → Market and Prediction Data: queries market data
app/routes/market_routes.py - Prediction Route → Live Predictor: requests forecast
app/routes/predict.py - Explanation Route → SHAP Explanations: requests explanation
app/routes/explain.py - Background Scheduler → Candle Ingestion: runs ingestion
app/scheduler.py - Background Scheduler → Outcome Tracker: runs resolution
app/scheduler.py - Background Scheduler → Trend Persistence: runs trend analysis
app/scheduler.py - Outcome Tracker → Market and Prediction Data: resolves outcomes
app/services/outcome_tracker.py - Trend Persistence → Trend Analysis: analyzes trends
app/analysis/save_trends.py - Trend Analysis → Market and Prediction Data: reads market history
app/analysis/trend_engine.py - Trend Persistence → Market and Prediction Data: writes trend insights
app/analysis/save_trends.py - User → Streamlit Dashboard: views insights
README.md - Streamlit Dashboard → FastAPI Application: uses live API
- Streamlit Dashboard → Market and Prediction Data: reads market and performance data
dashboard/app.py