Technical Methodology

A deep dive into the mathematical frameworks, assumptions, and architectural decisions powering this portfolio.

Heston Stochastic Volatility Model

Options Pricing

The Black-Scholes model assumes constant volatility, which fails to capture the "Volatility Smile" observed in real markets. I implemented the Heston Model (1993), which models volatility as a stochastic process governed by the following Stochastic Differential Equations (SDEs):

The Dynamics (SDEs)

$$ dS_t = \mu S_t dt + \sqrt{v_t} S_t dW_{1,t} $$
$$ dv_t = \kappa(\theta - v_t) dt + \xi \sqrt{v_t} dW_{2,t} $$

Where \( dW_{1,t} \) and \( dW_{2,t} \) are Wiener processes with correlation \( \rho \).
Negative correlation (\( \rho < 0 \)) creates the "skew" (downside crash fear).

Modern Portfolio Theory vs. HRP

Asset Allocation

Traditional Mean-Variance Optimization (MVO) is mathematically elegant but practically unstable. It is a "garbage-in, garbage-out" system where small errors in expected returns lead to extreme corner solutions.

To solve this, I implemented Hierarchical Risk Parity (HRP), a machine learning approach that uses clustering to allocate capital more robustly.

Mean-Variance (Markowitz)

Solves the quadratic programming problem to minimize variance for a target return.

$$ \min w^T \Sigma w $$ $$ s.t. \sum w_i = 1, w_i \ge 0 $$

Flaw: Inverts the covariance matrix \( \Sigma^{-1} \), amplifying noise and estimation errors.

Hierarchical Risk Parity

Uses graph theory to cluster assets (e.g., Tech vs. Energy) and allocates risk recursively down the tree.

  • Step 1: Clustering (Linkage)
  • Step 2: Matrix Seriation (Quasi-Diag)
  • Step 3: Recursive Bisection

Edge: No matrix inversion needed. Highly robust to market shocks.

Automated Valuation Engine (DCF)

Intrinsic Value

The Valuation Sandbox is an institutional-grade Discounted Cash Flow (DCF) engine designed for rapid fundamental analysis. It automates the retrieval of financial statements (via Yahoo Finance API) and constructs a dynamic 2-stage valuation model.

1. Free Cash Flow Forecast

The engine projects Unlevered Free Cash Flow (UFCF) for an explicit forecast period (5 years) based on user-defined growth assumptions.

$$ \text{PV}_{\text{Explicit}} = \sum_{t=1}^{5} \frac{\text{UFCF}_t}{(1 + \text{WACC})^t} $$

2. Terminal Value

Users can toggle between Perpetuity Growth (Gordon Growth) and Exit Multiple methods to capture value beyond the forecast horizon.

$$ \text{TV}_{\text{Growth}} = \frac{\text{UFCF}_5 \times (1+g)}{\text{WACC} - g} $$

Enterprise to Equity Bridge

To arrive at the final Intrinsic Value per Share, the model automatically performs the standard bridge adjustments. Net Debt and Share Count are auto-fetched but can be overridden for scenario analysis.

$$ \text{Equity Value} = \text{Enterprise Value} - \text{Net Debt} - \text{Minority Interest} $$
$$ \text{Target Price} = \frac{\text{Equity Value}}{\text{Diluted Shares Outstanding}} $$

Features

  • Sensitivity Matrix: A dynamic data table that visualizes how the target price evolves under different regimes of risk (WACC) and growth.
  • Scenario Overrides: Users can manually stress-test "Net Debt" or "EBITDA" to see how leverage impacts equity value.
  • Excel Export: One-click generation of a fully formula-based Excel model for offline use.

Reverse LBO Solver

Deal Advisory

Standard DCF models are sensitive to WACC and Terminal Growth. In Private Equity, the "Ability to Pay" is often determined by the Maximum Leverage available and a target IRR Floor (usually 20-25%).

The algorithm solves backwards:
1. Calculate Exit Enterprise Value in Year 5.
2. Subtract Net Debt (reduced by FCF paydown).
3. Discount resulting Equity Value by Target IRR (20%).
4. Add Initial Debt Capacity (4.5x EBITDA).

Credit & Insolvency Models

Distressed Debt

Assessing default risk requires a hybrid approach. I combine accounting-based forensics (Altman) with structural market-based models (Merton) to triangulate the true health of a firm.

Structural Model: Merton Distance-to-Default

Based on Merton (1974), we treat a company's Equity as a Call Option on its assets, with the Strike Price equal to its Debt.

$$ E = V_A N(d_1) - D e^{-rT} N(d_2) $$

If the Asset Value \( V_A \) drops below the Debt \( D \), the option is Out-of-the-Money, implying default. The "Distance to Default" measures how many standard deviations the asset value is from this distress barrier.

Accounting Model: Altman Z-Score

$$ Z = 1.2 \underbrace{\left( \frac{\text{Working Cap}}{\text{Total Assets}} \right)}_{\text{Liquidity}} + 1.4 \underbrace{\left( \frac{\text{Retained Earnings}}{\text{Total Assets}} \right)}_{\text{Accumulated Profit}} $$ $$ + 3.3 \underbrace{\left( \frac{\text{EBIT}}{\text{Total Assets}} \right)}_{\text{Operating Efficiency}} + 0.6 \underbrace{\left( \frac{\text{Market Cap}}{\text{Total Liabilities}} \right)}_{\text{Solvency}} $$ $$ + 1.0 \underbrace{\left( \frac{\text{Sales}}{\text{Total Assets}} \right)}_{\text{Asset Turnover}} $$

Statistical Arbitrage (Pairs)

Quant Trading

Correlation is not enough for pairs trading; high correlation can break down ("spurious correlation"). Instead, I rely on Cointegration, which tests for a long-term stationary relationship between two non-stationary time series.

Step 1: OLS Regression

We calculate the "Hedge Ratio" \( \beta \) by regressing Asset Y against Asset X.

$$ \log(Y_t) = \alpha + \beta \log(X_t) + \epsilon_t $$

The residual \( \epsilon_t \) is the "Spread."

Step 2: ADF Test

We apply the Augmented Dickey-Fuller test to the spread \( \epsilon_t \).

$$ \Delta y_t = \alpha + \beta t + \gamma y_{t-1} + \dots + e_t $$

If p-value < 0.05, we reject the null hypothesis (Random Walk) and confirm the spread is Mean Reverting.

Value-at-Risk (VaR)

Risk Mgmt

My engine calculates both Parametric VaR (assuming normal distribution) and Historical VaR (using actual past returns). Financial returns exhibit "Fat Tails" (Kurtosis > 3), meaning 3-sigma events happen far more often than a normal distribution predicts.

Parametric Formula

$$ \text{VaR}_{\alpha} = \mu - z_{\alpha} \cdot \sigma $$

Where \( z_{\alpha} \) is the Z-score for the confidence interval (e.g., 1.645 for 95%). Historical VaR simply takes the \( \alpha \)-percentile of the actual return distribution.