Repository navigation
Keep each call and put price with its date in BondEmbeddedOption.value - #503
Open
QuantIntellect wants to merge 1 commit into
Open
QuantIntellect wants to merge 1 commit into
QuantIntellect wants to merge 1 commit into
Conversation
value dropped the call and put dates on or before settlement but kept every price, so once a date had passed each remaining date was valued with the price of an earlier one. The prices are now taken in the same loop as the dates.
This branch has not been deployed
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.
BondEmbeddedOption.valuekeeps only the call and put dates after settlement, but takes all of the prices (bond_embedded_option.py#L158-L174):The trees then put
call_prices[i]atcall_times[i](hw_tree.py#L723-L735), so once a call or put date has passed, each remaining date is exercised at the price of an earlier date.A 6% semi-annual bond from 15-Jun-2020 to 15-Jun-2030, callable every 15 June from 2023 to 2029 at 103, 102.5, ..., 100, valued on 20-Aug-2025 on a flat 4% curve with 200 steps. The 2023 to 2025 calls have passed, so the same bond with only the 2026 to 2029 calls (at 101.5 to 100) should have the same value:
HWTree(0.01, 0.05)BKTree(0.2, 0.05)BDTTree(0.2)On master the four remaining calls get the prices of the first four dates (103 to 101.5), which reproduces 105.295933 on HW. A 2% bond puttable on the same dates at 95, 96, ..., 100 gives 94.440476 on master and 96.989626 with this PR, the same as with only the remaining puts.
Change
The call and put prices are collected in the same loop as their dates, so a price is dropped with its date. Dates after settlement are kept, as before.
Tests
tests/unit/test_bond_embedded_option_seasoned.py(new): with three of seven exercise dates before settlement, the full schedule and the remaining dates give the same price and straight bond value, for calls and for puts, onHWTreeandBKTree. Both tests fail on master (by 1.3349 and 2.5470) and pass with the change.tests/unitpasses (2147), and the existingtest_bond_embedded_option.pyvalues are unchanged.