Site icon R-bloggers

Black Lognormal model for Swaption with R code

[This article was first published on K & L Fintech Modeling, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Sang-Heon Lee

This article derives the swaption pricing formula using Black model, which is a lognormal model. We present the detailed calculation example using R code. This work is a prerequisite for the calibratiion of Hull-White or LGM (Linear Gaussian Markov) model.

< !--반응형 last AD....-->< !--horizontal001-->

The calibration of parameters of no-aritrage term structure model such as Ho-Lee, Hull-White, and LGM (Linear Gaussian Markov) requires the minimizing distances between market swaption prices and model prices. Since market quote convention uses Black swaption volatility, we need to convert this volatilities to prices for calibration purpose. At the same time, reflecting low or negative market interest rates, market practices are also changing in two ways. One is black’s lognormal swaption volatility and the other is Bachelier’s normal volatility.

Black Lognormal Model


For \(k=1,2,3,⋯,N\), we assume that floating rate for the period of \(T_{k-1}\) and \(T_{k}\) is determined at time \(T_{k-1}\). Suppose that according to a typical swaption contract, one party receives floating rate and pays fixed rate (\(K\)) at time \(T_{k}\). This constract has a nominal amount of \(L(=1)\) and maturity of \(T_0\). For example, the following figure shows in the case of \(N=6\).


We can understand the structure of swaption from the above figure. At first, time axis consists of option maturity and swap maturity. After expiring option maturity, swap constract begins. The swap rate or fixed rate (black dashed line) is determined by making the present value of fixed legs of the swap equal to the present value of the floating legs, at at time \(t=0\). Therefore, the fixed rate at the inception of the swap contract is the par swap rate. As time goes by, floating rate payments are determined by the future term structure of interest rates. In this case we use forward rates. Swap rate at time \(T_0\) is depicted by green dashed line. Swaption is exercised If \(s(T_0) \gt K\) but not if \(s(T_0)≤K\).

Therefore, payoff at k-th payment date is as follows. \[\begin{align} Lδ_k max(s(T_0 )-K,0), δ_k=T_{k} – T_{k-1} \end{align}\]
Given \(A(t)=\sum_{i=1}^{N} (T_i – T_{i-1} )P(t,T_i) \), define \(f_t\) and \(g_t\) as follows. \[\begin{align} f_t=LA(t) max⁡(s(t)-K,0),g_t=A(t) \end{align}\]
Under the measure in which \(A(t)\) is the numeraire, \(\frac{f_t}{g_t} =L max⁡(s(t)-K,0)\) is martingale so that the present value of the swaption (\(f_0\)) is determined by the following way. \[\begin{align} f_0&=g_0 E_{A} \left[ \frac{f_{T_0}}{g_{T_0}} \right] \\ &=LA(0)E_{A} [max(s(T_0 )-K,0)] \end{align}\]
Therefore, assuming that \(s(T_0)\) follows a log-normal distribution and its volatility is \(σ\), we can find \(f_0\) using the Black-Scholes results. \[\begin{align} f_0=LA(0)[E_A [s(T_0)]Φ(d_1 )-KΦ(d_2 )] \end{align}\] where \[\begin{align} d_1&=\frac{ln {\frac{E_A [s(T_0)]}{K}}+\frac{1}{2} σ^2 T_0}{σ\sqrt{T_0}} \\ d_2&=\frac{ln {\frac{E_A [s(T_0)]}{K}}-\frac{1}{2} σ^2 T_0}{σ\sqrt{T_0}} \end{align}\] and \[\begin{align} E_A [s(T_0 )]=s(0)=\frac{P(0,T_0)-P(0,T_N)}{A(0)}. \end{align}\] Finally, we can get the swaption price using Black’s lognormal model. \[\begin{align} P_{swaption}=LA(0)[s(0)Φ(d_1 )-KΦ(d_2 )] \end{align}\]
(example) Consider a 5-maturity swaption on 3-maturity swap that pays fixed rate of 6.2% and receives floating rate semi-annually. Given a LIBOR zero curve of 6% and a forward swap rate volatility of 20%, find this swaption price.

(solution) Af first, we calculate an annuity factor \[\begin{align} A(0)&=\sum_{k=1}^{6} (T_k-T_{k-1})P(0,T_k) \\ &=\sum_{k=1}^{6} 0.5×e^{-0.06×(5+0.5k)} \\ &≈2.0035 \end{align}\] and calculate a par swap rate \[\begin{align} s(0)&=\frac{P(0,T_0)-P(0,T_6)}{A(0)} \\ &≈\frac{e^{-0.06×5}-e^{-0.06×8}}{2.0035}=0.060911 \end{align}\] and calculate \(d_1, d_2\) \[\begin{align} d_1&=\frac{ln {\frac{s(0)}{K}}+\frac{1}{2} σ^2 T_0}{σ\sqrt{T_0}} \\ &≈\frac{ln {\frac{0.060911}{0.062}}+\frac{1}{2} 0.2^2 × 5}{0.2\sqrt{5}}≈0.1836, \\ d_2&=\frac{ln {\frac{s(0)}{K}}-\frac{1}{2} σ^2 T_0}{σ\sqrt{T_0}} \\ &≈\frac{ln {\frac{0.060911}{0.062}}-\frac{1}{2} 0.2^2 × 5}{0.2\sqrt{5}}≈-0.2636 \end{align}\] Therefore, we can get this swaption price. \[\begin{align} P_{swaption}& =LA(0)[s(0)Φ(d_1 )-KΦ(d_2 )] \\ &≈100×2.0035 \\ &\quad×[0.060911×Φ(0.1836) \\ &\quad\quad -0.062×Φ(-0.2636)] \\ &≈ 2.07 \end{align}\]

< !--콘텐츠 내 자동 삽입 광고 배치하기-->

We can make the following R code to describe the above sequential calculation process.

#=========================================================================#
# Financial Econometrics & Engineering, ML/DL using R, Python, Tensorflow 
# by Sang-Heon Lee 
#
# https://kiandlee.blogspot.com
#————————————————————————-#
# Black swaption formula
#
# P = LA(0)[S(0)Φ(d1) – KΦ(d2)]
#=========================================================================#
 
L     < 100    # nominal amount
dt    < 1/2    # payment frequency (6m)
o.mat < 5      # option maturity
s.mat < 3      # swap maturity
 
sigma < 0.2    # volatility of forward swap rate
K     < 0.062  # fixed rate
 
rt    < 0.06   # zero curve (=constant assumption)
 
# annuity factor A(0)
#
# A0 = sum_{i=1}^{N} ( T(i) – T(i-1) )*P(t,Ti)
#
A0 < sum(rep(dt,6)*exp(rt*(o.mat+seq(dt,6*dt,dt))))
A0
 
# par swap rate
#
# S0 = P(0,T0) – P(0,TN)
#     ——————
#            A(0)
#
s0 < (exp(rt*o.mat)  exp(rt*(o.mat+s.mat)))/A0
s0
 
# d1, d2
#
d1 < (log(s0/K) + 0.5*sigma^2*o.mat )/(sigma*sqrt(o.mat))
d2 < (log(s0/K)  0.5*sigma^2*o.mat )/(sigma*sqrt(o.mat))
d1; d2;
 
# swaption price
#
< L*A0*(s0*pnorm(d1)  K*pnorm(d2))
 
print(paste0(“Black Swaption Price = “, P))
cs

In this R cde, pnorm() is the cumulative standard normal distribution function. The following figure is the output of this R code.


\(\blacksquare\)

To leave a comment for the author, please follow the link and comment on their blog: K & L Fintech Modeling.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.