Yield Curve Dynamics

A cursory look at the dynamics of ECB zero coupon bond yield curves

yield_curve_dynamics_qr.png

https://github.com/luphord/yield_curve_dynamics

Yield Curve Data by European Central Bank (ECB)

In [2]:
Image('../docs/_static/ecb_screenshot.png', width=600)
Out[2]:

Data Format

ECB publishes the bond yield curve in a parametric form, the so-called Svensson Model. $$y(t) = \beta_0 + \beta_1 \Bigg(\frac{1-e^{\frac{-t}{\tau_1}}}{t / \tau_1}\Bigg) + \beta_2 \Bigg(\frac{1-e^{\frac{-t}{\tau_1}}}{t / \tau_1} - e^{\frac{-t}{\tau_1}}\Bigg) + \beta_3 \Bigg(\frac{1-e^{\frac{-t}{\tau_2}}}{t / \tau_2} - e^{\frac{-t}{\tau_2}}\Bigg)$$

In [3]:
import pandas as pd
pd.read_csv('../data/euryieldcurve.csv', parse_dates=['date'], index_col=0).head()
Out[3]:
beta0 beta1 beta2 beta3 tau1 tau2
date
2009-01-02 0.108792 1.611718 10.426767 -0.958181 12.040810 0.750536
2009-01-05 0.169175 1.509803 10.714462 -1.009914 11.895374 1.047267
2009-01-06 0.010000 1.598177 11.598626 -0.739861 12.388537 1.047100
2009-01-07 0.352788 1.418221 11.118991 -1.540248 13.456747 0.616249
2009-01-08 0.383307 1.493448 10.785753 -2.052377 13.605817 0.617398

Yield Curve Animation

In [9]:
HTML(anim.to_html5_video())
Out[9]:
In [10]:
HTML(anim.to_jshtml())
Out[10]:


Once Loop Reflect

Keyrate Time Series

In [11]:
key_rates = keyrates(curves)
key_rates.plot(figsize=(12,8));

Stationary Log Differences

In [12]:
rate_changes = shifted_log_diff(key_rates)
rate_changes.plot(figsize=(12,8));

Principal Component Analysis

Explained Variance vs. Number of Factors

In [13]:
pca = perform_pca(rate_changes)
plot_pca2(pca);

Principal Component Analysis

The first three factors

In [15]:
plot_pca_components(pca);