Learn R Programming

RQuantLib (version 0.3.4)

ConvertibleZeroCouponBond: Convertible Zero Coupon Bond evaluation

Description

The ConvertibleZeroCouponBond function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html and BlackScholesMertonProcess http://quantlib.org/reference/class_quant_lib_1_1_black_scholes_merton_process.html. The NPV, clean price, dirty price, accrued interest, yield and cash flows of the bond is returned. For detail, see test-suite/convertiblebond.cpp.

Usage

## S3 method for class 'default':
ConvertibleZeroCouponBond(bondparams, process, dateparams)
## S3 method for class 'Bond':
plotundefined
## S3 method for class 'Bond':
printundefined
## S3 method for class 'Bond':
summaryundefined

Arguments

bondparams
bond parameters, a named list whose elements are: ll{ issueDate a Date, the bond's issue date maturityDate a Date, the bond's maturity date creditSpread a double, credit spread para
process
arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond. ll{ underlying a double, flat underlying term structure volatility a double, flat volatility term st
dateparams
(Optional) a named list, QuantLib's date parameters of the bond. ll{ settlementDays (Optional) a double, settlement days. Default value is 1. calendar (Optional) a string, either

Value

  • The ConvertibleZeroCouponBond function returns an object of class ConvertibleZeroCouponBond (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/reference/class_quant_lib_1_1_convertible_zero_coupon_bond.html

Examples

Run this code
#this follow an example in test-suite/convertiblebond.cpp 
params <- list(tradeDate=Sys.Date()-2,
               settleDate=Sys.Date(),
               dt=.25,
               interpWhat="discount",
               interpHow="loglinear")
times <- seq(0,10,.1)


dividendYield <- DiscountCurve(params, list(flat=0.02), times)
riskFreeRate <- DiscountCurve(params, list(flat=0.05), times)

dividendSchedule <- data.frame(Type=character(0), Amount=numeric(0),
                            Rate = numeric(0), Date = as.Date(character(0)))
callabilitySchedule <- data.frame(Price = numeric(0), Type=character(0),
                          Date = as.Date(character(0)))

process <- list(underlying=50, divYield = dividendYield,
                rff = riskFreeRate, volatility=0.15)

today <- Sys.Date()
bondparams <- list(exercise="am", faceAmount=100, divSch = dividendSchedule, 
                   callSch = callabilitySchedule, redemption=100, 
                   creditSpread=0.005, conversionRatio = 0.0000000001, 
                   issueDate=as.Date(today+2), 
                   maturityDate=as.Date(today+3650))
dateparams <- list(settlementDays=3, 
                   dayCounter="Actual360", 
                   period = "Once", calendar = "us", 
                   businessDayConvention="Following"
                   )

ConvertibleZeroCouponBond(bondparams, process, dateparams)

#example with default values
ConvertibleZeroCouponBond(bondparams, process)


bondparams <- list(creditSpread=0.005,
                   conversionRatio=0.0000000001, 
                   issueDate=as.Date(today+2),
                   maturityDate=as.Date(today+3650))

dateparams <- list(settlementDays=3, dayCounter='Actual360')                   
ConvertibleZeroCouponBond(bondparams, process, dateparams)
ConvertibleZeroCouponBond(bondparams, process)

Run the code above in your browser using DataLab