fin-calc is a collection of Python scripts for quantitative analysis, visualization, and research onstocks and ETFs, designed to supportinvestment strategy development anddata-driven decision-making.
The project focuses on:
-
Building reproducible workflows for fetching, cleaning, and combining financial data.
-
Creating insightful visualizations (e.g. normalized growth, valuation trends, return correlations).
-
Exploring valuation metrics such asShiller CAPE and their predictive power on future returns.
Extends the CAPE analysis to adiverse ETF set (e.g. VOO, SPY, QQQ, VTI, VUG, BND, GLD, IEFA, VWO), combiningbroad market,sector, andinternational funds.
Functions:
-
Downloads ETF price data via
yfinance. -
Merges withShiller’s TR-CAPE data (
ie_data_with_TRCAPE.xls). -
Normalizes and plots ETF growth alongside CAPE.
-
Computes and visualizes correlation between CAPE andforward annualized ETF returns.
Outputs:
-
etfs_vs_cape_timeseries.png: All ETF normalized growth vs CAPE. -
Individual scatter plots per ETF showing CAPE vs forward returns (e.g.
QQQ_cape_vs_fwdreturn.png).
This portfolio optimization tool analyzes the optimal allocation strategy between two ETFs
Functions:
-
Downloads ETF price data via
yfinanceor fetches from local file. -
Statistical: Computes daily/annualized returns, volatility, and correlation, Finds optimal weight allocation using mean-variance optimization
-
Portfolio Simulation: Simulates portfolio performance with quarterly rebalancing
-
Generates Visualization & Reporting
Outputs:
-
CSV Files : Raw data (Date, Open, Close prices), Summary table, Daily portfolio values for optimal allocation, 5 strategy performance files
-
Visualization: 4-panel dashboard PNG
Clone and install dependencies:
git clone https://github.com/<yourname>/fin-calc.git
cd fin-calc
python -m venv .venv
source .venv/bin/activate # or .venv\\Scripts\\activate on Windows
pip install -r requirements.txt📘 Data Sources
- Shiller CAPE / TR-CAPE Data: Robert Shiller’s Yale Data
- yFinance - Yahoo! Finance’s API