找回密码
 注册
查看: 519|回复: 0

R语言 RQuantLib包 ConvertibleBond()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-28 20:32:30 | 显示全部楼层 |阅读模式
ConvertibleBond(RQuantLib)
ConvertibleBond()所属R语言包:RQuantLib

                                        Convertible Bond evaluation for Fixed, Floating and Zero Coupon
                                         固定,浮动及零息可换股债券评估

                                         译者:生物统计家园网 机器人LoveR

描述----------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
返回ConvertibleFixedCouponBond功能设置和使用QuantLib的BinomialConvertibleEngine和BlackScholesMertonProcess净现值(NPV),清洁,脏的价格,应计利息,收益率的债券和现金流量计算一个ConvertibleFixedCouponBond。有关详细信息,请参阅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
返回ConvertibleFloatingCouponBond功能设置和使用QuantLib的BinomialConvertibleEngine和BlackScholesMertonProcess净现值(NPV),清洁,脏的价格,应计利息,收益率的债券和现金流量计算一个ConvertibleFixedCouponBond。有关详细信息,请参阅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.
返回ConvertibleZeroCouponBond功能设置和使用QuantLib的BinomialConvertibleEngine和BlackScholesMertonProcess净现值(NPV),清洁,脏的价格,应计利息,收益率的债券和现金流量计算一个ConvertibleFixedCouponBond。有关详细信息,请参阅test-suite/convertiblebond.cpp。


用法----------Usage----------


## 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:    <table summary="Rd table"> <tr>  <td align="left"> issueDate     </td><td align="left"> a Date, the bond's issue date</td> </tr> <tr>  <td align="left"> maturityDate  </td><td align="left"> a Date, the bond's maturity date</td> </tr> <tr>  <td align="left"> creditSpread  </td><td align="left"> a double, credit spread parameter </td> </tr> <tr>  <td align="left">          </td><td align="left">  in the constructor of the bond. </td> </tr> <tr>  <td align="left"> conversitionRatio  </td><td align="left"> a double, conversition ratio </td> </tr> <tr>  <td align="left">          </td><td align="left"> parameter in the constructor of the bond. </td> </tr> <tr>  <td align="left"> exercise         </td><td align="left"> (Optional) a string, either "eu" for European </td> </tr> <tr>  <td align="left">         </td><td align="left">         option, or "am" for American option. </td> </tr> <tr>  <td align="left">         </td><td align="left">  Default value is 'am'.</td> </tr> <tr>  <td align="left"> faceAmount    </td><td align="left"> (Optional) a double, face amount of the bond.</td> </tr> <tr>  <td align="left">         </td><td align="left">  Default value is 100. </td> </tr> <tr>  <td align="left"> redemption    </td><td align="left"> (Optional) a double, percentage of the initial </td> </tr> <tr>  <td align="left">         </td><td align="left">         face amount that will be returned at maturity </td> </tr> <tr>  <td align="left">         </td><td align="left">    date. Default value is 100.</td> </tr> <tr>  <td align="left"> divSch </td><td align="left"> (Optional) a data frame whose columns are </td> </tr> <tr>  <td align="left">         </td><td align="left"> "Type", "Amount", "Rate", and "Date" </td> </tr> <tr>  <td align="left">          </td><td align="left"> corresponding to QuantLib's DividendSchedule. </td> </tr> <tr>  <td align="left">         </td><td align="left">  Default value is an empty frame, or no dividend. </td> </tr> <tr>  <td align="left"> callSch </td><td align="left"> (Optional) a data frame whose columns are "Price",</td> </tr> <tr>  <td align="left">         </td><td align="left"> "Type" and "Date" corresponding to QuantLib's </td> </tr> <tr>  <td align="left">         </td><td align="left"> CallabilitySchedule. Defaule is an empty frame, </td> </tr> <tr>  <td align="left">   </td><td align="left"> or no callability.</td> </tr> <tr>  <td align="left"> </td> </tr>  </table>  
键参数,命名列表,其元素是:<table summary="Rd table"> <TR> <td ALIGN="LEFT"> issueDate</ TD> <TD ALIGN="LEFT">一个日期,债券的发行日期</ TD> </ TR> <TR> <td ALIGN="LEFT">maturityDate </ TD> <TD ALIGN="LEFT">日期,债券的到期日期</ TD > </ TR> <TR> <td ALIGN="LEFT">creditSpread </ TD> <TD ALIGN="LEFT">了一倍,信用利差参数</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">在构造的债券。 </ TD> </ TR> <TR> <td ALIGN="LEFT">conversitionRatio </ TD> <TD ALIGN="LEFT">了一倍,conversition的比例</ TD> </ TR> < TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">参数的构造函数中的债券。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> exercise </ TD> <TD ALIGN="LEFT">(可选)一个字符串,要么是“欧盟”欧洲</ TD> </ TR> <TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">选项,或“AM”为美式期权。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">默认值是是。</ TD> </ TR文章<td ALIGN="LEFT"> faceAmount </ TD> <TD ALIGN="LEFT">(可选)双,债券的票面金额。</ TD> </ TR> < TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">默认值是100。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> redemption </ TD> <TD ALIGN="LEFT">(可选)双比例的初始</ TD> </ TR> <TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">票面金额于到期日将返回</ TD> </ TR> <TR > <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">日期。默认值是100。</ TD> </ TR> <TR> <td ALIGN="LEFT"> divSch </ TD> <TD ALIGN="LEFT">(可选)数据框的列</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">“类型”,“金额”,“利率”,和“日期“</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <td ALIGN="LEFT">对应到QuantLib的DividendSchedule的。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">默认值是一个空的框架,或没有股息。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> callSch </ TD> <TD ALIGN="LEFT">(可选)数据框的列是“价格”,< / TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">“类型”和“日期”对应QuantLib的</ TD> < / TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT"> CallabilitySchedule。 Defaule是一个空的框架,</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">或没有callability的。</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>


参数:iborindex
a DiscountCurve object, represents an IborIndex
一个的DiscountCurve对象,代表IborIndex的


参数:spread
a double vector, represents paramter 'spreads' in ConvertibleFloatingBond's constructor.
一个双向量,放慢参数的扩张ConvertibleFloatingBond的构造。


参数:coupon
a double vector of coupon rate
一个双向量的票面利率


参数:process
arguments to construct a BlackScholes process and set up the binomial pricing engine for this bond.    <table summary="Rd table"> <tr>  <td align="left"> underlying </td><td align="left"> a double, flat underlying term structure </td> </tr> <tr>  <td align="left"> volatility </td><td align="left"> a double, flat volatility term structure </td> </tr> <tr>  <td align="left"> dividendYield </td><td align="left"> a DiscountCurve object </td> </tr> <tr>  <td align="left"> riskFreeRate </td><td align="left"> a DiscountCurve object </td> </tr> <tr>  <td align="left"> </td> </tr>  </table>  
参数来构造一个BlackScholes过程中,该债券,并建立了二项式期权定价引擎。 <table summary="Rd table"> <TR> <td ALIGN="LEFT">underlying </ TD> <TD ALIGN="LEFT">一个双,平底层的期限结构</ TD> </ TR> <TR> <td ALIGN="LEFT">volatility</ TD> <TD ALIGN="LEFT">了一倍,平面波动率期限结构</ TD> </ TR> <TR> <TD ALIGN =“左”>dividendYield </ TD> <TD ALIGN="LEFT">的一个DiscountCurve对象</ TD> </ TR> <TR> <td ALIGN="LEFT">riskFreeRate </ TD> <TD ALIGN="LEFT">的一个DiscountCurve对象</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>


参数:dateparams
(Optional) a named list, QuantLib's date parameters of the bond.    <table summary="Rd table"> <tr>  <td align="left"> settlementDays </td><td align="left"> (Optional) a double, settlement days. </td> </tr> <tr>  <td align="left">          </td><td align="left"> Default value is 1.</td> </tr> <tr>  <td align="left"> calendar </td><td align="left"> (Optional) a string, either 'us' or 'uk' </td> </tr> <tr>  <td align="left">          </td><td align="left"> corresponding to US Goverment Bond </td> </tr> <tr>  <td align="left">                    </td><td align="left"> calendar and UK Exchange calendar.</td> </tr> <tr>  <td align="left">         </td><td align="left">  Default value is 'us'.</td> </tr> <tr>  <td align="left"> dayCounter </td><td align="left"> (Optional) a number or string, </td> </tr> <tr>  <td align="left">          </td><td align="left"> day counter convention.</td> </tr> <tr>  <td align="left">         </td><td align="left">  See Enum. Default value is 'Thirty360' </td> </tr> <tr>  <td align="left">  period  </td><td align="left"> (Optional) a number or string, </td> </tr> <tr>  <td align="left">        </td><td align="left">  interest compounding interval. See Enum. </td> </tr> <tr>  <td align="left">        </td><td align="left"> Default value is 'Semiannual'.</td> </tr> <tr>  <td align="left"> businessDayConvention </td><td align="left"> (Optional) a number or string, </td> </tr> <tr>  <td align="left">           </td><td align="left"> business day convention. </td> </tr> <tr>  <td align="left">  </td><td align="left"> See Enum. Default value is 'Following'. </td> </tr> <tr>  <td align="left"> </td> </tr>  </table>  See the examples below.
(可选)命名列表,QuantLib的日期参数的债券。 <table summary="Rd table"> <TR> <td ALIGN="LEFT">settlementDays </ TD> <TD ALIGN="LEFT">(可选)双交收日。 </ TD> </ TR> <TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">默认值是1。</ TD> </ TR> < TR> <td ALIGN="LEFT"> calendar </ TD> <TD ALIGN="LEFT">(可选)一个字符串,是我们或UK</ TD> </ TR> < TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">相应的美国电子政务债券的</ TD> </ TR> <TR> <TD对齐=“左边” ></ TD> <TD ALIGN="LEFT">日历和英国的Exchange日历。</ TD> </ TR> <TR> <td ALIGN="LEFT"></ TD> <TD ALIGN="LEFT">默认值是我们。</ TD> </ TR> <TR> <td ALIGN="LEFT">dayCounter </ TD> <TD对齐=“左“>(可选)一个数字或字符串,</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">天数计数器公约</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">枚举。默认值是“Thirty360”</ TD> </ TR> <TR> <td ALIGN="LEFT"> period </ TD> <TD ALIGN="LEFT">(可选)一个数字或字符串, </ TD> </ TR> <TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">利息复利的时间间隔。请参阅枚举。 </ TD> </ TR> <TR> <td ALIGN="LEFT">  </ TD> <TD ALIGN="LEFT">默认值是“半年报”。</ TD> </ TR文章<td ALIGN="LEFT"> businessDayConvention </ TD> <TD ALIGN="LEFT">(可选)一个数字或字符串</ TD> </ TR> <TR> <TD ALIGN =“”> </ TD> <TD ALIGN="LEFT">工作日约定。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> <TD ALIGN="LEFT">枚举。默认值是“继”。 </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>,请参见下面的例子。


Details

详细信息----------Details----------

Please see any decent Finance textbook for background reading, and the QuantLib documentation for details on the QuantLib implementation.
请参阅任何像样的金融教科书的背景阅读,QuantLibQuantLib实施的细节上的文件。


值----------Value----------

The ConvertibleFloatingCouponBond function returns an object of class ConvertibleFloatingCouponBond (which inherits from class  Bond). It contains a list with the following components: <table summary="R valueblock"> <tr valign="top"><td>NPV</td> <td> net present value of the bond</td></tr> <tr valign="top"><td>cleanPrice</td> <td> price price of the bond</td></tr> <tr valign="top"><td>dirtyPrice</td> <td> dirty price of the bond</td></tr> <tr valign="top"><td>accruedAmount</td> <td> accrued amount of the bond</td></tr> <tr valign="top"><td>yield</td> <td> yield of the bond</td></tr> <tr valign="top"><td>cashFlows</td> <td> cash flows of the bond</td></tr>
ConvertibleFloatingCouponBond函数返回一个类的对象ConvertibleFloatingCouponBond(继承自类Bond)。它包含以下组件的列表:<table summary="R valueblock"> <tr valign="top"> <TD>NPV</ TD> <TD>的债券净现值</ TD > </ TR> <tr valign="top"> <TD>cleanPrice </ TD> <TD>价债券价格</ TD> </ TR> <tr valign="top"> < dirtyPrice TD> </ TD> <TD>脏债券价格</ TD> </ TR> <tr valign="top"> <TD> accruedAmount</ TD> <TD>应计的债券金额</ TD> </ TR> <tr valign="top"> <TD>yield </ TD> <TD>债券的收益率</ TD> </ TR> <TR VALIGN =“”> <TD>cashFlows </ TD> <TD>现金流的债券</ TD> </ TR>

</table> The ConvertibleFixedCouponBond function returns an object of class ConvertibleFixedCouponBond (which inherits from class  Bond). It contains a list with the following components: <table summary="R valueblock"> <tr valign="top"><td>NPV</td> <td> net present value of the bond</td></tr> <tr valign="top"><td>cleanPrice</td> <td> price price of the bond</td></tr> <tr valign="top"><td>dirtyPrice</td> <td> dirty price of the bond</td></tr> <tr valign="top"><td>accruedAmount</td> <td> accrued amount of the bond</td></tr> <tr valign="top"><td>yield</td> <td> yield of the bond</td></tr> <tr valign="top"><td>cashFlows</td> <td> cash flows of the bond</td></tr>
</ TABLE> ConvertibleFixedCouponBond函数返回一个类的对象ConvertibleFixedCouponBond(继承自类Bond)。它包含以下组件的列表:<table summary="R valueblock"> <tr valign="top"> <TD>NPV</ TD> <TD>的债券净现值</ TD > </ TR> <tr valign="top"> <TD>cleanPrice </ TD> <TD>价债券价格</ TD> </ TR> <tr valign="top"> < dirtyPrice TD> </ TD> <TD>脏债券价格</ TD> </ TR> <tr valign="top"> <TD> accruedAmount</ TD> <TD>应计的债券金额</ TD> </ TR> <tr valign="top"> <TD>yield </ TD> <TD>债券的收益率</ TD> </ TR> <TR VALIGN =“”> <TD>cashFlows </ TD> <TD>现金流的债券</ TD> </ TR>

</table> The ConvertibleZeroCouponBond function returns an object of class ConvertibleZeroCouponBond (which inherits from class  Bond). It contains a list with the following components: <table summary="R valueblock"> <tr valign="top"><td>NPV</td> <td> net present value of the bond</td></tr> <tr valign="top"><td>cleanPrice</td> <td> price price of the bond</td></tr> <tr valign="top"><td>dirtyPrice</td> <td> dirty price of the bond</td></tr> <tr valign="top"><td>accruedAmount</td> <td> accrued amount of the bond</td></tr> <tr valign="top"><td>yield</td> <td> yield of the bond</td></tr> <tr valign="top"><td>cashFlows</td> <td> cash flows of the bond</td></tr>
</ TABLE> ConvertibleZeroCouponBond函数返回一个类的对象ConvertibleZeroCouponBond(继承自类Bond)。它包含以下组件的列表:<table summary="R valueblock"> <tr valign="top"> <TD>NPV</ TD> <TD>的债券净现值</ TD > </ TR> <tr valign="top"> <TD>cleanPrice </ TD> <TD>价债券价格</ TD> </ TR> <tr valign="top"> < dirtyPrice TD> </ TD> <TD>脏债券价格</ TD> </ TR> <tr valign="top"> <TD> accruedAmount</ TD> <TD>应计的债券金额</ TD> </ TR> <tr valign="top"> <TD>yield </ TD> <TD>债券的收益率</ TD> </ TR> <TR VALIGN =“”> <TD>cashFlows </ TD> <TD>现金流的债券</ TD> </ TR>

</table>
</ TABLE>


(作者)----------Author(s)----------


Khanh Nguyen <a href="mailto:knguyen@cs.umb.edu">knguyen@cs.umb.edu</a> for the inplementation; Dirk Eddelbuettel <a href="mailto:edd@debian.org">edd@debian.org</a> for the <font face="Courier New,Courier" color="#666666"><b>R</b></font> interface;
the QuantLib Group for <code>QuantLib</code>




参考文献----------References----------

http://quantlib.org/ for details on <code>QuantLib</code>.

实例----------Examples----------


#this follow an example in test-suite/convertiblebond.cpp [这遵循了一个例子,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)[ConvertibleFloatingCouponBond(bondparams,iborindex,点差,工艺,dateparams)]


#example using default values[例如,使用默认值]
#ConvertibleFloatingCouponBond(bondparams, iborindex,spreads, process)[ConvertibleFloatingCouponBond(bondparams,iborindex,利差过程)]

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,[ConvertibleFloatingCouponBond(bondparams,iborindex,]
#spreads, process, dateparams)[利差过程中,dateparams)]



#this follow an example in test-suite/convertiblebond.cpp [这遵循了一个例子,test-suite/convertiblebond.cpp]
#for ConvertibleFixedCouponBond[为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 [这遵循了一个例子,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)


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-26 18:22 , Processed in 0.042793 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表