back to projects

Featured Project

NIFTY 50 Autocallable Pricer

An Indian NBFC issues you a three-year market-linked debenture on the NIFTY 50. The brochure says 9% a year, capital protected unless the index falls 30%. You pay 100 for it. The question the brochure does not answer is what it is actually worth, and the answer here is 98.34: the issuer keeps 1.66 as structuring margin, and the capital protection you were sold fails 3.3% of the time.

98.336

Fair value per 100, to within 0.4bp on 400k paths

17.9x

Variance reduction from pricing the note's own events exactly

0.00bp

Gap to QuantLib on every component with an agreed convention

3.3%

Risk-neutral probability the capital protection fails


The product

Three years, observed annually. If NIFTY is at or above its initial fixing on an observation date the note redeems early and pays the coupon accrued since issue, so a call in year two pays 118 rather than 109. If it survives to maturity below the trigger, the investor gets 100 back, unless the index ever closed at or below 70% of the initial fixing, in which case they get the index.

So the investor is long a strip of digital calls and short a down-and-in put. The bond leg is worth 79.97 and the derivative overlay +18.36.

Why it needs paths

Whether the note is called in year two depends on year one, and the barrier is checked on 756 daily closes. That path dependence is what rules out a formula, and it is not a rounding detail: a daily-monitored barrier is touched far more often than one read at the final fixing, and the convention alone is worth 35bp of the price.

The demo below prices both, side by side, so you can see the gap move as you change the term sheet.


Try it

The pricer is ported to TypeScript and runs in this page. Nothing is uploaded and there is no server to upload it to. Reprice the note at a different coupon, push the index down 20%, or ask what coupon the issuer would have to pay to keep only a 2% margin.

NIFTY 50 autocallable, priced live

Calibrated to the NSE option chain for 1 October 2026: initial fixing 22,421.95, three-year ATM vol 13.9%, implied carry 6.5%. Move anything and the exact price updates as you drag.

Term sheet

Tenor, annual observations

100% of initial

Redeems early at this level, paying the coupon accrued since issue.

9.00% p.a.
70% of initial

Below this the investor stops being capital protected and takes the index.

100 bp

The note is the issuer's unsecured paper, so the spread discounts every cash flow.

Market scenario

0% (22,422)

The note's reference level stays at the initial fixing, so this is a live note revalued, not a new issue.

0.0 pts

Parallel shift of every pillar. Changes the paths, so the simulation has to rerun.

0 bp

Risk-free curve only, holding the dividend curve fixed, so the forward moves too.

6684102-40%-25%-10%+5%+20%+30%

Closed-form value against the index. The dashed gold line is par.


Barrier at the final fixing

closed form

98.6834

Exact. Every autocall event is a box in the jointly normal log index, so the note is a sum of multivariate normal probabilities. No simulation, no error bar.

Barrier on daily closes

756 monitored dates

not priced

A daily barrier has no closed form: the index has to be walked step by step and the minimum tracked.

How the note decomposes

from the closed form

Bond leg

79.97

100 at 3y on the issuer curve

Overlay

+18.71

digitals less the down-and-in put

Margin at 100

1.32

issuer's structuring margin

Expected life

1.54 y

66% called at the first observation

Coupon for a 2% margin

Needs paths. Simulate to solve for it.

Outcome probabilities

closed form
Called yr 110965.6%
Called yr 211814.8%
Coupon at yr 31276.7%
Par at yr 310011.7%
Loss at yr 3<1001.2%

Risk-neutral, under a 6.5% forward drift. These are the probabilities the pricing measure implies, not a forecast of what NIFTY will do.


How the numbers are checked

A Monte Carlo price is a number with no witness. It is easy to write one that is wrong by 30bp and looks perfectly reasonable, so the model is held to three independent checks, each committed to the repo with its output.

1. The error bars are honest

25 independent runs at each path count, pricing a three-year ATM call where Black-Scholes gives the exact answer. The root-mean-square error against the exact price should fall as one over the square root of the path count, and it does: the fitted slope is -0.548 against a theoretical -0.5. At two million paths the remaining gap is 0.33 standard errors. So the estimator is unbiased and, more usefully, the standard error it reports is the real one rather than a flattering one.

2. Every component against QuantLib

QuantLib is used purely as an independent witness: nothing in the pricer imports it. Per 100 of notional except the option prices, which are in index points.

CheckOursQuantLibDiff (bp)
Zero-coupon bond, 3y, INR curve82.40698482.4069840.00
3y ATM call, closed form4687.55754687.55750.00
3y ATM call, our Monte Carlo4683.804687.56-8.0
Cash-or-nothing digital, 3y0.6301030.6301030.00
Down-and-in put, daily, vs QL MC177.99172.27+332
Down-and-in put, vs QL with barrier shift177.99177.18+46
Down-and-in put, vs QL continuous177.99184.52-354
Full note, our paths vs QL's generator98.346598.3281+1.8

