SabrSwaption {RQuantLib}R Documentation

SABR swaption using vol cube data with bermudan alternative using markovfunctional

Description

SabrSwaption prices a swaption with specified expiration or time range if Bermudan, strike, and maturity, using quantlibs SABR model for europeans and quantlib's markovfunctional for Bermudans. Currently the input is a zero offset log-normal vol surface. An example of a dataset can be found in the dataset rqlib inlcuded with Rquantlib. It is assumed that the swaption is exercisable at the start of a forward start swap if params$european flag is set to TRUE or starting immediately on each reset date (Bermudan) of an existing underlying swap or spot start swap if params$european flag is set to FALSE.

Usage

SabrSwaption(params, ts, volCubeDF,
legparams = list(dayCounter = "Thirty360", fixFreq = "Annual", floatFreq = "Semiannual"),
tsUp01 = NA, tsDn01 = NA, vega = FALSE)

Arguments

params

A list specifying the tradeDate (month/day/year), settlementDate, logical flags payFixed & european (european=FALSE generates Bermudan vlaue), strike, pricing method, and curve construction options (see Examples section below). Curve construction options are interpWhat (possible values are discount, forward, and zero) and interpHow (possible values are linear, loglinear , and spline). Both interpWhat and interpHow are ignored when a flat yield curve is requested, but they must be present nevertheless.

ts

A term structure built with DiscountCurve is required. See the help page for DiscountCurve and example below for details.

volCubeDF

The swaption volatility cube in dataframe format with columns Expiry, Tenor, Spread, and LogNormalVol stored by rows. See the example below.

legparams

A list specifying the dayCounter the day count convention for the fixed leg (default is Thirty360), and fixFreq, fixed coupon frequecny (defualt is Annual), floatFreq, floating leg reset frequency (default is Semiannual).

tsUp01

Discount for a user specied up move in rates.

tsDn01

Discount for a user specied down move in rates.

vega

Discount for a user specied up move.

Details

This function is based on QuantLib Version 1.64. It introduces support for fixed-income instruments in RQuantLib.

Value

SabrSwaption returns a list containing the value of the payer and receiver swaptions at the strike specified in params.

NPV

NPV of swaption in basis points (actual price equals price times notional divided by 10,000)

strike

swaption strike

params

Input parameter list

atmRate

fair rate for swap at swap start date for european or fair swap rate for swap at expiration for bermudan

vol

vol for swaption at swap start date and rate strike for european or vol for swaption for given expiration and strike for bermudan

rcvDv01

reveiver value for a change in rates defined by dv01Up

payDv01

payer value for a change in rates defined by dv01Up

rcvCnvx

reveiver second order value change for a change in rates defined by dv01Up & dv01Dn

payCnvx

payer second order value for a change in rates defined by dv01Up & dv01Dn

strike

swaption strike

Author(s)

Terry Leitch

References

Brigo, D. and Mercurio, F. (2006) Interest Rate Models: Theory and Practice, 2nd Edition, Springer-Verlag, New York.

For information about QuantLib see https://www.quantlib.org/.

For information about RQuantLib see http://dirk.eddelbuettel.com/code/rquantlib.html.

See Also

AffineSwaption

Examples


params <- list(tradeDate=as.Date('2016-2-15'),
               settleDate=as.Date('2016-2-17'),
               startDate=as.Date('2017-2-17'),
               maturity=as.Date('2022-2-17'),
               european=TRUE,
               dt=.25,
               expiryDate=as.Date('2017-2-17'),
               strike=.02,
               interpWhat="discount",
               interpHow="loglinear")

# Set leg paramters for generating discount curve
dclegparams=list(dayCounter="Thirty360",
                 fixFreq="Annual",
                 floatFreq="Semiannual")

setEvaluationDate(as.Date("2016-2-15"))
times<-times <- seq(0,14.75,.25)

data(tsQuotes)
dcurve <- DiscountCurve(params, tsQuotes, times=times,dclegparams)

# Price the Bermudan swaption
swaplegparams=list(fixFreq="Semiannual",floatFreq="Quarterly")

data(vcube)
pricing <- SabrSwaption(params, dcurve,vcube,swaplegparams)
pricing


[Package RQuantLib version 0.4.23 Index]