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

Enable normal volatilities in Hagan pricer for CMS coupons #1660

Merged
merged 13 commits into from
May 15, 2023

Conversation

amiemiec
Copy link
Contributor

@amiemiec amiemiec commented May 9, 2023

Extended functionality, such that cms pricing can cope with the normal model as well. Renamed the class BlackVanillaOptionPricer into MarketQuotedOptionPricer and changed the method NumericHaganPricer::resetUpperLimit accordingly. In line 97 the YTM struchture used for discounting was changed from the forwardingTermStructure to the discountingTermStructure.

Extended functionality, such that cms pricing can cope with the normal model as well. Renamed the class BlackVanillaOptionPricer into MarketQuotedOptionPricer and changed the method  NumericHaganPricer::resetUpperLimit accordingly.
In line 97 the YTM struchture used for discounting was changed from the forwardingTermStructure to the discountingTermStructure.
@boring-cyborg
Copy link

boring-cyborg bot commented May 9, 2023

Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it.

@CLAassistant
Copy link

CLAassistant commented May 9, 2023

CLA assistant check
All committers have signed the CLA.

@@ -87,7 +95,7 @@ namespace QuantLib {
fixingDate_ = coupon_->fixingDate();
paymentDate_ = coupon_->date();
const ext::shared_ptr<SwapIndex>& swapIndex = coupon_->swapIndex();
rateCurve_ = *(swapIndex->forwardingTermStructure());
rateCurve_ = *(swapIndex->discountingTermStructure());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fall back to the forwarding term structure if the discounting term structure if null (hence the errors in the test). Do you have time to do the change, or should I? Thanks!

@lballabio
Copy link
Owner

Do we have any test cases in our test suite that we can duplicate and reuse for testing normal volatilities? Or do you have any data we can use?

@lballabio lballabio changed the title Add files via upload Enable normal volatilities in Hagan pricer for CMS coupons May 10, 2023
@amiemiec
Copy link
Contributor Author

amiemiec commented May 10, 2023 via email

Added the fallback to the forwardingTS if the discountingTS is a null pointer
@amiemiec
Copy link
Contributor Author

@test data for CMS with normal vols: I could provide a set of test data if needed. Please give me a hint that I shall care for it.

@lballabio
Copy link
Owner

Yes, let's set up a test case — it will ensure this keeps working correctly if someone else modifies the code later. Thanks!

@amiemiec
Copy link
Contributor Author

amiemiec commented May 12, 2023 via email

@lballabio
Copy link
Owner

Thanks — in the meantime, I fixed the line endings in the other file and removed the empty handle access. I pushed the changes to your branch, you can pull them to your working copy.

ext::shared_ptr<PricingEngine> blackSwaptionEngine =
ext::shared_ptr<PricingEngine>(new BlackSwaptionEngine(termStructure_,volatilityStructure_));
ext::shared_ptr<PricingEngine> swaptionEngine = ext::shared_ptr<PricingEngine>(
new BachelierSwaptionEngine(termStructure_, volatilityStructure_));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing Hunt and Kennedy used Bachelier and we were using Black instead because we couldn't use normal vols yet—is that correct?

@coveralls
Copy link

coveralls commented May 12, 2023

Coverage Status

Coverage: 71.963% (+0.03%) from 71.932% when pulling 8effd59 on amiemiec:fixes into 6d95ba7 on lballabio:master.

@amiemiec
Copy link
Contributor Author

amiemiec commented May 13, 2023 via email

Amended :
- Analytical Pricer
- capletPrice, floorletPrice
- GaussKronrod integration
- method to set the lower integration limit
Based on cms. LinearTsr currently not included due to effort. Do not expect any additional problem, when this is included into the new test file.
@amiemiec
Copy link
Contributor Author

@enable normal vol in Hagan pricer for CMS coupons # 1660:
Added the unit test for the normal model. Good thing. Discovered during the setup several things, which needed improvement as well. Now it is complete.

@lballabio
Copy link
Owner

Ok, I added the new test to the test suite. Thanks!

@lballabio lballabio merged commit 7897a76 into lballabio:master May 15, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented May 15, 2023

Congratulations on your first merged pull request!

@lballabio lballabio added this to the Release 1.31 milestone May 15, 2023
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

Successfully merging this pull request may close these issues.

4 participants