I appreciate that Quantlib Schedule class can take a date vector as constructor. I have successfully built a schedule via this way. However, when I pass this schedule to vanillaswap constructor, the code starts to generate error on function bool Schedule::isRegular(Size i) const
in schedule.cpp. Here is part of my code related to this error:
vector<Date> fixedDates;
vector<Date> floatDates;
fixedDates.push_back(Date(15, April, 2016));
fixedDates.push_back(Date(18, April, 2017));
floatDates.push_back(Date(15, April, 2016));
floatDates.push_back(Date(15, July, 2016));
floatDates.push_back(Date(17, October, 2016));
floatDates.push_back(Date(17, January, 2017));
floatDates.push_back(Date(18, April, 2017));
Schedule fixedSchedule(fixedDates);
Schedule floatSchedule(floatDates);
VanillaSwap::Type swapType = VanillaSwap::Payer;
VanillaSwap swap(swapType, nominal, fixedSchedule, fixedRate, Actual365Fixed(), floatSchedule, libor, spread, Actual365Fixed());
When I run my code, it fails due to this isRegular_.size()
return 0.
I found this link is useful: http://www.implementingquantlib.com/2014/11/odds-and-ends-date-calculations.html
However, I am not sure if I am complete understand the last paragraph about how to fix this problem. Is there anyone can give me an example here?
Many thanks