Skip to content

Add EquityAutocallable for autocallable and Phoenix notes - #504

Open
jjohnnystwsss wants to merge 1 commit into
FinancePy-Org:masterfrom
jjohnnystwsss:feat/116-equity-autocallable
Open

jjohnnystwsss wants to merge 1 commit into
FinancePy-Org:masterfrom
jjohnnystwsss:feat/116-equity-autocallable

Conversation

@jjohnnystwsss

Copy link
Copy Markdown
Contributor

Closes #116

Adds EquityAutocallable in financepy/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 in EquityCliquetOption). On each date:

  • if the stock is at or above the autocall barrier, the note is called and pays notional + coupon;
  • otherwise the coupon is paid if the stock is at or above the coupon barrier; with memory=True a 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.inf marks 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 with memory=True.
  • knock_in_barrier (None for full protection) and knock_in_type: a new KnockInTypes enum in global_types, CONTINUOUS or AT_MATURITY.
  • coupon is paid per observation date as a fraction of the notional (not annualised). The sketch called it coupon_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) -> MCResult under BlackScholes, built like EquityCliquetOption.value_mc:

  • exact GBM steps between observation dates, with the drift from the discount and dividend curves over each period, so there is no time-discretisation error;
  • antithetic paths, with the standard error from the pair averages;
  • a continuous knock-in through the Brownian bridge: given the stock at two consecutive dates, the probability it crossed the barrier in between is $\exp\left(-2\ln(S_1/B)\ln(S_2/B)/(\sigma^2 t)\right)$. Each path carries its probability of never knocking in, instead of a daily grid; this is exact for GBM.

value() returns value_mc().value with a fixed seed, so the perturbation Greeks of EquityOption use 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.py checks against independent prices:

  • never called, no coupons: equal to the zero-coupon bond (exact);
  • called on the first date: (1 + c)·df(t₁) (exact);
  • continuous knock-in only: zero-coupon bond minus the EquityBarrierOption down-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;
  • knock-in at maturity: zero-coupon bond minus a cash-or-nothing put plus an asset-or-nothing put / S₀ (EquityDigitalOption);
  • coupons only: a strip of cash-or-nothing calls (1.001848 against 1.001845, 0.06 standard errors);
  • memory and step-down / snowball logic with near-zero volatility, where the stock follows its forward and the result is known exactly;
  • reproducibility with a fixed seed, and input errors.

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

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

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.

Add Equity Autocallable product

1 participant