[R-SIG-Finance] RQuantLib FixedRateBondYield close to maturity
cduranceau at nial.ky
Fri May 26 17:33:33 CEST 2017
I try to back-out the yield from a US Treasury note giving clean price using the function "FixedRateBondYield".
The procedure generate an error (See below).
Is this a structural problem or could it be correct by changing the bond settings ( I tried several changes already)?
In this reproducible example, I try to back-out the yield for a bond maturing on 31-Dec-2016 as of (value date) 30-Dec-2016 (Friday).
# US Treasury note fixed attributes
gen_bond_UST =list(asettlementDays=1,afaceAmount= 100,aperiod=3,acalendar="UnitedStates/GovernmentBond",adayCounter=2,
abusinessDayConvention=2 ,acompound = 1 ,aredemption=100 ,aissueDate=as.Date("2014-01-31"),aendOfMonth=0)
businessDayConvention=abusinessDayConvention ,compound = acompound ,redemption=aredemption,issueDate=aissueDate))
Error in fixedRateBondYieldByPriceEngine(settlementDays, price, calendar, :
degenerate single date (December 30th, 2016) schedule
seed date: December 31st, 2016
exit date: December 30th, 2016
effective date: December 30th, 2016
first date: null date
next to last date: null date
termination date: December 31st, 2016
generation rule: Backward
end of month: 0
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
 LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
 stats graphics grDevices utils datasets methods base
other attached packages:
loaded via a namespace (and not attached):
 zoo_1.8-0 tools_3.3.2 Rcpp_0.12.10 grid_3.3.2 lattice_0.20-34
[[alternative HTML version deleted]]
More information about the R-SIG-Finance