Skip to content

Instantly share code, notes, and snippets.

View jaymon0703's full-sized avatar

Jasen Mackie jaymon0703

View GitHub Profile
@jaymon0703
jaymon0703 / HRP.py
Last active December 17, 2022 10:59
Hierarchical Risk Parity implementation in Python
# Python 3 code
import matplotlib.pyplot as mpl
import scipy.cluster.hierarchy as sch,random
import numpy as np
import pandas as pd
# Now, take corMat and covMat generated from R, input into Marcos' Python, and check output is the same...
col_list = ["IGV.Close", "TLT.Close", "IAU.Close", "IYR.Close"]
corr = pd.read_csv("corMat_23072021.csv", usecols=col_list)