-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
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.
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. |
ql/cashflows/conundrumpricer.cpp
Outdated
@@ -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()); |
There was a problem hiding this comment.
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!
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? |
Hi Luigi,
Thanks for the information. I‘ll do the changes.
Yours sincerely
André
Am 2023-05-10 11:02, schrieb Luigi Ballabio:
… @lballabio commented on this pull request.
-------------------------
In ql/cashflows/conundrumpricer.cpp [1]:
> @@ -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());
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!
--
Reply to this email directly, view it on GitHub [2], or unsubscribe
[3].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#1660 (comment)
[2]
#1660 (review)
[3]
https://github.com/notifications/unsubscribe-auth/A7W4HYISCT5HWMITQMQ6EUTXFNKUHANCNFSM6AAAAAAX3R32HY
|
Added the fallback to the forwardingTS if the discountingTS is a null pointer
@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. |
Yes, let's set up a test case — it will ensure this keeps working correctly if someone else modifies the code later. Thanks! |
I‘m working on it.
Am 2023-05-11 12:40, schrieb Luigi Ballabio:
… Yes, let's set up a test case — it will ensure this keeps working
correctly if someone else modifies the code later. Thanks!
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#1660 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/A7W4HYKU2BNTPTXCOOHKHTLXFS62RANCNFSM6AAAAAAX3R32HY
|
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_)); |
There was a problem hiding this comment.
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?
Yes, that is basically correct. To be precise Hunt and Kennedy used the
then prevailing market model, that was Black. This is the current
implementation in QL, too. I changed the model now from black to
bachelier because the market model has changed accordingly. It is a
minor change of code.
Yours sincerely
André
Am 2023-05-12 19:01, schrieb Luigi Ballabio:
… @lballabio commented on this pull request.
-------------------------
In ql/experimental/swaptions/haganirregularswaptionengine.cpp [1]:
>
- // Black 76 Swaption Engine: assumes that the swaptions
exercise date equals the swap start date
- 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_));
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?
--
Reply to this email directly, view it on GitHub [2], or unsubscribe
[3].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#1660 (comment)
[2]
#1660 (review)
[3]
https://github.com/notifications/unsubscribe-auth/A7W4HYNZGQPTA2AZDXXP2YTXFZUFPANCNFSM6AAAAAAX3R32HY
|
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.
@enable normal vol in Hagan pricer for CMS coupons # 1660: |
Ok, I added the new test to the test suite. Thanks! |
Congratulations on your first merged pull request! |
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.