Learn R Programming

RQuantLib (version 0.3.2)

CallableBond: CallableBond evaluation

Description

The CallableBond function sets up and evaluates a callable fixed rate bond using Hull-White model and a TreeCallableFixedBondEngine pricing engine. For more detail, see the source codes in quantlib's example folder, Examples/CallableBond/CallableBond.cpp

Usage

## S3 method for class 'default':
CallableBond(bondparams, hullWhite, coupon, dateparams)
## S3 method for class 'Bond':
plotundefined
## S3 method for class 'Bond':
printundefined
## S3 method for class 'Bond':
summaryundefined

Arguments

bondparams
bond parameters: ll{ faceAmount a double, face amount of the bond issueDate a Date, the bond's issue date maturityDate a Date, the bond's maturity date redemption
hullWhite
arguments that are needed to set up a HullWhite pricing engine in QuantLib: ll{ term a double, to set up a flat rate yield term structure alpha a double, Hull-White model's alpha value sigma
coupon
a double vector of coupon rates
dateparams
QuantLib's date parameters of the bond. ll{ settlementDays a double, settlement days. calendar a string, either 'us' or 'uk' corresponding to US Goverment Bond calendar and UK Exchange calendar.

Value

  • The CallableBond function returns an object of class CallableBond (which inherits from class Bond). It contains a list with the following components:
  • NPVnet present value of the bond
  • cleanPriceprice price of the bond
  • dirtyPricedirty price of the bond
  • accruedAmountaccrued amount of the bond
  • yieldyield of the bond
  • cashFlowscash flows of the bond

Details

Please see any decent Finance textbook for background reading, and the QuantLib documentation for details on the QuantLib implementation.

References

http://quantlib.org for details on QuantLib.

Examples

Run this code
#set-up a HullWhite according to example from QuantLib
HullWhite <- list(term = 0.055, alpha = 0.03, sigma = 0.01,
                  gridIntervals = 40)

#callability schedule dataframe
Price <- rep(as.double(100),24)
Type <- rep(as.character("C"), 24)
Date <- seq(as.Date("2006-09-15"), by = '3 months', length = 24)
callSch <- data.frame(Price, Type, Date)
callSch$Type <- as.character(callSch$Type)

bondparams <- list(faceAmount=100, issueDate = as.Date("2004-09-16"),
                   maturityDate=as.Date("2012-09-16"), redemption=100,
                   callabilitySchedule = callSch)
dateparams <- list(settlementDays=3, calendar="us", 
                   dayCounter = "ActualActual", 
                   period="Quarterly", 
                   businessDayConvention = "Unadjusted", 
                   terminationDateConvention= "Unadjusted")
coupon <- c(0.0465)

CallableBond(bondparams, HullWhite, coupon, dateparams)

Run the code above in your browser using DataLab