The one large gap is the interesting row, and it is deliberate. A barrier checked once a day is hit less often than one watched continuously, so our daily-monitored put is 354bp cheaper than QuantLib’s continuous formula, and it should be. Apply the Broadie-Glasserman-Kou correction, which shifts the barrier by exp(-0.5826 σ √dt), and the gap closes to 46bp, inside the noise. A disagreement you can explain and then make disappear is worth more than agreement you cannot account for.

3. A closed form, where one exists

If the barrier is read only at the final fixing, the note has an exact price. With deterministic vol the log index at the observation dates is jointly normal, and every autocall event is a box in that space: “called in year two” is {X₁ < ln 1.0, X₂ ≥ ln 1.0}. So the note is a sum of trivariate normal probabilities. It agrees with plain Monte Carlo on three different term sheets, and collapses to Black-Scholes digitals when there is only one observation.

That closed form then pays for itself twice. Those same event prices are the control variates that make the simulation converge, and the reason they work is worth stating: the obvious control, a vanilla call, is almost useless here (1.1x), because it pays only when the index ends high and on most of those paths the note was already called in year one. The note’s value lives in joint events across dates that no single-date option can see. Pricing those exactly and simulating only the residual cuts the variance 17.9x, which is 25 to 30x at equal running time.


What is different in the browser

The Python computes its box probabilities with scipy’s randomised quasi-Monte-Carlo integrator, which costs about 0.4 seconds per price and jitters in the sixth decimal. Neither scipy nor QuantLib ships to a browser, so the demo computes the same probabilities a different way, and the different way turned out to be better.

That covariance, Cov(Xᵢ, Xⱼ) = w(min(tᵢ, tⱼ)), is Brownian, which means the log index is a Markov chain and a box probability factors into nested one-dimensional integrals. Each one runs between two autocall triggers, so its integrand is analytic on a closed interval with no jump inside it, and Gauss-Legendre on an analytic integrand converges spectrally. 64 nodes reach double precision in under a millisecond, which is what lets the panel above reprice on every drag of a slider.

Checking the port against the Python was the point of writing it. The closed form agrees to 1e-5 per 100 of notional, and on the one-observation case, which is the only one where scipy is exact rather than quasi-random, to 1.4e-14. The residual elsewhere is scipy’s integration noise, not the quadrature’s. The simulated daily-barrier price agrees with the Python’s across eleven scenarios within Monte Carlo error, and the simulator independently reproduces its own closed form on the European-barrier note to 1e-10, since with that convention the control variates span the payoff exactly and the regression residual collapses to machine precision.

What is not here: the calibration pipeline, which needs a 2MB NSE option chain and pandas, so the pillars it fits are baked in as data. The QuantLib cross-checks, the convergence study, the Greeks and the smile analysis also stay in the repo.

KrishB-2005/nifty-autocallable-mldThe Python source of record: calibration off the NSE bhavcopy, the closed form, the Greeks, scenario grids, 36 tests, and every figure and results table regenerated by one script.PythonNumPySciPyQuantLibpandasMonte Carlo

What breaks this model

Roughly in the order that matters for this note.

  1. No smile. Vol is deterministic and at the money. But the investor is short a put struck at 100% that only switches on if NIFTY touches 70% of spot, and at three years that barrier sits around 57% of the forward, deep in the wing where NIFTY implied vol runs several points above ATM. Repricing with a flat vol read off the Dec-2028 smile at the barrier moves the note from 98.35 to 94.61. That is a crude check, since it raises vol everywhere rather than only in the wing, but it sizes the problem: it is the largest single error in the model, and it is larger than the issuer’s whole margin. Local or stochastic vol is the fix, and even then the long-dated wing rests on nine quotes.
  2. No jumps. Geometric Brownian paths cannot gap through a barrier. Overnight gaps, March 2020 or an election result, make knock-in more likely than any diffusion with the same vol.
  3. Issuer credit is a flat spread, independent of the index. NBFC issuers are exposed to the same macro shocks that crash the index, so the default risk is wrong-way: a flat spread understates the loss in exactly the states where the barrier gets hit.
  4. Rates are deterministic, and the INR curve is approximate, anchored to repo at 5.25% and the ten-year G-sec around 7.21% with the interior filled in by hand. For anything real it should be the FBIL zero curve. Settlement lags, the exact holiday calendar, and the final-fixing averaging that Indian term sheets often use are all left out.

This is not investment advice, and it is not a quote. It is a model of a structure, built to study it, with the places it is wrong listed above rather than buried. Every probability on this page is risk-neutral: the “3.3% chance of loss” is what the pricing measure implies under a 6.5% forward drift, not a forecast of what NIFTY will do.