[Rquantlib-commits] r303 - pkg/RQuantLib/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 14 20:53:38 CET 2010


Author: edd
Date: 2010-11-14 20:53:36 +0100 (Sun, 14 Nov 2010)
New Revision: 303

Removed:
   pkg/RQuantLib/man/ConvertibleFixedCouponBond.Rd
   pkg/RQuantLib/man/ConvertibleZeroCouponBond.Rd
   pkg/RQuantLib/man/FixedRateBondPriceByYield.Rd
   pkg/RQuantLib/man/FixedRateBondYield.Rd
   pkg/RQuantLib/man/ZeroPriceByYield.Rd
   pkg/RQuantLib/man/ZeroYield.Rd
   pkg/RQuantLib/man/adjust.Rd
   pkg/RQuantLib/man/advance.Rd
   pkg/RQuantLib/man/businessDaysBetween.Rd
   pkg/RQuantLib/man/dayCount.Rd
   pkg/RQuantLib/man/yearFraction.Rd
Modified:
   pkg/RQuantLib/man/Calendars.Rd
   pkg/RQuantLib/man/ConvertibleFloatingCouponBond.Rd
   pkg/RQuantLib/man/FixedRateBond.Rd
   pkg/RQuantLib/man/ZeroCouponBond.Rd
Log:
this will become known as "the great manual page clean-up and consolidation of Nov 14"
i.e. consolidated some boiler plate repetition for calendar and bond functions into core page


Modified: pkg/RQuantLib/man/Calendars.Rd
===================================================================
--- pkg/RQuantLib/man/Calendars.Rd	2010-11-13 15:49:32 UTC (rev 302)
+++ pkg/RQuantLib/man/Calendars.Rd	2010-11-14 19:53:36 UTC (rev 303)
@@ -10,6 +10,11 @@
 \alias{getHolidayList}
 \alias{holidayList}
 \alias{setCalendarContext}
+\alias{adjust}
+\alias{advance}
+\alias{businessDaysBetween}
+\alias{dayCount}
+\alias{yearFraction}
 \title{Calendar functions from QuantLib}
 \description{
 The \code{isBusinessDay} function evaluates the given dates in the context
@@ -37,6 +42,26 @@
 given dates, with an option to exclude weekends.  \code{holidayList} is
 a deprecated form for this function.
 
+The \code{adjust} function evaluates the given dates in the context
+of the given calendar, and returns a vector that adjusts each input
+dates to the appropriate near business day with respect to the given convention. 
+
+The \code{advance} function evaluates the given dates in the context
+of the given calendar, and returns a vector that advances the given
+dates of the given number of business days and returns the result.
+This functions gets called either with both argument \code{n} and
+\code{timeUnit}, or with argument \code{period}.
+
+The \code{businessDaysBetween} function evaluates two given dates in the context
+of the given calendar, and returns a vector that gives the number of
+business day between.  
+
+The \code{dayCount} function returns the number of day between two dates
+given a day counter, see \link{Enum}.
+
+The \code{yearFraction} function returns year fraction between two dates
+given a day counter, see \link{Enum}.
+
 The \code{setCalendarContext} function sets three values to a singleton
 instance at the C++ layer.
 }
@@ -49,7 +74,15 @@
 getEndOfMonth(calendar="TARGET", dates=Sys.Date())
 endOfMonth(calendar="TARGET", dates=Sys.Date())
 getHolidayList(calendar="TARGET", from=Sys.Date(), to = Sys.Date() + 5, includeWeekends = 0) 
