New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date generation rule CDS2015 only works for multiples of 6M #727
Comments
I guess there is a bug indeed. When i submitted the CDS2015 date generation convention, I didn't check with non yearly maturities, I didn't know these existed, but it makes sense to match with the official ISDA guidelines. |
starting to get my head around the code base and possible causes. this commit was reverted as I had the wrong user settings in.
is this unit test still valid if the bug is fixed? specifically the end date. Schedule s3 =
MakeSchedule().from(Date(20, March, 2017))
.to(Date(20, March, 2017) + Period(5, Years))
.withCalendar(WeekendsOnly())
.withTenor(3*Months)
.withConvention(ModifiedFollowing)
.withTerminationDateConvention(Unadjusted)
.withRule(DateGeneration::CDS2015);
BOOST_CHECK(s3.startDate() == Date(20, March, 2017));
BOOST_CHECK(s3.endDate() == Date(20, June, 2022)); from QuantLib\test-suite\schedule.cpp line 272 |
The main addition is a function cdsMaturity(...) that can be used to derive a CDS maturity date given a trade date, a valid CDS tenor and a valid CDS date generation rule. The date generation is tested against the dates provided in the ISDA documentation for CDS2015. It is also tested for CDS and OldCDS. The logic for the 0M tenor is added for the CDS and CDS2015 rules.
@benacook I am only getting back to look at this issue now. Yes this unit test should still pass. I have kept it in the branch that I am working on, in commit 72c6064, along with some other tests. I hope to make a pull request from this branch but I need to check a few other downstream items i.e. CDS instrument, helper and engines before doing this. |
If the first coupon period would exclude the unadjusted effective date, include the prior period. Only applies to CDS and CDS2015. This covers trade dates on Sat or Sun for example and leaves the period from the previous coupon payment date to the following Monday in the schedule. There are tests added to show this. CDS and CDS2015 periods are always regular.
Allow for specification of trade date and cash settlement days. There was a built in assumption that if protection start was not given, it was equal to the first date in the schedule. There was also an assumption that cash settlement was 3 BD after protection start - 1D. This doesn't really work after CDS Big Bang. The protection start is the trade date itself, i.e. not T + 1 as it was before 2009. The accrual rebate calculation needed to be corrected to be in line with the ISDA docs. A unit test has been added to check this. The code in the old 'if (rebatesAccrual) {}' block leads in some scenarios to reads beyond the end of the leg vector and a crash.
- Update to ctor documentation, particularly settlementDays should typically be 0 after CDS Big Bang for correct treatment. - Use cdsMaturity function if rule is a CDS rule to generate helper end date. - Don't need to call CdsHelper::initializeDates() from UpfrontCdsHelper::initializeDates()
The upfront and accrual rebate are paid regardless of whether there is a credit event between trade date and cash settlement date so removed the survival probability component from the NPV calculation here.
… than 9 parameters.
There is documentation on the rule
DateGeneration::CDS2015
given here. The document at that link is attached here also. The document has a table in section 11 describing the maturity dates of CDS with given tenors for valuation dates in six different periods using the CDS 2015 rule. If we use the code snippet below to generate this table using QuantLib, we get the table in the attached Excel workbook. The rule works for periods that are multiples of 6 months. However, the rule does not give the expected result for periods 3M, 9M, 15M, etc.Before I start working on a fix for this, is there agreement that this is an issue and needs to be fixed or am I missing something?
The code crashes if a tenor of 0M is included but having this working with CDS2015 is more of a nice to have and could be treated as a separate issue of lesser importance.
2015_isda_amend-single-name-on-the-run-frequency-faq-revised-as-of-12-10.pdf
compare_expected.xlsx
The text was updated successfully, but these errors were encountered: