Case 02 · Data Modeling

Modeling A-Share Downside Risk

Financial Data Mining course project Role: Solo Tools: Python · pandas · scikit-learn Sample: 452 A-shares · 2005–2026

In risk management, volatility is often not where the pain is. What knocks investors out is drawdown. This project asks a simple question: which stocks are more likely to fall sharply over the next 60 days?

01

The question

Traditional risk measures lean on volatility or beta, but they describe how much price moves, not how deep it can fall. For capital with a longer holding period, the latter is the real constraint.

So I changed the target to the maximum drawdown over the next 60 trading days, used it as the label, and asked which features can separate high-drawdown stocks from low-drawdown ones in advance.

02

What I did

  • Cleaned daily prices for 452 A-shares, 2005–2026: adjustments, suspensions, missing values and the early volatility of newly listed stocks.
  • Built 30+ features across five families: momentum, volatility, liquidity, valuation and financial quality.
  • Constructed labels from the next 60-day maximum drawdown and split train/test by time to avoid look-ahead bias.
  • Ran MiniBatch K-Means into 5 clusters, then Lasso within each cluster for sparse selection, keeping 8 key factors.
03

Method & data

Two steps: cluster first to separate “different kinds of stocks” and address heterogeneity in the full sample; then run Lasso inside each cluster and let the model decide which features deserve to stay.

Evaluation relied on time-series cross-validation, with emphasis on recall for high-drawdown cases — missing one large drawdown costs far more than one false alarm.

Clustering is not about splitting finer; it is about making the regression assumptions hold within each group.
04

Key findings

In a single full-sample model, factor relationships cancel out across stock styles; after clustering, the explanatory power becomes visibly more stable. Eight factors entered the final model, spanning momentum, liquidity and volatility.

452A-share sample
30+candidate features
8factors retained

The biggest takeaway was not model accuracy but process: how the label is defined, how data is split and how metrics are chosen decide whether the conclusion can be trusted.

05

Delivery & reflection

The deliverable is a reproducible Python pipeline: data cleaning, feature construction, clustering, Lasso and backtest evaluation.

With more time, I would add industry neutralization and macro-state variables, and try survival analysis instead of binary classification so that “when it happens” becomes part of the model.

← Previous case: iFlytek Deep Dive Back to home →