Python scripts for four risk measurement models, including Value at Risk (VAR), Conditional Value at Risk (CVaR), Markowitz, and Mean-Variance Model
I compiled 232 indexes based on their closing prices from Tehran's stock market for 103 consecutive months. Each notebook consists of three blocks:
- Data preparation and transforming them into a pseudo-convex matrix (You need
pandas
andnumpy
) - Modeling linear or quadratic programming (You need
gurobipy
and a valid license) - Solving and iterating over different returns to get risk values (You need
matplotlib
)
A sample output (Pareto):
A sample output (Diversifying Power):
A quick note: I transformed the VaR model into a Second Order Cone Program (SOCP) via the epigraph property.