A Python-based system for analyzing financial assets through empirical return statistics and risk measures.
The project supports real-time data from Yahoo Finance and Stooq, and produces clear Excel-exportable outputs.
-
Data Collection
- Automated download from Yahoo Finance & Stooq
- Custom date range and interval
- Multi-asset support
-
Statistical Analysis
- Log return based calculations
- Mean, Variance, Standard Deviation
- Skewness, Kurtosis
-
Risk Metrics
- Value at Risk (VaR 95% / 99%)
- Expected Shortfall (ES / CVaR)
- Max Drawdown, CAGR, Calmar Ratio
-
Excel Integration
- Auto-export to Excel with structured tabs
- Support for intervals: 1D, 3D, 5D, 10D, 1M, Annual
- Precision formatting & adaptive column widths
The Value at Risk (VaR) and Expected Shortfall (ES) are calculated differently depending on the time horizon:
| Interval | Method | Formula | Output Scale |
|---|---|---|---|
1D, 3D, 5D |
Scaled log-returns | VaR = logVaR_1D * sqrt(n) |
Log-return |
10D, 1M, Annual |
% loss conversion | VaR = - (1 - exp(logVaR_nD)) |
Percentage |
pandasnumpyosyfinancexlsxwriter
Models/
├── Main.py – Main function
├── Export_excel.py – Excel export functions
├── Portfolio_analysis.py – Risk & statistics calculations
├── Download_Stooq.py – Data from stooq
├── Download_Yahoo.py – Data from Yahoo Finance
└── Config.py – Configuration: tickers, sources, intervals, dates
- Data/ – ticker list
- Excels/ – Final Excel outputs with full statistics
- Requirements.txt – List of required Python packages
- README.md – Project documentation and usage guide
- Clone or download
- Install Requirements.txt
- Open
Config.pyand add your tickers (stooq or yfinance) - Set your preferred time frame for the data
- Run Main.py
Author
Miłosz Łebecki (Miloxer02)