Repository navigation
Add EquityAutocallable for autocallable and Phoenix notes - #504
Open
jjohnnystwsss wants to merge 1 commit into
Open
jjohnnystwsss wants to merge 1 commit into
jjohnnystwsss wants to merge 1 commit into
Conversation
Monte Carlo valuation under Black-Scholes with exact steps between observation dates and antithetic paths. Supports step-down autocall barriers, coupon barriers with or without memory, and a knock-in barrier monitored continuously (Brownian bridge) or at maturity. Closes FinancePy-Org#116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #116
Adds
EquityAutocallableinfinancepy/products/equity/equity_autocallable.py, following the sketch in #116 (comment).The product
A note on one stock with observation dates from a
Schedule(as inEquityCliquetOption). On each date:memory=Truea paid coupon also pays the coupons missed before.A note that is never called repays the notional at maturity, or notional × S_T / S_0 if the knock-in barrier was breached and S_T < S_0. Barriers are fractions of the initial price.
autocall_barrier: one level, or one per date for step-downs;np.infmarks dates with no call (a non-call period).coupon_barrier: defaults to the autocall barriers, so coupons are paid only on call. A Phoenix sets it lower. A classic autocall that pays the accumulated coupons on call is the default withmemory=True.knock_in_barrier(None for full protection) andknock_in_type: a newKnockInTypesenum inglobal_types,CONTINUOUSorAT_MATURITY.couponis paid per observation date as a fraction of the notional (not annualised). The sketch called itcoupon_rate; I changed the name so it isn't read as an annual rate.Valuation
value_mc(value_dt, stock_price, discount_curve, dividend_curve, model, num_paths, seed) -> MCResultunderBlackScholes, built likeEquityCliquetOption.value_mc:value()returnsvalue_mc().valuewith a fixed seed, so the perturbation Greeks ofEquityOptionuse the same paths. As with the cliquet Monte Carlo, valuation is on the start date only (value_dt == start_dt), since a later date needs past fixings and the knock-in state. I left out per-date call probabilities and expected life for now; they could be added as a follow-up.Tests
tests/unit/test_equity_autocallable.pychecks against independent prices:EquityBarrierOptiondown-and-in put struck at S₀ per unit of S₀, with continuous monitoring (num_obs_per_year=10**9). The MC value is 0.794114 ± 0.000283 against 0.794219 (−0.37 standard errors). For comparison, the same put monitored quarterly would give 0.805493, so the Brownian bridge is doing its job;EquityDigitalOption);Monte Carlo comparisons use a tolerance of four standard errors (plus 1e-4).
pytest tests/unit: 2161 passed.There is also an example,
examples/scripts/equity/example_equity_autocallable.py, with a Phoenix and a step-down classic autocall at three volatilities.AI disclosure
This was written with Claude Code (Claude Opus 5.5), which wrote the code, tests and example and ran the tests above. I read through the code before submitting.
🤖 Generated with Claude Code