CallableBond | R Documentation |
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
## Default S3 method:
CallableBond(bondparams, hullWhite, coupon, dateparams)
bondparams |
a named list whose elements are:
| |||||||||||||||||||||||||||||||||||||
hullWhite |
a named list whose elements are parameters needed to set up a HullWhite pricing engine in QuantLib:
Currently, the codes only support a flat rate yield term structure. For more detail, see QuantLib's doc on HullWhite and TreeCallableFixedBondEngine. | |||||||||||||||||||||||||||||||||||||
coupon |
a numeric vector of coupon rates | |||||||||||||||||||||||||||||||||||||
dateparams |
(Optional) a named list, QuantLib's date parameters of the bond.
See example below. |
Please see any decent Finance textbook for background reading, and the
QuantLib
documentation for details on the QuantLib
implementation.
The CallableBond
function returns an object of class
CallableBond
(which inherits from class
Bond
). It contains a list with the following
components:
NPV |
net present value of the bond |
cleanPrice |
price price of the bond |
dirtyPrice |
dirty price of the bond |
accruedAmount |
accrued amount of the bond |
yield |
yield of the bond |
cashFlows |
cash flows of the bond |
The interface might change in future release as QuantLib
stabilises its own API.
Khanh Nguyen knguyen@cs.umb.edu for the inplementation; Dirk Eddelbuettel edd@debian.org for the R interface;
the QuantLib Group for QuantLib
https://www.quantlib.org/ for details on QuantLib
.
#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,
callSch = callSch)
dateparams <- list(settlementDays=3, calendar="UnitedStates/GovernmentBond",
dayCounter = "ActualActual",
period="Quarterly",
businessDayConvention = "Unadjusted",
terminationDateConvention= "Unadjusted")
coupon <- c(0.0465)
setEvaluationDate(as.Date("2004-11-22"))
CallableBond(bondparams, HullWhite, coupon, dateparams)
#examples using default values
CallableBond(bondparams, HullWhite, coupon)
dateparams <- list(period="Quarterly",
businessDayConvention = "Unadjusted",
terminationDateConvention= "Unadjusted")
CallableBond(bondparams, HullWhite, coupon, dateparams)
bondparams <- list(issueDate = as.Date("2004-09-16"),
maturityDate=as.Date("2012-09-16"))
CallableBond(bondparams, HullWhite, coupon, dateparams)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.