How tamonashroy/price-prediction-app works
Project Type and Purpose
• This is a full-stack, batch-plus-web application for ingesting cryptocurrency price data, performing predictive modeling, and exposing analytics via a Streamlit dashboard.
• Key functions: ETL (Extract from CoinGecko), batch modeling and simulation, storage in SQLite, and a web UI.
File Structure
• Top-level orchestration and deployment:
• Dockerfile, .devcontainer/*, .github/workflows/batch-and-push.yml
• .vscode and .devcontainer for local/remote dev setups
• Core Python modules and scripts:
• Data ingestion: ingest_coins.py, data_ingestion.py, fetch_coinswitch_coins.py
• Database utilities: db_utils.py, db_predictions.py
• Modeling and batch prediction: model.py, daily_batch_predict.py, batch_5day_predictions.csv, etc.
• Simulation/analysis: top5_daily_trade_simulation.py, populate_positions_from_top5.py
• Web app: app.py (Streamlit) plus sidebar and helper modules (coinswitch_sidebar_utils.py, coinswitch_utils.py)
• Persistence:
• SQLite files: coin_prices.db, coin_predictions.db (or predictions.sqlite)
• CSV artifacts for reporting and testing
• Tests: test_coinswith.py
• Config/dependencies: requirements.txt, .gitignore
Extract Architecture Insights from the README
• Docker build and run encapsulate all components.
• The ingestion script writes to coin_prices.db.
• The Streamlit app (app.py) reads from the same mounted volume to surface analytics.
• Model training and prediction logic lives in model.py and auxiliary scripts, producing both DB updates and CSV exports.
Main Components
a. External Data Source:
• CoinGecko API (and optionally CoinSwitch via helper scripts)
b. Data Ingestion Layer:
• ingest_coins.py (ETL jobs)
• Helpers: fetch_coinswitch_coins.py, data-filtering scripts
c. Persistence Layer:
• SQLite instances (coin_prices.db for raw data, coin_predictions.db or predictions.sqlite for model outputs)
• CSV exports for batch reporting
d. Modeling & Batch Processing:
• model.py for feature engineering and training
• daily_batch_predict.py and other batch scripts to run predictions
e. Simulation & Analytics:
• Scripts like top5_daily_trade_simulation.py, populate_positions_from_top5.py that derive portfolio metrics
f. Web UI / Dashboard:
• Streamlit app (app.py) leveraging helper modules for layout and visualization
g. Deployment & CI/CD:
• Docker container wrapping all scripts and dependencies
• GitHub Actions workflow for builds (.github/workflows/batch-and-push.yml)
Relationships and Data Flows
1. CoinGecko API → Data Ingestion Layer
2. Ingestion Layer → coin_prices.db
3. coin_prices.db → Modeling Layer → coin_predictions.db + CSV reports
4. Prediction DB/CSVs → Streamlit UI
5. Optionally: Simulation scripts read both DBs → CSV outputs
• Trigger events: daily cron or manual run inside Docker
Architectural Patterns & Tech
• ETL pipeline for daily data refresh
• Batch-processing for prediction generation
• Monolithic Python codebase inside a single Docker image
• SQLite for lightweight persistence
• Streamlit for rapid dashboarding
• GitHub Actions for CI/CD