Skip to content
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

Potential issues for CDS pricing #187

Open
YimingZhang07 opened this issue Jun 29, 2023 · 4 comments
Open

Potential issues for CDS pricing #187

YimingZhang07 opened this issue Jun 29, 2023 · 4 comments

Comments

@YimingZhang07
Copy link

Hello,

I really like this package, and have been taking a very close look to the implementation. I spot two potential things that may not be reasonable based on my knowledge from a couple of references (including your book).

  1. In protection leg calculation, the integral step is set to be dt = (tmat - teff) / num_steps_per_year, and num_steps_per_year is 25 by default. I assume this should mean dt = 1 / nums_steps_per_year and total steps are math.ceil((tmat-teff) * nums_steps_per_year). Or else, a long enough term could make dt detours from our target.

  2. The treatment for the last payment date is moved one day forward from the maturity date (usually 20th), which seems off at least when 20th itself is Saturday.

To replicate a given example from markit, use the following example.

CDS(Date(20, 2, 2009, 2, 20), Date(20, 3, 2010), 0.01). The last payment date given by the pricer is March 21st Sunday, which is still a weekend.

The same setup can be found at https://www.cdsmodel.com/assets/cds-model/docs/Standard%20CDS%20Examples.pdf

where the last payment date is adjusted to March 22nd Monday.

Let me know your thoughts.

Thanks,

@domokane
Copy link
Owner

Hi - Thanks for the comments. Let me look at this over the weekend.
Best
D

@FergalOK
Copy link
Contributor

FergalOK commented Jul 2, 2023

For the second point, this change should adjust the dates correctly: here
This still needs to be properly tested (especially for DateGenRuleTypes.FORWARD).
You can checkout the change with:

git remote add FergalOK https://github.com/FergalOK/FinancePy.git
git fetch FergalOK
git checkout --track FergalOK/cds

Also, you're right that dt = (tmat - teff) / num_steps_per_year is wrong.
I can make the change once I create a good example to test.

@domokane
Copy link
Owner

domokane commented Jul 3, 2023

We have almost completed addressing these issues. I will push a new version asap.

@YimingZhang07
Copy link
Author

Thanks for looking into this! Will continue to look at other modules as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants