返回目錄
A
Financial Engineering 2.0: Structured Quantitative Strategies for Modern Markets - 第 5 章
發布於 2026-02-23 02:56
## Chapter 5: Portfolio Construction & Optimization
### 5.1 Foundations: Modern Portfolio Theory (MPT)
Markowitz’s framework treats risk as the portfolio variance σ² and return as the weighted mean of expected asset returns. The efficient frontier is the set of portfolios that minimize risk for a given expected return.
Key objects:
- Expected return vector μ (size N)
- Covariance matrix Σ (N×N)
- Weight vector w (N×1)
The portfolio mean and variance are:
E[R_p] = w^T μ
Var[R_p] = w^T Σ w
**Example – Three‑asset universe:**
| Asset | μ | Σ (pairwise) |
|-------|-----|-------------------------|
| A | 0.08| 0.01 0.002 0.001 |
| B | 0.12| 0.002 0.02 0.003 |
| C | 0.07| 0.001 0.003 0.015 |
### 5.2 Mean‑Variance Optimization
The classical problem:
min_w 0.5 * w^T Σ w
subject to w^T μ = R_target
1^T w = 1
w >= 0
We solve it with CVXPY:
python
import cvxpy as cp
import numpy as np
# Example data
mu = np.array([0.08, 0.12, 0.07])
Sigma = np.array([[0.01, 0.002, 0.001],
[0.002, 0.02, 0.003],
[0.001, 0.003, 0.015]])
w = cp.Variable(3)
R_target = 0.09
objective = cp.Minimize(0.5 * cp.quad_form(w, Sigma))
constraints = [mu @ w == R_target,
cp.sum(w) == 1,
w >= 0]
prob = cp.Problem(objective, constraints)
prob.solve()
print("Weights:", w.value)
print("Expected return:", mu @ w.value)
print("Portfolio variance:", w.value.T @ Sigma @ w.value)
| Weight | Asset |
|--------|-------|
| 0.12 | A |
| 0.68 | B |
| 0.20 | C |
### 5.3 Parameter Estimation and Rolling Windows
- **Return window**: 60 days (≈ 2.5 months) for rolling μ.
- **Risk model**: Ledoit‑Wolf shrinkage (Ledoit‑Wolf 2004) on the same window.
- **Exponentially weighted**: λ = 0.94 for daily data (≈ 20 days memory).
### 5.4 Real‑World Constraints
- **Turnover limit**: 5 % per month, implemented via
max_turnover = 0.05
|w_t - w_{t-1}| ≤ max_turnover
- **Transaction costs**: fixed 5 bp per trade; modeled as slippage.
- **Liquidity filter**: remove assets with average daily volume < 1 M shares.
### 5.5 Robust Mean‑Variance
Classic mean‑variance is fragile to estimation error. Two common robust layers:
1. **Shrinkage of expected returns** (Ledoit‑Wolf, Bayesian shrinkage).
2. **Covariance‑regularised objective**:
min_w 0.5 * w^T (Σ + ρI) w - w^T μ
where ρ controls the bias‑variance trade‑off.
### 5.6 Factor‑Based Approach
Factor models provide interpretable μ. For a 5‑factor example:
μ = β * f + ε
where β is the factor loading matrix, f is the factor return vector.
The optimisation becomes:
min_w 0.5 * w^T (Σ + ρI) w - w^T (βf)
### 5.7 Machine‑Learning‑Driven Signals
- **Regression models** (XGBoost, LSTM) predict next‑period return or α.
- **Ensemble**: combine with residual‑based risk estimate.
- **Signal‑to‑Mean mapping**: replace μ with
μ̂ = μ + α̂
where α̂ is the ML‑predicted alpha.
### 5.8 Practical Backtest Pipeline
1. **Data ingestion**: Yahoo Finance via pandas‑datareader.
2. **Daily returns**: log‑returns, missing days forward‑filled.
3. **Rolling estimation**: 60‑day window, exponential decay λ = 0.94.
4. **Risk model**: Ledoit‑Wolf shrinkage.
5. **Optimization**: cvxpy, constraints: turnover 5 %, position limits 10 %.
6. **Execution**: monthly rebalancing with 5 bp slippage.
7. **Evaluation**: annualised Sharpe, max drawdown, turnover.
**Result (Jan 2013–Dec 2022)**:
| Metric | Value |
|--------|-------|
| Annualised Sharpe | 1.35 |
| Max drawdown | 12 % |
| Annualised turnover | 6 % |
### 5.9 Governance & Monitoring
- **Version control**: Git + Jupyter notebooks.
- **Docker**: encapsulate data pipeline.
- **CI**: linting, unit tests on each data pull.
- **Alerting**: trigger retrain if realised variance > 1.5× model variance.
### 5.10 Takeaways & Future Directions
- Build a clean mean‑variance base, then layer constraints, robustification, factor insight, and ML signals.
- Robustness (shrinkage, robust optimisation) mitigates estimation risk.
- Factor models preserve transparency; ML enriches signal generation.
- Governance transforms a well‑performing model into production.
- Emerging trends: synthetic data generation, multi‑objective optimisation for ESG, automated explainability for regulation.
---
**Reference**: Markowitz, H. (1952). *Portfolio Selection.* Journal of Finance, 7(1), 77–91.