Add one-month Ibor futures and settlement helpers#243
Open
mpwaser wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal
This addresses the explicit TODOs in
financepy/products/rates/ibor_future.pyaround settlement functionality, tests, and 1-month futures support:https://github.com/domokane/FinancePy/blob/master/financepy/products/rates/ibor_future.py#L7-L10
The current constructor exposes
future_tenor="3M"but rejects all non-3M tenors. This PR keeps the existing 3M quarterly IMM behavior unchanged and adds explicit 1M monthly IMM futures support.Changes
This PR:
future_tenor="1M"/"1m"inIborFuturefuture_tenor="3M"behavior unchangedDate.next_imm_date()for 3M quarterly IMM futuresaccrual_factor(),basis_point_value(), andsettlement_amount()helpersunit_tests/test_FinIborFuture.pytest file instead of adding a new test structureBehavior and scope
Existing calls such as:
still create 3M quarterly IMM futures.
For 1M futures, delivery dates advance by monthly IMM dates, i.e. the third Wednesday of each month. The end of the interest period is the next monthly IMM date.
The new
settlement_amount()helper returns the cash settlement amount for a quoted futures price move from the perspective of a long position:A short position can be represented by passing a negative
num_contracts.I intentionally left 2M futures unsupported. The current TODO and constructor gap specifically call out 1M futures, and adding 2M support would require additional convention choices and tests beyond this focused change.
Tests
The existing Ibor future unit test was extended to cover:
Local validation was run in a Python 3.13
uvenvironment:Result:
Notes
I did not change the existing FRA conversion logic except that it now uses the delivery and end-of-interest-period dates generated for the selected futures tenor.
This keeps the existing curve-building callers that rely on default 3M futures behavior intact while adding the requested 1M futures path and settlement helpers.