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

[Python] discountBond and discountBondOption methods in G2 #680

Closed
corradopetrelli opened this issue Oct 24, 2024 · 3 comments · Fixed by #691
Closed

[Python] discountBond and discountBondOption methods in G2 #680

corradopetrelli opened this issue Oct 24, 2024 · 3 comments · Fixed by #691

Comments

@corradopetrelli
Copy link

Hi Luigi,

I am here to ask a question about the QuantLib wrapper in Python. I would like to use the G2 class to have a Two-additive-factor Gaussian model and I would like to have the discount coupon of this model.

I saw that on C++ the G2 class (https://www.quantlib.org/reference/class_quant_lib_1_1_g2.html) has methods discountBond and discountBondOption. How can I use these methods in python? I don't see them available.

Below is the example code

settlementDate = ql.Date(19, ql.February, 2012)
rate = ql.makeQuoteHandle(0.04875)
termStructure = ql.YieldTermStructureHandle(ql.FlatForward(settlementDate, rate, ql.Actual365Fixed()))
ql.G2(termStructure).discountBond(...)

The error:

AttributeError: 'G2' object has no attribute 'discountBond'

Thanks a lot!

Copy link

boring-cyborg bot commented Oct 24, 2024

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

@lballabio
Copy link
Owner

Hi Corrado—you're right, those methods are not exported. I'll try and do it for next release.

@lballabio lballabio added this to the Release 1.37 milestone Oct 25, 2024
@corradopetrelli
Copy link
Author

Thank you so much! 😄

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 a pull request may close this issue.

2 participants