Fixed Income Course

Government Bond Analytics

Price government bonds, compute duration, convexity, DV01 and key rate sensitivities in Python.

Intermediate~8 hours9 lessonsUpdated May 2026

Enrol now

$129one-time payment
  • Lifetime access — all lessons & updates
  • 9 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

Government bonds are the backbone of every fixed-income portfolio, yet most practitioners rely on Bloomberg or Excel for analytics they could not reproduce from scratch. This course closes that gap. You build every risk measure — price, yield, duration, convexity and key rate duration — from first principles in Python, using the same mathematics that underlies the tools on a rates desk.

Duration and convexity are often taught as formulas to memorise. Here they are derived as Taylor-series approximations to bond price sensitivity, so you understand not only how to compute them but why they behave the way they do when the yield curve shifts. The course then goes further, replacing the single parallel-shift assumption with key rate durations — the industry standard for measuring and hedging tenor-specific exposure.

By the end you will have a complete bond analytics suite: a pricing engine that handles settlement and semi-annual coupon conventions, a numerical yield-solver, the full suite of duration and convexity measures, a KRD profile computed with tent-function interpolation, and a portfolio-level hedge constructed from Treasury futures. Every number is verifiable against standard market conventions.

Hands-on

The project you'll build

You begin by building a government bond pricer that prices a portfolio of US Treasuries from a discount curve, handling semi-annual coupon payments and correct settlement-date accrual. On top of that foundation you implement a numerical yield-to-maturity solver — using Brent's method — and verify that re-discounting at the solved yield recovers the input price to the cent.

From yield you derive the full suite of price-sensitivity measures: Macaulay duration (the weighted average time to cash flow), modified duration (the first-order price sensitivity), convexity (the curvature correction), and DV01 (the dollar change per basis-point move). Each measure is computed both analytically and via bump-and-reprice so you understand the approximation error built into the first-order tools.

The course culminates in a key rate duration engine. You implement tent-function interpolation to build shift scenarios at the standard Treasury pillar tenors (2Y, 5Y, 10Y, 30Y), compute the KRD profile for each bond in the portfolio, aggregate to portfolio level, and solve for a futures overlay that neutralises the three canonical curve factors — parallel shift, twist and butterfly. The finished suite is extensible to any government bond market.

Outcomes

What you'll learn

Exact bond pricing

Price fixed-coupon bonds from a discount curve with correct settlement, day-count convention and semi-annual coupon handling.

Numerical yield solving

Implement a robust root-finder (Brent's method) to solve for yield-to-maturity and verify the round-trip price consistency.

Duration & convexity

Derive Macaulay duration, modified duration and convexity from the Taylor-series expansion of the bond price function.

DV01 calculation

Compute DV01 both analytically and via bump-and-reprice and understand the difference between yield DV01 and curve DV01.

Key rate duration

Implement tent-function interpolation to construct localised curve shifts at pillar tenors and compute the full KRD profile.

Parallel / twist / butterfly scenarios

Map key rate durations onto the three canonical curve factors and compute P&L for each stress scenario.

Portfolio-level risk aggregation

Aggregate per-bond KRD vectors to a portfolio level and decompose overall rate risk into tenor buckets.

Futures hedge construction

Solve for a Treasury futures overlay that neutralises parallel, twist and butterfly exposure using portfolio KRD algebra.

Stack

Tools & technology

The course teaches a workflow, not just a toolset — here is what we use and what you could swap in.

ToolUsed forAlternatives
Python 3Primary language for all pricing and risk analyticsJulia, MATLAB, C++
NumPyVectorised cash-flow arrays, discount factors and sensitivity computationsPure Python lists, pandas
SciPyBrent's method root-finder for yield-to-maturity solvingNewton-Raphson, bisection (implemented from scratch)
pandasPortfolio tables, cash-flow schedules and KRD result aggregationNumPy structured arrays, polars
MatplotlibYield curve visualisation, KRD profile bar charts and hedge attribution plotsPlotly, seaborn, Bokeh
JupyterNotebook-driven, step-by-step development with inline results at every stageVS Code, PyCharm, plain .py scripts

Syllabus

Course curriculum

9 lessons across 2 parts. Lessons marked Free preview can be read before you enrol.

Before you start

Prerequisites

  • Working knowledge of Python and NumPy — comfortable writing functions, loops and array operations.
  • Fixed-income fundamentals: what a coupon bond is, what a discount factor means, how yield-to-maturity is defined.
  • Basic calculus at the level of derivatives and Taylor series — the maths is derived from first principles but not re-taught from scratch.
  • No prior derivatives or credit experience is required; this course focuses entirely on cash bonds.

Fit

Who this course is for

Junior rates analysts

You use Bloomberg risk measures every day but want to understand exactly what is being computed and be able to reproduce it yourself.

Fixed-income quant candidates

You are preparing for a quant interview and need a clean, demonstrable implementation of the standard government bond analytics toolkit.

Portfolio managers & strategists

You want to move beyond duration buckets and build a proper KRD-based view of where your rate risk actually lives.

Quant-finance students

You are studying fixed income and want to connect textbook theory — Macaulay duration, DV01, key rate sensitivities — to working, verifiable Python code.

Faculty

Your instructor

QuantIndex Faculty

QuantIndex Faculty are practising quantitative analysts and former rates-desk developers with experience at tier-one banks and asset managers. This course was written by quants who have built and maintained government bond risk systems in production — where getting the DV01 and KRD numbers exactly right is not optional — and reviewed for both mathematical rigour and code quality before publication.

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

How is this different from using QuantLib or a Bloomberg function?

Libraries and terminals give you a number; this course gives you the mathematics and code that produces it. Once you can build the analytics yourself, you can adapt them — non-standard day counts, unusual coupon structures, bespoke scenarios — and you can defend every number in a conversation with a trader or risk manager.

Do I need to know about futures or derivatives?

No deep derivatives knowledge is required. The hedge construction section uses Treasury futures conceptually — you need to know that a futures DV01 can offset bond DV01 — but the course does not price futures or cover margin mechanics. The focus throughout is on the cash bond analytics.

Which government bond market do you use?

The examples use US Treasuries (semi-annual Act/Act coupons, T+1 settlement), but the analytics are general. The course notes explain how to adapt the day-count and settlement logic for Gilts (Act/Act) or German Bunds (30/360) if you need to.

What is the difference between DV01 and modified duration?

Modified duration is the percentage price change per 100-basis-point move in yield; DV01 is the dollar price change per 1-basis-point move. DV01 = (Modified Duration × Price) / 10 000. Both are first-order approximations — the course shows when convexity makes a material difference.

Why do you use tent functions for key rate durations rather than parallel shifts at each tenor?

A pure parallel shift at one tenor is not a localised scenario — it moves the entire curve. Tent functions localise the shock to a single pillar while tapering linearly to zero at adjacent pillars, so each KRD measures sensitivity to that specific part of the curve without contaminating adjacent buckets.

Is there a refund policy?

Yes — a 14-day, no-questions-asked money-back guarantee. If the course is not right for you, contact us within 14 days of purchase and we will refund you in full.

Ready to start?

$129one-time payment
  • Lifetime access — all lessons & updates
  • 9 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.