ConvertibleBond: Convertible Bond evaluation for Fixed, Floating and Zero...

Description Usage Arguments Details Value Author(s) References Examples

Description

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

The ConvertibleFloatingCouponBond function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine and BlackScholesMertonProcess The NPV, clean price, dirty price, accrued interest, yield and cash flows of the bond is returned. For detail, see test-suite/convertiblebond.cpp

The ConvertibleZeroCouponBond function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine and BlackScholesMertonProcess 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

1
2
3
4
5
6
## Default S3 method:
ConvertibleFloatingCouponBond(bondparams, iborindex, spread, process, dateparams)
## Default S3 method:
ConvertibleFixedCouponBond(bondparams, coupon, process, dateparams)
## Default S3 method:
ConvertibleZeroCouponBond(bondparams, process, dateparams)

Arguments

bondparams

bond parameters, a named list whose elements are:

issueDate a Date, the bond's issue date
maturityDate a Date, the bond's maturity date
creditSpread a double, credit spread parameter
in the constructor of the bond.
conversitionRatio a double, conversition ratio
parameter in the constructor of the bond.
exercise (Optional) a string, either "eu" for European
option, or "am" for American option.
Default value is 'am'.
faceAmount (Optional) a double, face amount of the bond.
Default value is 100.
redemption (Optional) a double, percentage of the initial
face amount that will be returned at maturity
date. Default value is 100.
divSch (Optional) a data frame whose columns are
"Type", "Amount", "Rate", and "Date"
corresponding to QuantLib's DividendSchedule.
Default value is an empty frame, or no dividend.
callSch (Optional) a data frame whose columns are "Price",
"Type" and "Date" corresponding to QuantLib's
CallabilitySchedule. Defaule is an empty frame,
or no callability.
iborindex

a DiscountCurve object, represents an IborIndex

spread

a double vector, represents paramter 'spreads' in ConvertibleFloatingBond's constructor.

coupon

a double vector of coupon rate

process

arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond.

underlying a double, flat underlying term structure
volatility a double, flat volatility term structure
dividendYield a DiscountCurve object
riskFreeRate a DiscountCurve object
dateparams

(Optional) a named list, QuantLib's date parameters of the bond.

settlementDays (Optional) a double, settlement days.
Default value is 1.
calendar (Optional) a string, either 'us' or 'uk'
corresponding to US Goverment Bond
calendar and UK Exchange calendar.
Default value is 'us'.
dayCounter (Optional) a number or string,
day counter convention.
See Enum. Default value is 'Thirty360'
period (Optional) a number or string,
interest compounding interval. See Enum.
Default value is 'Semiannual'.
businessDayConvention (Optional) a number or string,
business day convention.
See Enum. Default value is 'Following'.

See the examples below.

Details

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

Value

The ConvertibleFloatingCouponBond function returns an object of class ConvertibleFloatingCouponBond (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 ConvertibleFixedCouponBond function returns an object of class ConvertibleFixedCouponBond (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 ConvertibleZeroCouponBond function returns an object of class ConvertibleZeroCouponBond (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

Author(s)

Khanh Nguyen knguyen@cs.umb.edu for the inplementation; Dirk Eddelbuettel edd@debian.org for the R interface; the QuantLib Group for QuantLib

References

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

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#this follow an example in test-suite/convertiblebond.cpp 
params <- list(tradeDate=Sys.Date()-2,
               settleDate=Sys.Date(),
               dt=.25,
               interpWhat="discount",
               interpHow="loglinear")


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

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="ActualActual", 
                   period = "Semiannual", calendar = "us", 
                   businessDayConvention="Following")

lengths <- c(2,4,6,8,10,12,14,16,18,20,22,24,26,28,30)
coupons <- c( 0.0200, 0.0225, 0.0250, 0.0275, 0.0300,
              0.0325, 0.0350, 0.0375, 0.0400, 0.0425,
              0.0450, 0.0475, 0.0500, 0.0525, 0.0550 )
marketQuotes <- rep(100, length(lengths))
curvedateparams <- list(settlementDays=0, period="Annual", 
                   dayCounter="ActualActual", 
                  businessDayConvention ="Unadjusted")
curveparams <- list(method="ExponentialSplinesFitting", 
                    origDate = Sys.Date())
curve <- FittedBondCurve(curveparams, lengths, coupons, marketQuotes, curvedateparams)
iborindex <- list(type="USDLibor", length=6, 
                  inTermOf="Month", term=curve)   
spreads <- c()
#ConvertibleFloatingCouponBond(bondparams, iborindex, spreads, process, dateparams)


#example using default values
#ConvertibleFloatingCouponBond(bondparams, iborindex,spreads, process)

dateparams <- list(settlementDays=3,                    
                   period = "Semiannual", 
                   businessDayConvention="Unadjusted")

bondparams <- list(                  
                   creditSpread=0.005, conversionRatio = 0.0000000001, 
                   issueDate=as.Date(today+2), 
                   maturityDate=as.Date(today+3650))
#ConvertibleFloatingCouponBond(bondparams, iborindex,
#spreads, process, dateparams)



#this follow an example in test-suite/convertiblebond.cpp 
#for ConvertibleFixedCouponBond

#set up arguments to build a pricing engine.
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"
                   )
coupon <- c(0.05)
ConvertibleFixedCouponBond(bondparams, coupon, process, dateparams)

#example with default value
ConvertibleFixedCouponBond(bondparams, coupon, process)

dateparams <- list(settlementDays=3, 
                   dayCounter="Actual360")
ConvertibleFixedCouponBond(bondparams, coupon, process, dateparams)

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



#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)

RQuantLib documentation built on May 2, 2019, 4:48 p.m.