Risk Course
Fixed Income Portfolio Risk
Build a fixed income risk engine: DV01, key rate duration, PCA hedging and historical VaR in Python.
Enrol now
- Lifetime access — all lessons & updates
- 11 lessons across 2 structured parts
- Fully worked Jupyter notebooks
- Market datasets + published benchmark prices
- Free lesson previews before you buy
- 14-day money-back guarantee
Secured by a no-questions-asked 14-day refund.
Overview
Introduction
Managing a fixed income portfolio is not just about picking bonds; it is about understanding and controlling the sources of risk at the portfolio level. DV01 tells you how much money you lose on a one-basis-point parallel shift, but real yield curves do not move in parallel — they twist, steepen, flatten and butterfly. Key rate duration, PCA decomposition and multi-method VaR are the tools that bridge the gap between single-bond analytics and portfolio-level risk management.
This course builds a full fixed income risk engine for a 10-bond portfolio. You aggregate DV01 and key rate duration vectors across positions, use principal component analysis to decompose the yield curve's historical covariance into parallel, twist and butterfly factors, and construct a PCA hedge using three liquid futures contracts. Every step is grounded in the mechanics used on a real rates risk desk.
The course then delivers three Value at Risk methodologies for the same portfolio: historical VaR — repricing on 10 years of actual yield curve moves; parametric VaR — the Gaussian closed-form from the DV01 vector and covariance matrix; and Monte Carlo VaR — simulating correlated curve paths. You compare all three, compute backtesting statistics, and finish with a complete picture of how each methodology's assumptions affect the resulting risk number.
Hands-on
The project you'll build
The project builds a risk engine for a portfolio of 10 government bonds spanning the 2Y–30Y range, with mixed long and short positions. You start by computing the DV01 of each bond and aggregating it into a portfolio DV01, then extend to key rate duration: bumping each of the standard key rate tenors (2Y, 5Y, 10Y, 20Y, 30Y) by one basis point and computing the resulting portfolio P&L to build the full KRD profile.
With the risk profile characterised, you run a PCA decomposition on 10 years of daily yield curve changes, extract the three dominant eigenvectors (parallel, twist, butterfly), and project the portfolio's KRD vector onto each factor to compute the portfolio's PC betas. You then solve for the notionals of three futures contracts (2Y, 5Y, 10Y Treasury) that neutralise the first three PC betas — a regression-based hedge that immunises against the most common curve moves.
The final section computes VaR three ways. Historical VaR repricings the portfolio on every daily curve move over the past decade and takes the 1st percentile of the resulting P&L distribution. Parametric VaR uses the Gaussian formula: DV01 vector transpose times the yield covariance matrix times DV01 vector, scaled to 99% confidence. Monte Carlo VaR simulates 10,000 correlated yield curve paths using the PCA factor structure and builds the simulated P&L distribution. All three estimates are compared, and you implement a simple exceedance-based backtest to verify the parametric model.
Outcomes
What you'll learn
Portfolio DV01 aggregation
Compute bond-level DV01 and aggregate it across a mixed long-short portfolio, accounting for notional, sign and basis-point value conventions.
Key rate duration profile
Build the KRD vector for a multi-bond portfolio by bumping key tenors individually and computing the resulting portfolio P&L.
Carry and roll-down analysis
Compute carry (coupon income minus funding cost) and roll-down P&L (yield change as a bond ages along the curve) for the portfolio.
Convexity P&L
Compute the second-order Taylor approximation for the portfolio's P&L under a large yield move using the portfolio convexity.
PCA of yield curve changes
Eigendecompose the historical yield change covariance matrix into parallel, twist and butterfly factors and interpret the variance explained.
PCA hedge construction
Solve for futures notionals that neutralise the portfolio's exposure to the first three principal components.
Historical and parametric VaR
Compute 99% 1-day VaR using historical repricing and the Gaussian parametric formula, and compare the two estimates.
Monte Carlo VaR and backtesting
Simulate correlated curve paths using the PCA factor structure, build the P&L distribution, and run a simple exceedance backtest against historical data.
Stack
Tools & technology
The course teaches a workflow, not just a toolset — here is what we use and what you could swap in.
| Tool | Used for | Alternatives |
|---|---|---|
| Python 3 | DV01 aggregation, KRD computation, PCA, hedge construction and all VaR methodologies | Julia, MATLAB, R |
| NumPy | Matrix operations for the PCA eigendecomposition, portfolio DV01 vector arithmetic and Monte Carlo curve simulation | pandas for data handling, scipy.linalg for more stable eigendecomposition |
| SciPy | Eigendecomposition of the yield covariance matrix and linear regression for hedge notionals | sklearn.decomposition.PCA, numpy.linalg.eig |
| Principal Component Analysis | Decomposing yield curve covariance into parallel, twist and butterfly factors for hedging and Monte Carlo simulation | factor models, DV01-based regression hedging, duration-matching |
| Jupyter | Interactive KRD bar charts, PCA factor plots, VaR distribution histograms and backtest exceedance charts | VS Code, plain Python scripts, Streamlit dashboard |
Syllabus
Course curriculum
11 lessons across 2 parts. Lessons marked Free preview can be read before you enrol.
Part 1 — Portfolio Risk MeasuresDV01, KRD and carry/roll-down across a bond portfolio.
- 1.Fixed income portfolio risk: overviewThe risk measures used on a rates desk and what each one answers.Free preview
- 2.Portfolio DV01 and aggregationSum DV01 positions weighted by notional and sign.Free preview
- 3.Key rate duration profileBuild the KRD vector for a multi-bond portfolio across key tenors.
- 4.Carry and roll-down analysisCompute P&L from coupon income and the roll-down effect.
- 5.Convexity P&LSecond-order yield-move P&L via the convexity adjustment.
Part 2 — PCA Hedging & VaRPCA yield-curve decomposition, hedge optimisation and Value at Risk.
- 1.PCA of the yield curveEigendecompose historical yield changes into parallel, twist and butterfly.
- 2.PCA hedge: neutralise the first three factorsSolve for hedge notionals that zero out the three principal component betas.
- 3.Historical VaRReprice the portfolio on 10 years of historical yield moves and take the percentile.
- 4.Parametric VaRGaussian VaR from the portfolio DV01 vector and the yield covariance matrix.
- 5.Monte Carlo VaRSimulate yield curve paths and build the P&L distribution.
- 6.Conclusion: from risk measurement to risk managementLimits, hedging policies and what a complete risk system looks like.
Before you start
Prerequisites
- Bond pricing fundamentals: discount factors, YTM, modified duration, convexity and DV01 (the Government Bond Analytics course is ideal preparation).
- Basic linear algebra: matrix multiplication, eigendecomposition (we explain the PCA mechanics step by step, but familiarity with eigenvectors is helpful).
- Working Python and NumPy — array operations, matrix algebra, plotting with matplotlib.
- Elementary statistics: variance, covariance matrix, percentile and basic normal distribution properties.
Fit
Who this course is for
Rates portfolio managers
You manage a fixed income portfolio and want a rigorous, Python-based risk engine that goes beyond single-bond analytics to full portfolio KRD and VaR.
Rates risk managers
You oversee a rates book and want to understand the mechanics of the DV01, KRD, PCA hedging and VaR numbers you receive from front office systems.
Quantitative analysts in fixed income
You are building or validating a fixed income risk system and want a clean, from-scratch reference implementation to compare against.
Quant finance students
You are studying fixed income and want to connect textbook risk measures to a working portfolio risk engine with real data and realistic positions.
Faculty
Your instructor
QuantIndex Faculty
QuantIndex Faculty are practising quantitative analysts and former rates risk managers with direct experience building fixed income portfolio risk systems, constructing PCA hedges and computing regulatory VaR for government bond and rates derivative books. The course is written and reviewed by quants who implement these exact risk measures in production and who have presented VaR models to regulators under the FRTB framework.
Benchmarked & verified
Every price you compute is checked against published results from leading textbooks and market data. You do not finish the course hoping your model is right — you finish it knowing.
Questions
Frequently asked questions
What is the advantage of a PCA hedge over a simple duration hedge?
A duration hedge neutralises the portfolio's sensitivity to a parallel shift in yields but leaves it exposed to yield curve twists and butterflies, which are the two largest non-parallel sources of P&L on a rates book. A PCA hedge simultaneously neutralises the portfolio's exposure to the three dominant curve moves, providing much more complete protection with only three hedge instruments.
Why do historical, parametric and Monte Carlo VaR give different answers for the same portfolio?
Each method makes different assumptions. Historical VaR uses the actual empirical distribution of past yield moves and captures fat tails, clustering and non-normality. Parametric VaR assumes normally distributed moves and scales with the square root of time — it is fast but underestimates tail risk in stressed markets. Monte Carlo VaR is as good as its assumed distribution; using PCA-based normal simulation it matches the parametric result but can be extended to non-normal or regime-switching dynamics. The course compares all three and discusses when each is appropriate.
What does the PCA eigendecomposition actually tell me economically?
The first principal component of historical yield changes is always approximately parallel — all tenors move together — and accounts for roughly 70–80% of total variance. The second component is a twist (short rates move opposite to long rates) and adds 10–15%. The third component is a butterfly (intermediate rates move opposite to short and long). These three factors explain over 95% of historical yield curve variance, which is why a three-instrument hedge is sufficient for most practical purposes.
How much historical data do I need for historical VaR, and does the choice matter?
The course uses 10 years of daily yield curve data, which gives roughly 2,500 observations — sufficient for stable 99th-percentile estimates. Using shorter windows (1–3 years) can systematically underestimate VaR in calm periods and overestimate it immediately after a crisis because the window rolls over stressed periods. The FRTB regulatory standard requires at least 10 years including at least one period of significant financial stress.
Is this course relevant if I use a risk system like Bloomberg PORT or Aladdin?
Absolutely. Bloomberg PORT, BlackRock Aladdin and similar platforms implement the same DV01, KRD, PCA and VaR calculations under the hood. Understanding the mechanics makes you a more effective user of those systems — you will know when the output is reasonable, how to interpret edge cases, and what model assumptions are driving each number.
Is there a refund policy?
Yes — a 14-day, no-questions-asked money-back guarantee. If the course is not right for you, email us and we will refund you in full.
Ready to start?
- Lifetime access — all lessons & updates
- 11 lessons across 2 structured parts
- Fully worked Jupyter notebooks
- Market datasets + published benchmark prices
- Free lesson previews before you buy
- 14-day money-back guarantee
Secured by a no-questions-asked 14-day refund.