-holidayList(calendar="TARGET", from=Sys.Date(), to = Sys.Date() + 5, includeWeekends = 0) 
+holidayList(calendar="TARGET", from=Sys.Date(), to = Sys.Date() + 5,
+includeWeekends = 0)
+adjust(calendar="TARGET", dates=Sys.Date(), bdc = 0)
+advance(calendar="TARGET", dates=Sys.Date(), n, timeUnit, period, bdc = 0, emr =0)
+%advance(calendar="TARGET", dates=Sys.Date(), period, bdc = 0, emr =0)
+businessDaysBetween(calendar="TARGET", from=Sys.Date(),
+to = Sys.Date() + 5, includeFirst = 1, includeLast = 0) 
+dayCount(startDates, endDates, dayCounters)
+yearFraction(startDates, endDates, dayCounters)
 setCalendarContext(calendar, fixingDays, settleDate)
 }
 \arguments{
@@ -63,6 +96,19 @@
   \item{fixingDays}{An integer for the fixing day period, defaults to 2.}
   \item{settleDate}{A date on which trades settles, defaults to two days
     after the current day.}
+  \item{n}{an integer number}
+  \item{timeUnit}{A value of 0,1,2,3 that corresponds to Days, Weeks,
+    Months, and Year; for more detail, see the QuantLib documentation at
+    \url{http://quantlib.org/reference/group__datetime.html}} 
+  \item{period}{See \link{Enum}}
+  \item{bdc}{Business day convention. By default, this value is 0 and correspond to Following convention}
+  \item{emr}{End Of Month rule, default is false}
+  \item{includeFirst}{boolean that indicates whether the calculation
+    should include the first day. Default = true}
+  \item{includeLast}{Default = false}
+  \item{startDates}{A vector of \code{Date} type.}
+  \item{endDates}{A vector of \code{Date} type.}
+  \item{dayCounters}{A vector of numeric type. See \link{Enum}}
 }
 \value{
   A named vector of booleans each of which is true if the corresponding
@@ -130,6 +176,30 @@
   getHolidayList("UnitedStates", from, to)
   to <- as.Date("2009-10-7")
   getHolidayList("UnitedStates", from, to)
+
+  dates <- seq(from=as.Date("2009-04-07"), to=as.Date("2009-04-14"), by=1)
+
+  adjust("UnitedStates", dates)
+  adjust("UnitedStates/Settlement", dates)      ## same as previous
+  adjust("UnitedStates/NYSE", dates)            ## stocks
+  adjust("UnitedStates/GovernmentBond", dates)  ## bonds
+  adjust("UnitedStates/NERC", dates)            ## energy
+
+  advance("UnitedStates", dates, 10, 0)
+  advance("UnitedStates/Settlement", dates, 10, 1)      ## same as previous
+  advance("UnitedStates/NYSE", dates, 10, 2)            ## stocks
+  advance("UnitedStates/GovernmentBond", dates,  10, 3) ## bonds
+  advance("UnitedStates/NERC", dates, period = 3)       ## energy
+
+  from <- as.Date("2009-04-07")
+  to<-as.Date("2009-04-14")
+  businessDaysBetween("UnitedStates", from, to)
+
+  startDates <- seq(from=as.Date("2009-04-07"), to=as.Date("2009-04-14"),by=1)
+  endDates <- seq(from=as.Date("2009-11-07"), to=as.Date("2009-11-14"), by=1)
+  dayCounters <- c(0,1,2,3,4,5,6,1)
+  dayCount(startDates, endDates, dayCounters)
+  yearFraction(startDates, endDates, dayCounters)
 }
 \keyword{misc}
 

Deleted: pkg/RQuantLib/man/ConvertibleFixedCouponBond.Rd
===================================================================
--- pkg/RQuantLib/man/ConvertibleFixedCouponBond.Rd	2010-11-13 15:49:32 UTC (rev 302)
+++ pkg/RQuantLib/man/ConvertibleFixedCouponBond.Rd	2010-11-14 19:53:36 UTC (rev 303)
@@ -1,143 +0,0 @@
-% $Id: ConvertibleFixedCouponBond 84 2009-06-19 knguyen $
-\name{ConvertibleFixedCouponBond}
-\alias{ConvertibleFixedCouponBond}
-\alias{ConvertibleFixedCouponBond.default}
-\title{Convertible Fixed Coupon Bond evaluation}
-\description{
-The \code{ConvertibleFixedCouponBond} function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine \url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html} and BlackScholesMertonProcess \url{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{
-\method{ConvertibleFixedCouponBond}{default}(bondparams, coupon, process, dateparams)
-}
-\arguments{
-
-\item{bondparams}{bond parameters, a named list whose elements are: 
-  \tabular{ll}{
-    \code{issueDate}     \tab a Date, the bond's issue date\cr
-    \code{maturityDate}  \tab a Date, the bond's maturity date\cr
-    \code{creditSpread}  \tab a double, credit spread parameter \cr 
-    \code{}        \tab  in the constructor of the bond. \cr
-    \code{conversitionRatio}  \tab a double, conversition ratio \cr 
-    \code{}        \tab parameter in the constructor of the bond. \cr
-    \code{exercise} 	\tab (Optional) a string, either "eu" for European \cr
-    \code{}        \tab 	option, or "am" for American option. \cr
-    \code{}        \tab  Default value is 'am'.\cr
-    \code{faceAmount}    \tab (Optional) a double, face amount of the bond.\cr
-    \code{}        \tab  Default value is 100. \cr
-    \code{redemption}    \tab (Optional) a double, percentage of the initial \cr
-    \code{}        \tab 	face amount that will be returned at maturity \cr
-    \code{}        \tab    date. Default value is 100.\cr
-    \code{divSch} \tab (Optional) a data frame whose columns are \cr
-    \code{}        \tab "Type", "Amount", "Rate", and "Date" \cr 
-    \code{}        \tab corresponding to QuantLib's DividendSchedule. \cr
-    \code{}        \tab  Default value is an empty frame, or no dividend. \cr
-    \code{callSch} \tab (Optional) a data frame whose columns are "Price",\cr
-    \code{}        \tab "Type" and "Date" corresponding to QuantLib's \cr
-    \code{}        \tab CallabilitySchedule. Defaule is an empty frame, \cr 
-    \code{}         \tab or no callability.\cr
-  }
-}
-\item{coupon}{a double vector of coupon rate}
-\item{process}{arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond. 
-  \tabular{ll}{
-    \code{underlying} \tab a double, flat underlying term structure \cr
-    \code{volatility} \tab a double, flat volatility term structure \cr
-    \code{dividendYield} \tab a DiscountCurve object \cr
-    \code{riskFreeRate} \tab a DiscountCurve object \cr
-  }
-}
-\item{dateparams}{(Optional) a named list, QuantLib's date parameters of the bond. 
-  \tabular{ll}{
-    \code{settlementDays} \tab (Optional) a double, settlement days. \cr 
-    \code{}        \tab Default value is 1.\cr
-    \code{calendar} \tab (Optional) a string, either 'us' or 'uk' \cr 
-    \code{}        \tab corresponding to US Goverment Bond \cr
-    \code{}		   \tab calendar and UK Exchange calendar.\cr
-    \code{}        \tab  Default value is 'us'.\cr
-    \code{dayCounter} \tab (Optional) a number or string, \cr 
-    \code{}        \tab day counter convention.\cr
-    \code{}        \tab  See \link{Enum}. Default value is 'Thirty360' \cr 
-    \code{period}  \tab (Optional) a number or string, \cr
-    \code{}       \tab  interest compounding interval. See \link{Enum}. \cr
-    \code{}       \tab Default value is 'Semiannual'.\cr
-    \code{businessDayConvention} \tab (Optional) a number or string, \cr 
-    \code{}                 \tab business day convention. \cr 
-    \tab See \link{Enum}. Default value is 'Following'. \cr
-  }
-  See example below.
-}
-}
-\value{
-  The \code{ConvertibleFixedCouponBond} function returns an object of class
-  \code{ConvertibleFixedCouponBond} (which inherits from class 
-  \code{Bond}). It contains a list with the following
-  components:
-  \item{NPV}{net present value of the bond}
-  \item{cleanPrice}{price price of the bond}
-  \item{dirtyPrice}{dirty price of the bond}
-  \item{accruedAmount}{accrued amount of the bond}
-  \item{yield}{yield of the bond}
-  \item{cashFlows}{cash flows of the bond}
-}
-\details{
- Please see any decent Finance textbook for background reading, and the
-  \code{QuantLib} documentation for details on the \code{QuantLib}
-  implementation.
-}
-\references{ 
-\url{http://quantlib.org/reference/class_quant_lib_1_1_convertible_zero_coupon_bond.html}
-}
-\author{Khanh Nguyen \email{knguyen at cs.umb.edu} for the inplementation; Dirk Eddelbuettel \email{edd at debian.org} for the \R interface;
-  the QuantLib Group for \code{QuantLib}
-}
-\examples{
-#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)
-
-                   
-}

Modified: pkg/RQuantLib/man/ConvertibleFloatingCouponBond.Rd
===================================================================
--- pkg/RQuantLib/man/ConvertibleFloatingCouponBond.Rd	2010-11-13 15:49:32 UTC (rev 302)
+++ pkg/RQuantLib/man/ConvertibleFloatingCouponBond.Rd	2010-11-14 19:53:36 UTC (rev 303)
@@ -1,14 +1,41 @@
 % $Id: ConvertibleFloatingCouponBond 84 2009-06-19 knguyen $
-\name{ConvertibleFloatingCouponBond}
+\name{ConvertibleBond}
+\alias{ConvertibleFixedCouponBond}
+\alias{ConvertibleFixedCouponBond.default}
 \alias{ConvertibleFloatingCouponBond}
 \alias{ConvertibleFloatingCouponBond.default}
-\title{Convertible Floating Coupon Bond evaluation}
+\alias{ConvertibleZeroCouponBond}
+\alias{ConvertibleZeroCouponBond.default}
+\title{Convertible Bond evaluation for Fixed, Floating and Zero Coupon}
 \description{
-The \code{ConvertibleFloatingCouponBond} function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine \url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html} and BlackScholesMertonProcess \url{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
+The \code{ConvertibleFixedCouponBond} function setups and evaluates a
+ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine
+\url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html}
+and BlackScholesMertonProcess
+\url{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 
+
+The \code{ConvertibleFloatingCouponBond} function setups and evaluates a
+ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine
+\url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html}
+and BlackScholesMertonProcess
+\url{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 
+
+The \code{ConvertibleZeroCouponBond} function setups and evaluates a
+ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine
+\url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html}
+and BlackScholesMertonProcess
+\url{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{
-\method{ConvertibleFloatingCouponBond}{default}(bondparams, iborindex, 
-                                      spread, process, dateparams)
+\method{ConvertibleFloatingCouponBond}{default}(bondparams, iborindex, spread, process, dateparams)
+\method{ConvertibleFixedCouponBond}{default}(bondparams, coupon, process, dateparams)
+\method{ConvertibleZeroCouponBond}{default}(bondparams, process, dateparams)
 }
 \arguments{
 
@@ -41,6 +68,7 @@
    
 \item{iborindex}{a DiscountCurve object, represents an IborIndex}
 \item{spread}{ a double vector, represents paramter 'spreads' in ConvertibleFloatingBond's constructor. }
+\item{coupon}{a double vector of coupon rate}
 \item{process}{arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond. 
   \tabular{ll}{
     \code{underlying} \tab a double, flat underlying term structure \cr
@@ -49,6 +77,7 @@
     \code{riskFreeRate} \tab a DiscountCurve object \cr
   }
 }
+
 \item{dateparams}{(Optional) a named list, QuantLib's date parameters of the bond. 
   \tabular{ll}{
     \code{settlementDays} \tab (Optional) a double, settlement days. \cr 
@@ -67,7 +96,7 @@
     \code{}                 \tab business day convention. \cr 
     \tab See \link{Enum}. Default value is 'Following'. \cr
   }
-  See example below.
+  See the examples below.
 }
 }
 \value{
@@ -81,6 +110,29 @@
   \item{accruedAmount}{accrued amount of the bond}
   \item{yield}{yield of the bond}
   \item{cashFlows}{cash flows of the bond}
+
+  The \code{ConvertibleFixedCouponBond} function returns an object of class
+  \code{ConvertibleFixedCouponBond} (which inherits from class 
+  \code{Bond}). It contains a list with the following
+  components:
+  \item{NPV}{net present value of the bond}
+  \item{cleanPrice}{price price of the bond}
+  \item{dirtyPrice}{dirty price of the bond}
+  \item{accruedAmount}{accrued amount of the bond}
+  \item{yield}{yield of the bond}
+  \item{cashFlows}{cash flows of the bond}
+
+  The \code{ConvertibleZeroCouponBond} function returns an object of class
+  \code{ConvertibleZeroCouponBond} (which inherits from class 
+  \code{Bond}). It contains a list with the following
+  components:
+  \item{NPV}{net present value of the bond}
+  \item{cleanPrice}{price price of the bond}
+  \item{dirtyPrice}{dirty price of the bond}
+  \item{accruedAmount}{accrued amount of the bond}
+  \item{yield}{yield of the bond}
+  \item{cashFlows}{cash flows of the bond}
+ 
 }
 \details{
  Please see any decent Finance textbook for background reading, and the
@@ -158,4 +210,103 @@
 #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)
+
 }

Deleted: pkg/RQuantLib/man/ConvertibleZeroCouponBond.Rd
===================================================================
--- pkg/RQuantLib/man/ConvertibleZeroCouponBond.Rd	2010-11-13 15:49:32 UTC (rev 302)
+++ pkg/RQuantLib/man/ConvertibleZeroCouponBond.Rd	2010-11-14 19:53:36 UTC (rev 303)
@@ -1,143 +0,0 @@
-% $Id: ConvertibleZeroCouponBond 84 2009-06-19 knguyen $
-\name{ConvertibleZeroCouponBond}
-\alias{ConvertibleZeroCouponBond}
-\alias{ConvertibleZeroCouponBond.default}
-\title{Convertible Zero Coupon Bond evaluation}
-\description{
-The \code{ConvertibleZeroCouponBond} function setups and evaluates a ConvertibleFixedCouponBond using QuantLib's BinomialConvertibleEngine \url{http://quantlib.org/reference/class_quant_lib_1_1_binomial_convertible_engine.html} and BlackScholesMertonProcess \url{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{
-\method{ConvertibleZeroCouponBond}{default}(bondparams, process, dateparams)
-}
-\arguments{
-
-
-\item{bondparams}{bond parameters, a named list whose elements are: 
-  \tabular{ll}{
-    \code{issueDate}     \tab a Date, the bond's issue date\cr
-    \code{maturityDate}  \tab a Date, the bond's maturity date\cr
-    \code{creditSpread}  \tab a double, credit spread parameter \cr 
-    \code{}        \tab  in the constructor of the bond. \cr
-    \code{conversitionRatio}  \tab a double, conversition ratio \cr 
-    \code{}        \tab parameter in the constructor of the bond. \cr
-    \code{exercise} 	\tab (Optional) a string, either "eu" for European \cr
-    \code{}        \tab 	option, or "am" for American option. \cr
-    \code{}        \tab  Default value is 'am'.\cr
-    \code{faceAmount}    \tab (Optional) a double, face amount of the bond.\cr
-    \code{}        \tab  Default value is 100. \cr
-    \code{redemption}    \tab (Optional) a double, percentage of the initial \cr
-    \code{}        \tab 	face amount that will be returned at maturity \cr
-    \code{}        \tab    date. Default value is 100.\cr
-    \code{divSch} \tab (Optional) a data frame whose columns are \cr
-    \code{}        \tab "Type", "Amount", "Rate", and "Date" \cr 
-    \code{}        \tab corresponding to QuantLib's DividendSchedule. \cr
-    \code{}        \tab  Default value is an empty frame, or no dividend. \cr
-    \code{callSch} \tab (Optional) a data frame whose columns are "Price",\cr
-    \code{}        \tab "Type" and "Date" corresponding to QuantLib's \cr
-    \code{}        \tab CallabilitySchedule. Defaule is an empty frame, \cr 
-    \code{}         \tab or no callability.\cr
-  }
-}
-\item{process}{arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond. 
-  \tabular{ll}{
-    \code{underlying} \tab a double, flat underlying term structure \cr
-    \code{volatility} \tab a double, flat volatility term structure \cr
-    \code{dividendYield} \tab a DiscountCurve object \cr
-    \code{riskFreeRate} \tab a DiscountCurve object \cr
-  }
-}
-\item{dateparams}{(Optional) a named list, QuantLib's date parameters of the bond. 
-  \tabular{ll}{
-    \code{settlementDays} \tab (Optional) a double, settlement days. \cr 
-    \code{}        \tab Default value is 1.\cr
-    \code{calendar} \tab (Optional) a string, either 'us' or 'uk' \cr 
-    \code{}        \tab corresponding to US Goverment Bond \cr
-    \code{}		   \tab calendar and UK Exchange calendar.\cr
-    \code{}        \tab  Default value is 'us'.\cr
-    \code{dayCounter} \tab (Optional) a number or string, \cr 
-    \code{}        \tab day counter convention.\cr
-    \code{}        \tab  See \link{Enum}. Default value is 'Thirty360' \cr 
-    \code{period}  \tab (Optional) a number or string, \cr
-    \code{}       \tab  interest compounding interval. See \link{Enum}. \cr
-    \code{}       \tab Default value is 'Semiannual'.\cr
-    \code{businessDayConvention} \tab (Optional) a number or string, \cr 
-    \code{}                 \tab business day convention. \cr 
-    \tab See \link{Enum}. Default value is 'Following'. \cr
-  }
-  See example below.
-}
-}
-\value{
-  The \code{ConvertibleZeroCouponBond} function returns an object of class
-  \code{ConvertibleZeroCouponBond} (which inherits from class 
-  \code{Bond}). It contains a list with the following
-  components:
-  \item{NPV}{net present value of the bond}
-  \item{cleanPrice}{price price of the bond}
-  \item{dirtyPrice}{dirty price of the bond}
-  \item{accruedAmount}{accrued amount of the bond}
-  \item{yield}{yield of the bond}
-  \item{cashFlows}{cash flows of the bond}
-}
-\details{
- Please see any decent Finance textbook for background reading, and the
-  \code{QuantLib} documentation for details on the \code{QuantLib}
-  implementation.
-}
-\references{ 
-\url{http://quantlib.org/reference/class_quant_lib_1_1_convertible_zero_coupon_bond.html}
-}
-\author{
-Khanh Nguyen \email{knguyen at cs.umb.edu} for the inplementation; Dirk Eddelbuettel \email{edd at debian.org} for the \R interface;
-  the QuantLib Group for \code{QuantLib}
-}
-\examples{
-#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)
-
-}

Modified: pkg/RQuantLib/man/FixedRateBond.Rd
===================================================================
--- pkg/RQuantLib/man/FixedRateBond.Rd	2010-11-13 15:49:32 UTC (rev 302)
+++ pkg/RQuantLib/man/FixedRateBond.Rd	2010-11-14 19:53:36 UTC (rev 303)
@@ -2,16 +2,38 @@
 \name{FixedRateBond}
 \alias{FixedRateBond}
 \alias{FixedRateBond.default}
+\alias{FixedRateBondPriceByYield}
+\alias{FixedRateBondPriceByYield.default}
+\alias{FixedRateBondYield}
+\alias{FixedRateBondYield.default}
 \title{Fixed-Rate bond pricing}
 \description{
   The \code{FixedRateBond} function evaluates a fixed 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
+  For more detail, see the source codes in QuantLib's file \code{test-suite/bond.cpp}.
 
+  The \code{FixedRateBondPriceByYield} function calculates the theoretical price of a fixed rate bond from its yield.
+
+  The \code{FixedRateBondYield} function calculates the theoretical yield of a fixed rate bond from its price.
 }
 \usage{
 \method{FixedRateBond}{default}(bond, rates, discountCurve, dateparams )
+
+\method{FixedRateBondPriceByYield}{default}( settlementDays=1, yield, faceAmount, 
+                                 effectiveDate, maturityDate,
+                                 period, calendar="us", 
+                                 rates, dayCounter=2,
+                                 businessDayConvention=0, compound = 0, redemption=100, 
+                                 issueDate)
+
+\method{FixedRateBondYield}{default}( settlementDays=1, price, faceAmount, 
+                                 effectiveDate, maturityDate,
+                                 period, calendar="us", 
+                                 rates, dayCounter=2,
+                                 businessDayConvention=0, 
+                                 compound = 0, redemption=100, 
+                                 issueDate)
 }
 \arguments{
 \item{bond}{bond parameters, a named list whose elements are: 
@@ -71,6 +93,21 @@
   }
   See example below.
 }
+
+\item{settlementDays}{an integer, 1 for T+1, 2 for T+2, etc...}
+\item{yield}{yield of the bond}
+\item{price}{price of the bond}
+\item{effectiveDate}{bond's effective date}
+\item{maturityDate}{bond's maturity date}
+\item{period}{frequency of events,0=NoFrequency, 1=Once, 2=Annual, 3=Semiannual, 4=EveryFourthMonth, 5=Quarterly, 6=Bimonthly ,7=Monthly ,8=EveryFourthWeely,9=Biweekly, 10=Weekly, 11=Daily. For more information, see QuantLib's Frequency class }
+\item{calendar}{Business Calendar. Either \code{us} or \code{uk}}
+\item{faceAmount}{face amount of the bond}
+\item{businessDayConvention}{convention used to adjust a date in case it is not a valid business day. See quantlib for more detail. 0 = Following, 1 = ModifiedFollowing, 2 = Preceding, 3 = ModifiedPreceding, other = Unadjusted}
+\item{dayCounter}{day count convention. 0 = Actual360(), 1 = Actual365Fixed(), 2 = ActualActual(), 3 = Business252(), 4 = OneDayCounter(), 5 = SimpleDayCounter(), all other = Thirty360(). For more information, see QuantLib's DayCounter class}
+\item{compound}{compounding type. 0=Simple, 1=Compounded, 2=Continuous, all other=SimpleThenCompounded. See QuantLib's Compound class}
+\item{redemption}{redemption when the bond expires}
+\item{issueDate}{date the bond is issued}
+
 }
 \value{
   The \code{FixedRateBond} function returns an object of class
@@ -83,6 +120,18 @@
   \item{accruedAmount}{accrued amount of the bond}
   \item{yield}{yield of the bond}
   \item{cashFlows}{cash flows of the bond}
+
+  The \code{FixedRateBondPriceByYield} function returns an object of class
+  \code{FixedRateBondPriceByYield} (which inherits from class 
+  \code{Bond}). It contains a list with the following
+  components:
+  \item{price}{price of the bond}
+
+  The \code{FixedRateBondYield} function returns an object of class
+  \code{FixedRateBondYield} (which inherits from class 
+  \code{Bond}). It contains a list with the following
+  components:
+  \item{yield}{yield of the bond}
 }
 \details{
   A discount curve is built to calculate the bond value. 
@@ -153,6 +202,11 @@
                    period="Annual")
 FixedRateBond(bond, coupon.rate, discountCurve, dateparams)
 
+
+FixedRateBondPriceByYield(,0.0307, 100000, as.Date("2004-11-30"), as.Date("2008-11-30"), 3, , c(0.02875), , , , ,as.Date("2004-11-30"))
+
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rquantlib -r 303


More information about the Rquantlib-commits mailing list