SWPTN | R Documentation |
The function computes the price of a Swaption
SWPTN(t_1, f, K, r, t, v, u, type)
t_1 |
tenor of swap in years |
f |
forward price of underlying swap |
K |
strike price |
r |
risk free rate |
t |
time to expiration |
v |
volatility |
u |
number of compoundings per year |
type |
call "C" or put "P" |
It is usual to distinguish between the following: Payer Swaption The right but not the obligation to pay the fixed rate and receive the floating rate in the underlying swap. Receiver Swaption The right but not the obligation to receive the fixed rate and pay the floating rate in the underlying swap.
Price of a Swaption given tenor of swap in years t_1, forward price of underlying swap f, the strike price K, risk free rate r, time to expiration t,the volatility v, number of compoundings per year u and the type call "C" or put "P"
Colzani Luca, Magni Marta, Mancassola Gaia, Kakkanattu Jenson
Espen Gaarder Haug(2007):The Complete Guide to Option Pricing Formulas
SWPTN(4,0.07,0.075,0.06,2,0.2,2,"C") ## The function is currently defined as function (t_1, f, K, r, t, v, u, type) { d1 <- (log(f/K) + (v^(2)/2) * t)/(v * sqrt(t)) d2 <- d1 - v * sqrt(t) if (type == "C") { price <- ((1 - (1/(1 + f/u)^(t_1 * u)))/f) * exp(-r * t) * (f * pnorm(d1) - K * pnorm(d2)) } if (type == "P") { price <- ((1 - (1/(1 + f/u)^(t_1 * u)))/f) * exp(-r * t) * (K * pnorm(-d2) - f * pnorm(-d1)) } return(round(price, 2)) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.