FloatingRateBond {RQuantLib}R Documentation

Fixed rate bond evaluation using discount curve solution

Description

The FloatingRateBond function evaluates a floating rate bond using discount curve. More specificly, the calculation is done by DiscountingBondEngine from QuantLib. The NPV, clean price, dirty price, accrued interest, yield and cash flows of the bond is returned. For more detail, see the source codes in quantlib's test-suite. test-suite/bond.cpp

Usage

## Default S3 method:
FloatingRateBond(bond, gearings, spreads,
                                   caps, floors, index, 
                                   curve, dateparams )
## S3 method for class 'Bond':
plot
## S3 method for class 'Bond':
print
## S3 method for class 'Bond':
summary

Arguments

bond bond parameters:
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 a double, percentage of the initial face amount that will be returned at maturity date. Normally set at 100
effectiveDate a Date, the bond's effective date
gearings a double vectors, gearings paramters of FloatingRateBond's constructor. See quantlib's doc on FloatingRateBond for more detail
spreads a double vectors, spreads paramters of FloatingRateBond's constructor. See quantlib's doc on FloatingRateBond for more detail
caps a double vectors, spreads paramters of FloatingRateBond's constructor. See quantlib's doc on FloatingRateBond for more detail
floors a double vectors, spreads paramters of FloatingRateBond's constructor. See quantlib's doc on FloatingRateBond for more detail
curve a discount curve. Can be on of the following:
a DiscountCurve object
A list that specifies a flat curve in two values "todayDate" and "rate"
A list that specified 3 values to construct a DiscountCurve object, "params" , "tsQuotes", "times". For more detail, see example or the discountCurve function
index IborIndex term structure.
type a string, currently support only "USDLibor"
length an integer, length of the index
inTermOf a string, period unit, currently support only 'Month'
term a DiscountCurve object, the term structure of the index
dateparams A list specifying date paramters, settlemenDays, calendar - a string 'us' or 'uk', businessDayConvention- an integer, dayCounter, period terminationDateConvention - an integer, period - an integer dateGeneration - an integer, endOfMonth - value 1 or 0. For more detail, see Enum and the quantlib docs for FloatingRateBond fixingDays - an integer
See Enum on how each values represents

Details

A discount curve is built to calculate the bond value.

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

Value

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

Note

The interface might change in future release as QuantLib stabilises its own API.

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


bond <- list(faceAmount=100, issueDate=as.Date("2004-11-30"),
             maturityDate=as.Date("2008-11-30"), redemption=100, 
             effectiveDate=as.Date("2004-11-30"))

dateparams <- list(settlementDays=1, calendar="us", dayCounter = 1, period=3, 
                   businessDayConvention = 1, terminationDateConvention=1,
                   dateGeneration=0, endOfMonth=0, fixingDays = 1)

gearings <- c()

spreads <- c()

caps <- c()

floors <- c()

length2 <- list(todayDate=as.Date("2004-11-22"), riskFreeRate=0.025)

params <- list(tradeDate=as.Date('2002-2-15'),
               settleDate=as.Date('2002-2-19'),
               dt=.25,
               interpWhat="discount",
               interpHow="loglinear")

tsQuotes <- list(d1w  =0.0382,
                 d1m  =0.0372,
                 fut1=96.2875,
                 fut2=96.7875,
                 fut3=96.9875,
                 fut4=96.6875,
                 fut5=96.4875,
                 fut6=96.3875,
                 fut7=96.2875,
                 fut8=96.0875,
                 s3y  =0.0398,
                 s5y  =0.0443,
                 s10y =0.05165,
                 s15y =0.055175)

times <- seq(0,10,.1)

length3 <- list(params, tsQuotes, times)

# both curves are flat

curve <- length2
termstructure <- length2
iborindex <- list(type="USDLibor", length=6, 
                  inTermOf="Month", term=termstructure)                      
FloatingRateBond(bond, gearings, spreads, caps, floors, 
                 iborindex, curve, dateparams)

# one flat, another one is constructe

curve <- length2
termstructure <- length3
iborindex <- list(type="USDLibor", length=6, 
                  inTermOf="Month", term = termstructure)                      
FloatingRateBond(bond, gearings, spreads, caps, floors, 
                 iborindex, curve, dateparams)

curve <- length3
termstructure <- length2
iborindex <- list(type="USDLibor", length=6, 
                  inTermOf="Month", term = termstructure)                      
FloatingRateBond(bond, gearings, spreads, caps, floors, 
                 iborindex, curve, dateparams)

# both curves are constructed

curve <- length3
termstructure <- length3
iborindex <- list(type="USDLibor", length=6, 
                  inTermOf="Month", term = termstructure)                      
FloatingRateBond(bond, gearings, spreads, caps, floors, 
                 iborindex, curve, dateparams)

curve2 <- DiscountCurve(params, tsQuotes, times)
index2 <- DiscountCurve(params, tsQuotes, times)
ibor <- list(type="USDLibor", length=6, 
             inTermOf="Month", term = index2)
dateparams <- list(settlementDays=1, calendar="us", dayCounter = "Actual360", 
                   period="Semiannual", 
                   businessDayConvention = "Following", 
                   terminationDateConvention= "Following",
                   dateGeneration= "Forward", 
                   endOfMonth=0, fixingDays = 1)
FloatingRateBond(bond, gearings, spreads, caps, floors,
                  ibor, curve2, dateparams)


[Package RQuantLib version 0.3.2 Index]