-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Hello,
I'm trying to price a sample bond, but for some reason, the schedule object differs when I run it within Schedule() compared to when I use a list inside FixedRateBond(). Specifically, the bond function is omitting the first cashflow. Am I missing something? Is this the expected behaviour?
Schedule Function
> schedule <- Schedule(
list(
effectiveDate=as.Date("2023-06-01"),
maturityDate=as.Date("2024-12-01"),
period='Semiannual',
calendar='UnitedStates/Settlement',
businessDayConvention='Unadjusted',
terminationDateConvention='Unadjusted',
dateGeneration='Forward',
endOfMonth=0
))
> schedule
[1] "2023-06-01" "2023-12-01" "2024-06-01" "2024-12-01"
FixedRateBond
schedule <-
list(
effectiveDate=as.Date("2023-06-01"),
maturityDate=as.Date("2024-12-01"),
period='Semiannual',
calendar='UnitedStates/Settlement',
businessDayConvention='Unadjusted',
terminationDateConvention='Unadjusted',
dateGeneration='Forward',
endOfMonth=1
)
#Create the discount rate curve to compute present values
date <- as.Date("2023-05-04")
discountCurve <- DiscountCurve(
list(
tradeDate = date,
settleDate = date + 2,
dt = .25,
interpWhat="zero",
interpHow="linear"
),
tsQuotes = list(flat = 0.042675)
)
#Create the bond
bondinfo <- list(
settlementDays = 2
)
setEvaluationDate(as.Date("2023-05-04"))
FixedRateBond(
bondinfo,
rates = c(0.085),
schedule,
list(
dayCounter="Thirty360",
compounding='Compounded',
freq='Semiannual',
durationType='Modified'
),
discountCurve = discountCurve
)
Which gives output:
Concise summary of valuation for FixedRateBond
Net present value : 105.67
clean price : 105.69
dirty price : 105.69
accrued coupon : 0
yield : 0.043301
duration : 1.4762
settlement date : 2023-05-08
cash flows :
Date Amount
2023-12-01 4.25
2024-06-03 4.25
2024-12-02 4.25
2024-12-02 100.00
Metadata
Metadata
Assignees
Labels
No labels