Technical Case Study · Quant & Data
Market Sentiment and Financial Volatility Analyzer
8th-semester major project
Empirical econometrics and machine learning platform analyzing whether investor sentiment drives volatility across Nifty 50, BSE Sensex, and Bank Nifty (2007–2024). Combines Nelson’s Exponential GARCH (EGARCH) with a leak-free chronological Random Forest directional classifier and a tri-level real-data sentiment cascade.
Problem Statement
Symmetric GARCH models ignore the financial leverage effect where negative news shocks amplify volatility far more than positive shocks, and random K-fold splits leak future regimes into training.
Deterministic Architecture Advantage
Fits Nelson's asymmetric log-variance EGARCH(1,1) model via Maximum Likelihood alongside a tri-level sentiment cascade (GDELT v2, Google Trends PCA, VADER) and a chronological 80/20 Random Forest regime classifier across 17 years of Nifty 50, Sensex, and Bank Nifty data.
Execution Pipeline & System Topology
OHLCV & Tri-Level Sentiment
Ingests 2007–2024 Yahoo Finance log returns alongside GDELT, Google Trends PCA, and VADER tone.
Asymmetric EGARCH(1,1)
Fits log-variance formulation capturing leverage effect (γ) and sentiment elasticity (δ).
Leak-Free Chronological RF
Trains 200-tree Random Forest on 15 lagged features using a strict 80/20 temporal split.
Streamlit Cloud Analytics
Interactive 6-tab dashboard with Granger Causality tables, ROC curves, and crisis comparisons.
Verification & Engineering Highlights
- Benchmarks Symmetric GARCH(1,1), GJR-GARCH(1,1), and EGARCH(1,1) via Log-Likelihood, AIC, and BIC across Nifty 50, Sensex, and Bank Nifty.
- Tri-level real-data sentiment cascade: GDELT v2 global news tone → Google Trends retail anxiety compressed via Principal Component Analysis (PCA) → VADER financial headlines.
- Includes automated crisis comparative analysis contrasting the 2008 Global Financial Crisis (~24-month prolonged shock) against the 2020 COVID-19 liquidity shock (~89% annualized peak volatility).
from arch import arch_model
import numpy as np
def fit_egarch_volatility_model(returns_series):
# Scale log returns for numerical stability during MLE convergence
scaled_returns = returns_series.dropna() * 100.0
model = arch_model(scaled_returns, vol="EGARCH", p=1, o=1, q=1, dist="normal")
res = model.fit(disp="off")
cond_vol = res.conditional_volatility / 100.0
metrics = {
"omega": float(res.params.get("omega", 0.0)),
"alpha": float(res.params.get("alpha[1]", 0.0)),
"gamma_leverage": float(res.params.get("gamma[1]", 0.0)),
"beta_persistence": float(res.params.get("beta[1]", 0.0)),
"aic": float(res.aic),
"bic": float(res.bic),
}
return cond_vol, metrics