Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project — Python, Git & Linux for Finance (ESILV A4)

Online quantitative dashboard built for an Asset Management workflow:

  • Quant A: Single-asset analysis + backtesting strategies
  • Quant B: Multi-asset portfolio simulation + diversification metrics
  • Infra: Linux deployment, auto-refresh, and daily report generated by cron

Deployment

  • Streamlit app deployed on a Linux VM (AWS EC2, Ubuntu) with systemd + cron.

Features (Core requirements)

  • Dynamic Data: Real-time market data retrieval (Yahoo Finance via yfinance) [updates every 5 min].
  • Interactive Dashboard: Single asset analysis + Portfolio simulation.
  • Algorithmic Strategies: Implementation of Buy & Hold and MA Crossover.
  • Bonus ML: Linear Regression model to predict short-term price trends.
  • ** robust Architecture:** Auto-refresh logic (TTL caching) and error handling.
  • Automated Reporting: Daily risk report generated via Cron and stored on the VM.

Repository Structure

Repository Structure

├── app/
│   ├── streamlit_app.py    # Point d'entrée principal
│   ├── pages/              # Modules Quant A et Quant B
│   └── core/               # Logique métier (Data, Calculs, ML)
├── scripts/                # Scripts d'automatisation (Cron)
├── infra/                  # Fichiers de configuration serveur
└── requirements.txt        # Dépendances Python 

Installation (local)

From the repository root: streamlit run app/streamlit_app.py Open: http://localhost:8501

Auto-refresh (5 minutes)

  • Market data retrieval uses @st.cache_data(ttl=300) to refresh data every 5 minutes while limiting API calls.
  • Dashboard refresh uses @st.fragment(run_every=300) to update the interface periodically without reloading the full app.

Daily Report (cron on Linux VM)

  • The script daily_report.py generates a daily text report stored locally on the server: reports/report_YYYY-MM-DD.txt

Cron configuration (every day at 20:00 Paris time)

Edit crontab: crontab -e Add the following line (adapt paths if necessary): 0 20 * * * /home/ubuntu/Project_python_ESILV_A4/.venv/bin/python /home/ubuntu/Project_python_ESILV_A4/daily_report.py >> /home/ubuntu/Project_python_ESILV_A4/reports/cron.log 2>&1

Check logs: tail -n 50 /home/ubuntu/Project_python_ESILV_A4/reports/cron.log

Keep Streamlit running 24/7 (Linux VM)

The application is deployed as a systemd service to ensure continuous availability and automatic restart. Service file: /etc/systemd/system/streamlit.service

[Unit] Description=Streamlit Dashboard After=network.target

[Service] User=ubuntu WorkingDirectory=/home/ubuntu/Project_python_ESILV_A4 Environment="PATH=/home/ubuntu/Project_python_ESILV_A4/.venv/bin" ExecStart=/home/ubuntu/Project_python_ESILV_A4/.venv/bin/streamlit run app/streamlit_app.py --server.port 8501 --server.address 0.0.0.0 Restart=always

[Install] WantedBy=multi-user.target

Enable and start the service: sudo systemctl daemon-reload sudo systemctl enable streamlit sudo systemctl start streamlit sudo systemctl status streamlit

Collaboration workflow (GitHub)

  • Development split into two modules: Quant A and Quant B
  • Separate feature branches used for each module
  • Integration performed via Pull Requests to ensure clean history and proper separation of work

Notes

  • Annualization uses 252 periods/year by default for comparability.
  • Yahoo Finance can be unstable; the code includes retries and empty-data safeguards to prevent crashes.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages