Closed aalvero closed 7 years ago
It's trying to value a bond today that matured over a decade ago. Either use live bond or change the valuation date to correspond with the life ofthe bond.
On Jul 6, 2017, at 11:00 PM, aalvero notifications@github.com wrote:
The function FixedRateBond() does not work for certain parameters.
For instance, the following parameters will yield a message error. I tried to change all the parameters, even change the maturityDate a little bit, but nothing works. However, the example in the pdf manual work. I could not find the source of the problem.
Here is the code:
price <- 100 bond <- list(settlementDays=3, issueDate=as.Date("1989-10-24"), faceAmount=100, accrualDayCounter='Thirty360', paymentConvention='Following') schedule <- list(effectiveDate=as.Date("1989-10-24"), maturityDate=as.Date("2001-11-01"), period='Semiannual', calendar='UnitedStates/GovernmentBond', businessDayConvention='Unadjusted', terminationDateConvention='Unadjusted', dateGeneration='Forward', endOfMonth=1) calc=list(dayCounter='Thirty360', compounding='Continuous', freq='Semiannual', durationType='Modified')
rates <- c(0.0945)
FixedRateBond(bond, rates, schedule, calc, price=price)
The error message:
Error in FixedRateWithPrice(bond, rates, schedule, calc, price) : non tradable at July 11th, 2017 (maturity being November 1st, 2001) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks! So I should change setEvaluationDate(). However, I need to compute the yield on a lot of historical bonds within a data.table, And I will not be able to reset the valuation date for each bond. Is there a way to enter the trade date as a parameter instead ?
You’ll need to reset the evaluation date if they’re different. And you’ll need to regenerate your discount curve as well.
On Jul 6, 2017, at 11:15 PM, aalvero notifications@github.com wrote:
Thanks! So I should change setEvaluationDate(). However, I need to compute the yield on a lot of historical bonds within a data.table, And I will not be able to reset the valuation date for each bond. Is there a way to enter the trade date as a parameter instead ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eddelbuettel/rquantlib/issues/90#issuecomment-313576404, or mute the thread https://github.com/notifications/unsubscribe-auth/AHBCovfoXeO85y19PuvWyXufHCGlApoEks5sLaLYgaJpZM4OQbky.
The function FixedRateBond() does not work for certain parameters.
For instance, the following parameters will yield a message error. I tried to change all the parameters, even change the maturityDate a little bit, but nothing works. However, the example in the pdf manual work. I could not find the source of the problem.
Here is the code:
The error message:
As information, here are the details of the R Session (R version 3.4.1, and RQuantLib_0.4.3) :