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

Customize future dates in FutureRateHelpers #1855

Closed
elopezarb opened this issue Dec 13, 2023 · 6 comments · Fixed by #1915
Closed

Customize future dates in FutureRateHelpers #1855

elopezarb opened this issue Dec 13, 2023 · 6 comments · Fixed by #1915

Comments

@elopezarb
Copy link

Hi! I want to make the new mexican F-TIIE curve in python with QuantLib, but when I'm trying to make a FutureRateHelper the future types are only IMM or ASX and my curve needs customized future dates for each month. How can I work around this issue?

My code is this:

`futures = {}
for i in future_index:
month = dic_month[df['Ticker'].iloc[i][3:4]]
year = int(df['Ticker'].iloc[i][4])
d = ql.Date(1,month, 2020 + year)
futures[d] = data[i]

months = 1

futuresHelpers = [ql.FuturesRateHelper(
    ql.QuoteHandle(ql.SimpleQuote(futures[d])), 
    d, months, calendar_mx, 
    ql.ModifiedFollowing, True, dayCounter)
    for d in  futures.keys()
]`

Where "d" is the Start Date for the future contract and "futures" is the dictionary of dates and prices
Thank You!

Copy link

boring-cyborg bot commented Dec 13, 2023

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

Thanks—yes, we should probably implement a third case besides IMM and ASX that leaves the dates free. We can also implement more rules if we want to check those.

eltoder added a commit to eltoder/QuantLib that referenced this issue Feb 21, 2024
This allows passing custom future dates. Closes lballabio#1855
eltoder added a commit to eltoder/QuantLib that referenced this issue Feb 21, 2024
This allows passing custom future dates. Closes lballabio#1855
ninetiger pushed a commit to ninetiger/QLNet that referenced this issue Apr 15, 2024
This is trnasfered from the C++ code: lballabio/QuantLib#1915
This allows passing custom future dates. Closes #1855: lballabio/QuantLib#1855
amaggiulli pushed a commit to amaggiulli/QLNet that referenced this issue Apr 16, 2024
* Added Futures Type - Custom;

This is trnasfered from the C++ code: lballabio/QuantLib#1915
This allows passing custom future dates. Closes #1855: lballabio/QuantLib#1855

* Update the default case message only

---------

Co-authored-by: Xiao Gong <xiao.gong@nzfunds.co.nz>
@elopezarb
Copy link
Author

Hi! When trying the new feature, this error arises.

File ~\AppData\Local\anaconda3\Lib\site-packages\QuantLib\QuantLib.py:26940 in init
_QuantLib.FuturesRateHelper_swiginit(self, _QuantLib.new_FuturesRateHelper(*args))

RuntimeError: unsupported futures type (Custom)

This is my code:

hlpr = ql.FuturesRateHelper(ql.QuoteHandle(ql.SimpleQuote(100-88.98)), 
                            ql.Date(1,5,2024),
                            ql.Date(31,5,2024), ql.Actual360(),
                            ql.QuoteHandle(), ql.Futures.Custom)

@lballabio
Copy link
Owner

You're right, we need a fix for that case. In the meantime, the constructor that takes a start date and a number of months will work.

@elopezarb
Copy link
Author

Thanks

@lballabio
Copy link
Owner

The fix is in #1974. It will be in next release (at some point in July).

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