Skip to content

Keep each call and put price with its date in BondEmbeddedOption.value - #503

Open
QuantIntellect wants to merge 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/embedded-option-seasoned-prices
Open

QuantIntellect wants to merge 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/embedded-option-seasoned-prices

Conversation

@QuantIntellect

Copy link
Copy Markdown
Contributor

BondEmbeddedOption.value keeps only the call and put dates after settlement, but takes all of the prices (bond_embedded_option.py#L158-L174):

for dt in self.call_dts:
    if dt > settle_dt:
        call_times.append((dt - settle_dt) / G_DAYS_IN_YEAR)
call_times = np.array(call_times)
call_prices = np.array(self.call_prices)

The trees then put call_prices[i] at call_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:

Model Full call schedule, master Remaining calls only Full call schedule, this PR
HWTree(0.01, 0.05) 105.295933 103.959313 103.959313
BKTree(0.2, 0.05) 105.380608 103.999782 103.999782
BDTTree(0.2) 105.305726 103.951103 103.951103

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, on HWTree and BKTree. Both tests fail on master (by 1.3349 and 2.5470) and pass with the change. tests/unit passes (2147), and the existing test_bond_embedded_option.py values are unchanged.

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

No deployments
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 this pull request may close these issues.

1 participant