Yield Curve Structure
The yield curve is one of the most important tools in fixed income analysis. It visualizes the relationship between bond maturities and their yields, providing insights into market expectations, economic conditions, and investment opportunities. This section introduces the fundamentals of yield curve structure, construction, and interpretation, building on the bond mathematics concepts from Module 10.
What is a Yield Curve?
A yield curve is a graphical representation showing the relationship between the interest rates (yields) of bonds and their time to maturity. It plots:
- X-axis: Time to maturity (from short-term to long-term)
- Y-axis: Yield (interest rate)
Yield curves are essential because they:
- Show how interest rates vary across different maturities
- Reflect market expectations about future interest rates
- Indicate economic conditions and monetary policy stance
- Provide a framework for bond pricing and portfolio construction
- Serve as economic indicators and forecasting tools
Basic Yield Curve Visualization
A typical yield curve shows:
- Short end (0-2 years): Short-term interest rates
- Intermediate (2-10 years): Medium-term interest rates
- Long end (10+ years): Long-term interest rates
The shape of the curve (upward-sloping, downward-sloping, flat, or humped) conveys important information about market expectations and economic conditions.
Python exercise
# Interactive Yield Curve Visualization
# Adjust the sliders to see how different parameters affect the yield curve
# Create an interactive yield curve visualization with HTML5 Canvas and JavaScript
# In Pyodide, we write HTML directly to stdout with special markers
interactive_html = """
<div id="yield-curve-interactive" style="margin: 2em 0; padding: 1.5em; background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
<h3 style="margin-top: 0; color: #1f2937; font-size: 1.25em; font-weight: 600;">Interactive Yield Curve Explorer</h3>
<p style="color: #6b7280; margin-bottom: 1.5em;">Adjust the parameters below to see how they affect the yield curve shape:</p>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5em; margin-bottom: 2em;">
<div style="padding: 1em; background: #f9fafb; border-radius: 6px;">
<label style="display: block; margin-bottom: 0.5em; font-weight: 500; color: #374151;">
Short-term Rate (0-2 years):
</label>
<input type="range" id="short_rate" min="0" max="5" value="2" step="0.1"
style="width: 100%; height: 8px; border-radius: 4px; background: #e5e7eb; outline: none; position: relative;">
<div style="display: flex; justify-content: space-between; font-size: 0.75em; color: #9ca3af; margin-top: 0.25em; margin-bottom: 0.5em;">
<span>0%</span>
<span>5%</span>
</div>
<div style="text-align: center; margin-top: 0.5em;">
<span id="short_rate_value" style="display: inline-block; padding: 0.5em 1em; background: #059669; color: white; font-weight: 600; font-size: 1.1em; border-radius: 6px; min-width: 60px;">2.0%</span>
</div>
</div>
<div style="padding: 1em; background: #f9fafb; border-radius: 6px;">
<label style="display: block; margin-bottom: 0.5em; font-weight: 500; color: #374151;">
Long-term Rate (10+ years):
</label>
<input type="range" id="long_rate" min="0" max="8" value="4" step="0.1"
style="width: 100%; height: 8px; border-radius: 4px; background: #e5e7eb; outline: none; position: relative;">
<div style="display: flex; justify-content: space-between; font-size: 0.75em; color: #9ca3af; margin-top: 0.25em; margin-bottom: 0.5em;">
<span>0%</span>
<span>8%</span>
</div>
<div style="text-align: center; margin-top: 0.5em;">
<span id="long_rate_value" style="display: inline-block; padding: 0.5em 1em; background: #dc2626; color: white; font-weight: 600; font-size: 1.1em; border-radius: 6px; min-width: 60px;">4.0%</span>
</div>
</div>
<div style="padding: 1em; background: #f9fafb; border-radius: 6px;">
<label style="display: block; margin-bottom: 0.5em; font-weight: 500; color: #374151;">
Curve Steepness:
</label>
<input type="range" id="steepness" min="0.1" max="3" value="1" step="0.1"
style="width: 100%; height: 8px; border-radius: 4px; background: #e5e7eb; outline: none; position: relative;">
<div style="display: flex; justify-content: space-between; font-size: 0.75em; color: #9ca3af; margin-top: 0.25em; margin-bottom: 0.5em;">
<span>0.1</span>
<span>3.0</span>
</div>
<div style="text-align: center; margin-top: 0.5em;">
<span id="steepness_value" style="display: inline-block; padding: 0.5em 1em; background: #2563eb; color: white; font-weight: 600; font-size: 1.1em; border-radius: 6px; min-width: 60px;">1.0</span>
</div>
</div>
</div>
<div style="background: white; padding: 1.5em; border-radius: 6px; border: 1px solid #e5e7eb;">
<canvas id="yieldCurveCanvas" width="700" height="700" style="width: 100%; max-width: 700px; height: 700px; border: 1px solid #e5e7eb; border-radius: 4px; display: block;"></canvas>
</div>
<div id="curve-info" style="margin-top: 1em; padding: 1em; background: #eff6ff; border-radius: 6px; border-left: 4px solid #2563eb;">
<p style="margin: 0; color: #1e40af; font-size: 0.9em;">
<strong>Curve Analysis:</strong> <span id="curve_analysis">Normal (upward-sloping) curve indicating expected economic growth.</span>
</p>
</div>
</div>
<script>
(function() {
console.log('[Yield Curve] Script starting...');
function initCanvas() {
console.log('[Yield Curve] Initializing canvas...');
const canvas = document.getElementById('yieldCurveCanvas');
if (!canvas) {
console.error('[Yield Curve] Canvas element not found');
return;
}
console.log('[Yield Curve] Canvas found:', canvas);
const ctx = canvas.getContext('2d');
if (!ctx) {
console.error('[Yield Curve] Could not get 2D context');
return;
}
console.log('[Yield Curve] Canvas context obtained');
// Set canvas size for high DPI displays
const dpr = window.devicePixelRatio || 1;
const rect = canvas.getBoundingClientRect();
const baseWidth = 700;
const baseHeight = 700;
canvas.width = baseWidth * dpr;
canvas.height = baseHeight * dpr;
ctx.scale(dpr, dpr);
canvas.style.width = baseWidth + 'px';
canvas.style.height = baseHeight + 'px';
}
function drawYieldCurve(shortRate, longRate, steepness) {
console.log('[Yield Curve] Drawing curve with params:', { shortRate, longRate, steepness });
const canvas = document.getElementById('yieldCurveCanvas');
if (!canvas) {
console.error('[Yield Curve] Canvas not found in drawYieldCurve');
return;
}
const ctx = canvas.getContext('2d');
if (!ctx) {
console.error('[Yield Curve] Context not found in drawYieldCurve');
return;
}
const dpr = window.devicePixelRatio || 1;
const width = canvas.width / dpr;
const height = canvas.height / dpr;
console.log('[Yield Curve] Canvas dimensions:', { width, height, dpr });
// Clear canvas
ctx.clearRect(0, 0, width, height);
// Set up axes
const padding = { top: 40, right: 40, bottom: 60, left: 60 };
const plotWidth = width - padding.left - padding.right;
const plotHeight = height - padding.top - padding.bottom;
// Maturities (in years)
const maturities = [0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 30];
const maxMaturity = 30;
const minYield = Math.min(shortRate, longRate) - 0.5;
const maxYield = Math.max(shortRate, longRate) + 0.5;
const yieldRange = maxYield - minYield;
// Calculate yields using exponential interpolation
const yields = maturities.map(m => {
return shortRate + (longRate - shortRate) * (1 - Math.exp(-m * steepness / 10));
});
// Draw grid
ctx.strokeStyle = '#e5e7eb';
ctx.lineWidth = 1;
for (let i = 0; i <= 10; i++) {
const y = padding.top + (plotHeight * i / 10);
ctx.beginPath();
ctx.moveTo(padding.left, y);
ctx.lineTo(width - padding.right, y);
ctx.stroke();
}
for (let i = 0; i <= 6; i++) {
const x = padding.left + (plotWidth * i / 6);
ctx.beginPath();
ctx.moveTo(x, padding.top);
ctx.lineTo(x, height - padding.bottom);
ctx.stroke();
}
// Draw axes
ctx.strokeStyle = '#374151';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(padding.left, padding.top);
ctx.lineTo(padding.left, height - padding.bottom);
ctx.lineTo(width - padding.right, height - padding.bottom);
ctx.stroke();
// Draw yield curve
ctx.strokeStyle = '#2563eb';
ctx.lineWidth = 3;
ctx.beginPath();
for (let i = 0; i < maturities.length; i++) {
const x = padding.left + (maturities[i] / maxMaturity) * plotWidth;
const y = height - padding.bottom - ((yields[i] - minYield) / yieldRange) * plotHeight;
if (i === 0) {
ctx.moveTo(x, y);
} else {
ctx.lineTo(x, y);
}
}
ctx.stroke();
// Draw points
ctx.fillStyle = '#2563eb';
for (let i = 0; i < maturities.length; i++) {
const x = padding.left + (maturities[i] / maxMaturity) * plotWidth;
const y = height - padding.bottom - ((yields[i] - minYield) / yieldRange) * plotHeight;
ctx.beginPath();
ctx.arc(x, y, 5, 0, 2 * Math.PI);
ctx.fill();
}
// Draw labels
ctx.fillStyle = '#374151';
ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
ctx.textAlign = 'center';
// X-axis labels
const xLabels = [0, 5, 10, 15, 20, 25, 30];
xLabels.forEach(maturity => {
const x = padding.left + (maturity / maxMaturity) * plotWidth;
ctx.fillText(maturity + 'Y', x, height - padding.bottom + 20);
});
// Y-axis labels
ctx.textAlign = 'right';
for (let i = 0; i <= 5; i++) {
const yield = minYield + (yieldRange * i / 5);
const y = height - padding.bottom - (plotHeight * i / 5);
ctx.fillText(yield.toFixed(1) + '%', padding.left - 10, y + 4);
}
// Axis titles
ctx.textAlign = 'center';
ctx.font = '14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
ctx.fillStyle = '#1f2937';
ctx.fillText('Maturity (Years)', width / 2, height - 10);
ctx.save();
ctx.translate(20, height / 2);
ctx.rotate(-Math.PI / 2);
ctx.fillText('Yield (%)', 0, 0);
ctx.restore();
// Title
ctx.font = 'bold 16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
ctx.fillText('Yield Curve', width / 2, 25);
// Update analysis
const spread = longRate - shortRate;
let analysis = '';
if (spread > 1.5) {
analysis = 'Steep normal curve - Strong economic growth expected, rising inflation expectations.';
} else if (spread > 0.5) {
analysis = 'Normal (upward-sloping) curve - Expected economic growth and moderate inflation.';
} else if (spread > -0.5) {
analysis = 'Flat curve - Economic uncertainty or transition period.';
} else {
analysis = 'Inverted curve - Recession warning signal, market expects rate cuts.';
}
document.getElementById('curve_analysis').textContent = analysis;
}
// Make updateYieldCurve globally accessible
window.updateYieldCurve = function() {
console.log('[Yield Curve] updateYieldCurve called');
const shortRateEl = document.getElementById('short_rate');
const longRateEl = document.getElementById('long_rate');
const steepnessEl = document.getElementById('steepness');
if (!shortRateEl || !longRateEl || !steepnessEl) {
console.error('[Yield Curve] Slider elements not found');
return;
}
const shortRate = parseFloat(shortRateEl.value);
const longRate = parseFloat(longRateEl.value);
const steepness = parseFloat(steepnessEl.value);
console.log('[Yield Curve] Updated values:', { shortRate, longRate, steepness });
const shortRateValueEl = document.getElementById('short_rate_value');
const longRateValueEl = document.getElementById('long_rate_value');
const steepnessValueEl = document.getElementById('steepness_value');
if (shortRateValueEl) shortRateValueEl.textContent = shortRate.toFixed(1) + '%';
if (longRateValueEl) longRateValueEl.textContent = longRate.toFixed(1) + '%';
if (steepnessValueEl) steepnessValueEl.textContent = steepness.toFixed(1);
drawYieldCurve(shortRate, longRate, steepness);
};
// Initialize when script runs (HTML is already in DOM when this executes)
function tryInit() {
console.log('[Yield Curve] Attempting initialization...');
const canvas = document.getElementById('yieldCurveCanvas');
const shortRateEl = document.getElementById('short_rate');
const longRateEl = document.getElementById('long_rate');
const steepnessEl = document.getElementById('steepness');
if (canvas && shortRateEl && longRateEl && steepnessEl) {
console.log('[Yield Curve] All elements found, initializing...');
initCanvas();
window.updateYieldCurve();
// Attach event listeners to sliders
console.log('[Yield Curve] Attaching event listeners...');
shortRateEl.addEventListener('input', function() {
console.log('[Yield Curve] Short rate slider moved');
window.updateYieldCurve();
});
longRateEl.addEventListener('input', function() {
console.log('[Yield Curve] Long rate slider moved');
window.updateYieldCurve();
});
steepnessEl.addEventListener('input', function() {
console.log('[Yield Curve] Steepness slider moved');
window.updateYieldCurve();
});
console.log('[Yield Curve] Initialization complete!');
return true;
} else {
console.log('[Yield Curve] Elements not ready:', {
canvas: !!canvas,
shortRate: !!shortRateEl,
longRate: !!longRateEl,
steepness: !!steepnessEl
});
}
return false;
}
// Try multiple times to ensure canvas is available
if (!tryInit()) {
console.log('[Yield Curve] First init failed, retrying...');
// If not found, wait a bit and try again
setTimeout(function() {
if (!tryInit()) {
console.log('[Yield Curve] Second init failed, final retry...');
// One more try with longer delay
setTimeout(tryInit, 200);
}
}, 50);
}
})();
</script>
"""
# Write HTML directly to stdout with Pyodide markers
# The PythonSandbox component will detect [HTML_CONTENT] markers and render the HTML
import sys
sys.stdout.write(f"[HTML_CONTENT]{interactive_html}[/HTML_CONTENT]\n")
sys.stdout.flush()
Types of Yield Curves
Different types of yield curves are constructed from different bond markets, each serving different analytical purposes.
Treasury Yield Curve
The Treasury yield curve (also called the risk-free yield curve) is constructed from U.S. Treasury securities:
- Most commonly used yield curve in financial analysis
- Risk-free benchmark for all other fixed income securities
- Liquid market with active trading across all maturities
- Standard maturities: 1-month, 3-month, 6-month, 1-year, 2-year, 3-year, 5-year, 7-year, 10-year, 20-year, 30-year
Uses:
- Benchmark for pricing other bonds
- Indicator of monetary policy expectations
- Economic forecasting tool
- Risk-free rate for valuation models
Corporate Yield Curve
The corporate yield curve shows yields for corporate bonds:
- Credit risk premium: Higher yields than Treasury curve (credit spread)
- Multiple curves: Different curves for different credit ratings (AAA, AA, A, BBB, etc.)
- Liquidity considerations: Less liquid than Treasury market
- Sector variations: Different industries may have different curves
Uses:
- Pricing corporate bonds
- Analyzing credit spreads
- Assessing credit market conditions
- Comparing relative value across credit ratings
Municipal Yield Curve
The municipal yield curve (muni curve) shows yields for state and local government bonds:
- Tax advantages: Tax-exempt interest (lower yields than taxable bonds)
- Tax-equivalent yield: Adjusted yield for tax benefits
- Credit considerations: Varies by issuer credit quality
- Market segmentation: Different from Treasury/corporate markets
Uses:
- Pricing municipal bonds
- Tax-equivalent yield calculations
- Municipal market analysis
- Tax-advantaged portfolio construction
Swap Curve
The swap curve (also called the LIBOR/SOFR curve) shows fixed rates for interest rate swaps:
- Market-based rates: Reflects interbank lending rates
- Liquid derivatives market: Active trading across maturities
- Credit component: Includes bank credit risk (smaller than corporate)
- Forward-looking: Reflects market expectations
Uses:
- Pricing interest rate swaps
- Benchmark for floating-rate instruments
- Corporate bond analysis (swap spread)
- Derivatives valuation
Yield Curve Construction
Constructing a yield curve requires collecting market data, selecting appropriate securities, and applying interpolation methods to create a smooth curve.
Data Sources
Primary Sources:
- Treasury.gov: Official U.S. Treasury yields
- Federal Reserve Economic Data (FRED): Historical yield data
- Bloomberg/Reuters: Real-time market data
- Market quotes: Broker-dealer quotes for specific maturities
Data Requirements:
- On-the-run securities: Most recently issued bonds (most liquid)
- Off-the-run securities: Previously issued bonds (may have liquidity premiums)
- Multiple maturities: Need data points across the maturity spectrum
- Real-time vs. historical: Depends on analytical purpose
Interpolation Methods
Since market data is available only at specific maturities, interpolation is needed to estimate yields at intermediate maturities.
Linear Interpolation:
- Simplest method
- Assumes straight-line relationship between data points
- May not capture curve shape accurately
Cubic Spline Interpolation:
- Smooth curve fitting
- Better captures curve shape
- More complex calculations
- Commonly used in practice
Nelson-Siegel/Svensson Models:
- Parametric curve fitting
- Smooth, economically meaningful curves
- Used by central banks and professional analysts
- (Covered in detail in Section 4)
Bootstrapping
Bootstrapping is the process of deriving spot rates (zero-coupon yields) from market prices of coupon-paying bonds:
- Start with short-term rates: Use Treasury bills (zero-coupon) for short end
- Progress to longer maturities: Use coupon bonds and strip out coupon payments
- Calculate spot rates: Solve for zero-coupon yields that make bond prices equal to market prices
- Build spot rate curve: Construct complete term structure
Example:
- 1-year Treasury bill: 2.0% (spot rate)
- 2-year Treasury bond (3% coupon, trading at par): Calculate 2-year spot rate
- Continue for all maturities
Bootstrapping is essential for:
- Constructing spot rate curves
- Calculating forward rates
- Pricing bonds accurately
- Term structure analysis
Key Points on the Curve
Understanding different segments of the yield curve is crucial for analysis and trading.
Short End (0-2 Years)
The short end of the yield curve includes:
- Maturities: 1-month to 2 years
- Characteristics:
- Most sensitive to monetary policy
- Reflects current interest rate environment
- Low duration risk
- High liquidity
- Key Maturities: 1-month, 3-month, 6-month, 1-year, 2-year
Influences:
- Federal Reserve policy rates
- Short-term economic conditions
- Money market conditions
- Liquidity preferences
Intermediate (2-10 Years)
The intermediate segment includes:
- Maturities: 2 years to 10 years
- Characteristics:
- Balance of policy and economic expectations
- Moderate duration risk
- Good liquidity
- Often most actively traded
- Key Maturities: 2-year, 3-year, 5-year, 7-year, 10-year
Influences:
- Medium-term economic expectations
- Inflation expectations
- Monetary policy outlook
- Economic growth forecasts
Long End (10+ Years)
The long end includes:
- Maturities: 10 years and longer
- Characteristics:
- Most sensitive to long-term expectations
- Highest duration risk
- Lower liquidity (especially very long maturities)
- Reflects inflation and growth expectations
- Key Maturities: 10-year, 20-year, 30-year
Influences:
- Long-term inflation expectations
- Economic growth outlook
- Fiscal policy expectations
- Supply and demand dynamics
- Pension fund and insurance company demand
Key Benchmark Maturities
Certain maturities serve as important benchmarks:
2-Year Treasury:
- Short-to-intermediate benchmark
- Sensitive to monetary policy expectations
- Often used as policy indicator
5-Year Treasury:
- Intermediate benchmark
- Balance of short and long-term factors
- Common trading maturity
10-Year Treasury:
- Most important benchmark
- Long-term risk-free rate
- Used in valuation models (DCF, CAPM)
- Economic indicator
- Global benchmark
30-Year Treasury:
- Long-term benchmark
- Inflation expectations indicator
- Pension fund demand driver
- Longest maturity Treasury
Yield Curve Interpretation
Interpreting yield curves requires understanding what different shapes and levels indicate.
Curve Level
The level of the yield curve (absolute yield levels) indicates:
- Overall interest rate environment: High vs. low rates
- Monetary policy stance: Accommodative vs. restrictive
- Economic conditions: Expansion vs. recession
- Inflation environment: High vs. low inflation expectations
Curve Shape
The shape of the yield curve (relationship between short and long rates) indicates:
- Normal curve (upward-sloping): Economic expansion expected
- Inverted curve (downward-sloping): Recession warning signal
- Flat curve: Economic transition or uncertainty
- Humped curve: Mixed expectations or specific economic conditions
(Curve shapes are covered in detail in Section 2)
Curve Steepness
The steepness of the yield curve (difference between long and short rates) indicates:
- Steep curve: Large spread between long and short rates
- Strong economic growth expected
- Rising inflation expectations
- Monetary policy normalization
- Flat curve: Small spread between long and short rates
- Economic uncertainty
- Policy uncertainty
- Transition period
Practical Applications
Understanding yield curve structure enables:
Bond Pricing
- Use appropriate yield from curve for bond pricing
- Match bond maturity to curve point
- Adjust for credit risk (corporate bonds)
Portfolio Construction
- Duration matching using curve
- Barbell vs. bullet strategies
- Yield curve positioning
Economic Analysis
- Forecast economic conditions
- Assess monetary policy stance
- Predict interest rate movements
Trading Strategies
- Identify relative value opportunities
- Implement curve trades (butterflies, steepeners)
- Carry trades and roll-down strategies
Key Takeaways
Yield curves visualize the relationship between bond maturities and yields, providing essential insights for fixed income analysis.
Different types of yield curves (Treasury, corporate, municipal, swap) serve different analytical purposes and reflect different market segments.
Yield curve construction requires market data collection, interpolation methods, and bootstrapping techniques to create smooth, accurate curves.
Key points on the curve (short end, intermediate, long end) have different characteristics and are influenced by different factors.
Understanding yield curve structure is fundamental for bond pricing, portfolio construction, economic analysis, and trading strategies.
The yield curve is one of the most powerful tools in finance, combining market data, economic theory, and practical applications.
Next: Section 2 explores yield curve shapes (normal, inverted, flat, humped) and their economic implications.