08 · Exotic Options · Monte Carlo

Barrier Options
under Heston.

A Monte Carlo pricer for the eight single-barrier options (knock-in and knock-out, up and down, calls and puts) on the CAC40, under the calibrated Heston model, with European, Bermudan and American exercise and seven Greeks. The pricer matches the closed-form barrier prices within two standard errors. Daily monitoring overprices knock-outs by up to 27%, and the right to exercise early lifts a one-year down-and-out put from €16 to €341.

Context Personal study — October 2026
Model Heston calibrated on 142 CAC40 options (12/02/2025), forward from put-call parity
Method Euler full truncation · Brownian bridge · Longstaff–Schwartz · control variate
Outputs 8 products × 3 exercise styles · Delta, Gamma, Vega, Vanna, Volga, Rho, Theta

Options that depend on the path.

A barrier option is a vanilla call or put that is switched on or off when the underlying touches a level \(H\) before maturity. It is cheaper than the vanilla, which makes it one of the most traded exotic products in structured equity notes. But its value depends on the whole path of the spot, not only on its final value, so two models that agree on every vanilla price can disagree on a barrier.

This project prices barrier options on the CAC40 under the Heston model calibrated in the Heston project. Because the volatility is stochastic, there is no closed form: prices come from a Monte Carlo engine that has to address three issues.

Monitoring A simulation only sees the spot on a grid. Barrier crossings between two dates must be recovered.
Exercise Bermudan and American options need an optimal stopping rule, estimated from the simulated paths.
Greeks The payoff is discontinuous at the barrier, so finite-difference Greeks are noisy unless the noise is controlled.

Eight barriers, three exercise styles.

Each product is identified by a three-letter code: call or put, down or up, in or out. No rebate is paid when a knock-out option dies.

Down (\(H\lt S_0\)) Up (\(H\gt S_0\))
Put, knock-inPDIPUI
Put, knock-outPDOPUO
Call, knock-inCDICUI
Call, knock-outCDOCUO

The eight single-barrier options.

With \(\tau_H=\inf\{t:S_t\text{ touches }H\}\) the first hitting time of the barrier, the European payoffs are:

Knock-out and knock-in payoffs
\[ V^{\mathrm{out}}_T=(\phi(S_T-K))^+\,\mathbf 1_{\{\tau_H>T\}}, \qquad V^{\mathrm{in}}_T=(\phi(S_T-K))^+\,\mathbf 1_{\{\tau_H\le T\}}, \qquad \phi=\pm1 \]

Since the two indicators add up to one on every path, a knock-in and a knock-out with the same strike and barrier always add up to the vanilla:

In / out parity
\[ V^{\mathrm{in}}+V^{\mathrm{out}}=V^{\mathrm{vanilla}} \]

Each product can be exercised in three ways. A European option is exercised at maturity only, a Bermudan option on a list of dates (here monthly, 13 dates including maturity), an American option on any simulation date. A knock-out option can only be exercised while it is alive; a knock-in option only once it has been activated.

A calibrated Heston model.

The market data are the same as in the Heston project: CAC40 spot \(S_0=8042.19\), 142 option quotes on 13 expiries, EURIBOR 6M zero curve, on 12 February 2025. The forward curve \(F(0,T)\) comes from put-call parity, with a bootstrapped borrow-plus-dividend yield; the one-year forward is 8025.05.

The Heston model is recalibrated with a local L-BFGS-B run started from the global minimum found in the Heston project, and recovers it with an implied volatility RMSE of 0.421 vol points:

\(v_0\) \(\theta\) \(\kappa\) \(\xi\) \(\rho\) Feller ratio
0.01970.04381.308 0.482−0.6050.49

Calibrated Heston parameters: spot volatility \(\sqrt{v_0}\approx14.1\%\), long-run volatility \(\sqrt\theta\approx20.9\%\).

Paths are simulated with an Euler scheme with full truncation of the variance, and a log-Euler step for the spot whose drift is read from the forward curve:

Path simulation
\[ \begin{aligned} v_{i+1}&=v_i+\kappa\big(\theta-v_i^+\big)\Delta t+\xi\sqrt{v_i^+\Delta t}\,Z^v_i,\\ S_{i+1}&=S_i\exp\!\Big(\ln\tfrac{F(0,t_{i+1})}{F(0,t_i)}-\tfrac12 v_i^+\Delta t+\sqrt{v_i^+\Delta t}\,Z^S_i\Big), \qquad Z^S_i=\rho Z^v_i+\sqrt{1-\rho^2}\,Z^\perp_i \end{aligned} \]

The drift term gives \(\mathbb E[S_T]=F(0,T)\) exactly, so the rates and the seasonal dividends of the CAC40 are carried by every path. The time step is one trading day (\(\Delta t=1/252\)), and the default run uses 50,000 paths.

Crossings between two simulation dates.

If the barrier is only checked on the simulation dates, a path can cross \(H\) and come back between \(t_i\) and \(t_{i+1}\) without being detected. Knock-outs are then overpriced and knock-ins underpriced. Conditionally on its two end points, \(\ln S\) over a step is a Brownian bridge, whose probability of touching \(H\) is known in closed form:

Brownian bridge crossing probability
\[ p_i=\exp\!\left(-\,\frac{2\,\ln(S_{i}/H)\,\ln(S_{i+1}/H)}{v_{i}\,\Delta t}\right) \]

It assumes a constant variance over the step, here the Heston variance \(v_i\) at the start of the step. The pricer uses it in two ways:

01

European exercise: survival weighting

Each payoff is weighted by its probability of survival, which removes the noise of sampling the crossings:

\[ V^{\mathrm{out}}\approx\mathbb E\Big[D(T)\,(\phi(S_T-K))^+\prod_i(1-p_i)\Big] \]

and \(1-\prod_i(1-p_i)\) for a knock-in. Paths that are on the knocked side at a simulation date get a weight of zero (knock-out) or one (knock-in).

Smooth estimator
02

Early exercise: sampled crossings

With early exercise the knock date matters, since it decides when exercise is allowed. The crossing is then sampled: the barrier is hit in step \(i\) if \(U_i\lt p_i\), with \(U_i\) uniform.

Exact hitting time

For comparison, the classic Broadie–Glasserman–Kou correction prices a discretely monitored barrier as a continuous one with \(H\) shifted away from the spot by a factor \(e^{0.5826\,\sigma\sqrt{\Delta t}}\), about 0.73% for \(\sigma=20\%\) and daily dates. Section 07 measures the effect of monitoring on the prices directly.

Longstaff–Schwartz with a barrier.

Bermudan and American options are priced by the Longstaff–Schwartz (2001) algorithm. Going backward through the exercise dates, the holder exercises when the payoff exceeds the continuation value, estimated by regressing the discounted future cash flows on functions of the current state:

Exercise rule
\[ \text{exercise at } t_i \iff (\phi(S_{t_i}-K))^+>\hat C(t_i)=\sum_k\hat\beta_k\,\psi_k\big(S_{t_i},v_{t_i}\big) \]

Since the variance is a state variable of Heston, the regression basis includes it, with \(x=S/K\) and \(u=v/\bar v\):

Regression basis
\[ \psi=\big\{1,\ x,\ x^2,\ x^3,\ u,\ u\,x,\ u^2,\ \mathrm{BS}\big(S_{t_i},\sqrt{v_{t_i}},T-t_i\big)/K\big\} \]

The last function is the Black price of the European vanilla on the remaining maturity, with volatility \(\sqrt{v_t}\). It is a lower bound of the continuation value of a vanilla: without it, the cubic polynomial triggers sub-optimal early exercises, and an American call came out cheaper than the European one.

The barrier enters through the set of paths allowed to exercise. A knock-out can only be exercised before its hitting time \(\tau_H\), a knock-in only after it. The regression is run on the in-the-money paths of this set, and its cash flow is zero on a knocked-out path.

Bias. The exercise policy is estimated and applied on the same paths, and is sub-optimal: Longstaff–Schwartz prices are lower bounds of the true price, slightly biased downward.

Antithetic paths and a vanilla control variate.

Two techniques reduce the Monte Carlo error at no extra simulation cost:

Antithetic Each Gaussian draw \((Z^v,Z^\perp)\) is also used with the opposite sign, and the two payoffs are averaged.
Control variate The European vanilla with the same strike, whose Heston price \(\mathbb E[X]\) is known semi-analytically (Lewis formula), corrects each sample.
Control variate estimator
\[ Y^{\mathrm{cv}}=Y-\beta\big(X-\mathbb E[X]\big), \qquad \beta=\frac{\mathrm{Cov}(Y,X)}{\mathrm{Var}(X)}, \qquad \mathrm{Var}\big(Y^{\mathrm{cv}}\big)=(1-\rho_{XY}^2)\,\mathrm{Var}(Y) \]

The gain is largest when the barrier is rarely touched and the option is close to the vanilla. In the validation below, the standard error of the down-and-in put is 0.0036 on a price of 6.70, against 0.0193 for the up-and-in put, whose payoff is less correlated with the vanilla.

A side effect is that in / out parity holds to machine precision for European options. The knock-in and knock-out weights add up to one on each path, so their samples add up to the vanilla payoff, and their control variate coefficients add up to one: the corrected prices add up to the exact Heston vanilla. Parity is therefore a consistency check of the code, not an independent test of accuracy.

Checking against closed forms.

Vanilla options. Without control variate, Monte Carlo prices of one-year vanillas under the calibrated Heston model are compared with the semi-analytical Lewis prices:

Option Heston (Lewis) Monte Carlo Std error Error / std error
Call K=72001029.621028.542.77−0.39
Put K=7200223.57223.762.540.07
Call K=8000491.97491.032.32−0.41
Put K=8000467.50467.833.260.10
Call K=8800163.21163.461.710.15
Put K=8800920.31921.843.600.42

One-year vanillas, 50,000 antithetic paths, daily steps, no control variate.

All errors are below half a standard error: the Euler bias is not visible at this level of noise.

Barrier options. In a flat Black-Scholes market, continuously monitored barriers have closed-form prices (Merton 1973, Reiner–Rubinstein 1991). With cost of carry \(b\), they are combinations of four terms, for instance a down-and-out call with \(K\gt H\):

Reiner–Rubinstein building blocks
\[ \begin{aligned} \mathrm{CDO}&=A-C,\qquad A=S e^{(b-r)T}N(x_1)-Ke^{-rT}N(x_1-\sigma\sqrt T),\\ C&=S e^{(b-r)T}\Big(\tfrac{H}{S}\Big)^{2(\mu+1)}N(y_1)-Ke^{-rT}\Big(\tfrac{H}{S}\Big)^{2\mu}N(y_1-\sigma\sqrt T),\\ x_1&=\frac{\ln(S/K)}{\sigma\sqrt T}+(1+\mu)\sigma\sqrt T,\quad y_1=\frac{\ln\big(H^2/(SK)\big)}{\sigma\sqrt T}+(1+\mu)\sigma\sqrt T,\quad \mu=\frac{b-\sigma^2/2}{\sigma^2} \end{aligned} \]

The other seven cases use the same terms with different signs (BlackScholes.bs_price_barrier). A Heston model with \(v_0=\theta=\sigma^2\) and a negligible vol-of-vol (\(\xi=10^{-4}\)) is a Black-Scholes model, so the Monte Carlo pricer must recover these prices. Test market: \(S=100\), \(K=100\), \(r=3\%\), \(q=1\%\), \(\sigma=20\%\), \(T=1\), barriers at 90 and 110.

Option Closed form MC continuous Std error Error / std error MC discrete (daily) Discrete bias
PDI, H=906.70466.70780.00360.896.6626−0.6%
PDO, H=900.16230.15840.0036−1.080.2036+25.4%
PUI, H=1101.61701.58110.0193−1.861.3903−14.0%
PUO, H=1105.24995.28510.01931.835.4759+4.3%
CDI, H=901.59951.57980.0227−0.871.3667−14.6%
CDO, H=907.22787.24690.02270.847.4600+3.2%
CUI, H=1108.70938.71000.00310.238.6764−0.4%
CUO, H=1100.11800.11660.0031−0.450.1502+27.3%

Flat Black-Scholes market, \(K=100\), \(T=1\). Discrete bias: daily monitoring relative to the closed form.

With continuous monitoring, all eight prices are within 1.9 standard errors of the closed form. With daily monitoring and no correction, every knock-out is overpriced and every knock-in underpriced. The relative error is largest for the options whose value comes from paths that stay close to the barrier: +25% on the down-and-out put and +27% on the up-and-out call, whose payoffs are only positive between the strike and the barrier.

Barrier prices on the CAC40.

All options have a maturity of one year and an at-the-money strike \(K=8000\). Down barriers are at 7200 (about 90% of the spot), up barriers at 8800 (about 110%). Prices are in index points.

Option European Std error Discrete (daily) Bermudan (monthly) American
PDI, H=7200451.090.32447.41460.58462.09
PDO, H=720016.410.3220.09199.32341.19
PUI, H=880063.811.3655.0564.7266.12
PUO, H=8800403.691.36412.45413.14414.77
CDI, H=720083.651.3570.7384.3083.79
CDO, H=7200408.321.35421.24408.70408.76
CUI, H=8800428.940.67423.08429.62429.58
CUO, H=880063.040.6768.89290.45380.46
Call (vanilla)491.97——492.59492.70
Put (vanilla)467.50——477.29477.99

Heston prices, \(K=8000\), \(T=1\), 50,000 paths. The 30 prices take 19.4 s.

Monitoring. On the CAC40 as in the flat test, daily monitoring overprices the knock-outs (PDO +22%, CDO +3.2%) and underprices the knock-ins (PUI −14%, CDI −15%). The European in / out pairs add up exactly to the Heston vanillas, 491.97 for calls and 467.50 for puts.

Early exercise. American ≥ Bermudan ≥ European holds in all but two cases, where the differences are inside the Monte Carlo error. The early exercise premium is small for vanillas (+0.7 on the call; +10.5 on the put, which can be exercised early to earn interest on the strike) but very large for two knock-outs:

PDO €16 European, €199 Bermudan, €341 American. The European put pays only if the spot ends between 7200 and 8000 without ever touching 7200. The American holder exercises as the spot falls toward the barrier, collecting up to 800 points of intrinsic value before the option is knocked out.
CUO €63 European, €290 Bermudan, €380 American, by the same mechanism above the strike.

Monthly exercise captures only part of this premium: the spot can cross the barrier between two exercise dates. The Bermudan PDO is worth 58% of the American one.

Two inversions. The American CDI (83.79) is priced below the Bermudan one (84.30), and the American CUI (429.58) just below the Bermudan (429.62). Both gaps are within one standard error (about 1.3 and 0.7). For in-the-money knock-ins, the early exercise right is almost worthless, so the estimated premium is dominated by Monte Carlo noise and by the sub-optimality of the Longstaff–Schwartz policy.
Bar chart of the eight barrier option prices for European, Bermudan and American exercise
Barrier option prices for the three exercise styles (\(K=8000\), \(T=1\)).

Convergence. With 100,000 paths, the 95% confidence interval is ±0.43 on the European PDO and ±1.4 on the American one. The European price stabilizes at about 16.1–16.3 from 20,000 paths, the American one at about 340–342.

Price and 95 percent confidence interval of the European and American PDO as a function of the number of paths
PDO price and 95% confidence interval as a function of the number of paths (5,000 to 100,000).

Bump and revalue with common random numbers.

The Greeks are computed by central finite differences, for instance for the Delta and the Gamma with a spot bump \(h\):

Central differences
\[ \Delta\approx\frac{V(S_0+h)-V(S_0-h)}{2h}, \qquad \Gamma\approx\frac{V(S_0+h)-2V(S_0)+V(S_0-h)}{h^2} \]

Every bumped price uses the same random numbers (fixed seed), so the Monte Carlo noise mostly cancels in the differences. The differences are computed path by path, which gives each Greek its own standard error.

Greek Bump Unit
Delta, GammaSpot ±1% (forwards move proportionally)Per index point
Vega, Volga\(\sqrt{v_0}\) and \(\sqrt\theta\) shifted by ±1 vol pointPer vol point
VannaSpot and vol togetherDelta change per vol point
RhoZero curve ±10 bp (carry kept)Per +1% of rates
ThetaMaturity −1 dayPer calendar day

Bumps and units. In Heston there is no single volatility: the Vega moves the whole volatility level, spot and long run.

Option Price Delta Gamma (×10⁴) Vega Vanna (×10³) Volga Rho Theta
PDI451.09−0.3503.4233.02−5.18−0.50−31.54−0.675
PDO16.41−0.008−0.09−2.023.040.59−1.90+0.057
PUI63.810.1412.5012.9020.381.020.62−0.306
PUO403.69−0.4990.8218.11−22.52−0.93−34.06−0.312
CDI83.65−0.0450.2512.27−7.830.904.33−0.413
CDO408.320.6623.0818.745.69−0.8240.39−0.589
CUI428.940.6795.3942.47−1.32−1.7046.17−1.212
CUO63.04−0.062−2.06−11.46−0.821.79−1.45+0.210

Greeks of the European options at the current spot (\(K=8000\), \(T=1\)). Computed in 76.6 s.

Three features distinguish barriers from vanillas:

Negative Vega The PDO (−2.0) and the CUO (−11.5) lose value when volatility rises: more volatility means more chances of being knocked out before the payoff is reached.
Positive Theta The same two options gain value as time passes (+0.06 and +0.21 per day): every day without a knock-out shortens the remaining exposure to the barrier.
Wrong-way Delta The CUO is a call with a negative Delta (−0.06): a higher spot brings it closer to its up barrier. The PUI is a put with a positive Delta (+0.14), since a higher spot makes the knock-in more likely.

The standard errors show which Greeks are reliable. For the PDO, the Delta (−0.0078 ± 0.0017), the Vega (−2.02 ± 0.13) and the Theta (0.057 ± 0.009) are well determined; the Gamma (−0.9 × 10⁻⁵ ± 3.2 × 10⁻⁵) is not distinguishable from zero, and the Volga (0.59 ± 0.26) is only marginally. Second-order Greeks of barrier options remain noisy because the payoff is discontinuous at the barrier.

Bar charts of the price and seven Greeks of the eight European barrier options, with 95 percent confidence intervals
Price and Greeks of the European barrier options, with 95% Monte Carlo confidence intervals.

Early exercise. The same machinery applies to Bermudan and American options, with the Longstaff–Schwartz policy re-estimated in each bumped scenario. The early exercise right changes the risk profile of the knock-outs completely:

Option Price Delta Vega Rho Theta
PDO European16.41−0.008−2.02−1.900.057
PDO Bermudan199.32−0.1960.89−7.491.134
PDO American341.19−0.29413.75−13.98−0.239
CUO European63.04−0.062−11.46−1.450.210
CUO Bermudan290.450.3151.8112.07−0.442
CUO American380.460.43713.9218.96−0.430

Greeks of the knock-outs for the three exercise styles. Bermudan and American Greeks computed in 108 s.

With American exercise the holder no longer needs to survive until maturity, so the Vega of both knock-outs turns strongly positive (about +14), and the CUO's Delta becomes that of a call again (+0.44). The Bermudan Theta of the PDO (+1.13 per day) is the least reliable value of the table: it moves the monthly exercise dates by one day, which changes the exercise policy.

Heston parameters. The sensitivity to each calibrated parameter (1% relative bumps) shows the model risk of each product:

Derivative PDO PDI CUO CUI
\(\partial V/\partial v_0\)−409.65094.8−1338.26023.4
\(\partial V/\partial\theta\)−377.64641.8−1677.85942.0
\(\partial V/\partial\kappa\)−8.084.4−45.3121.7
\(\partial V/\partial\xi\)14.6−206.0143.5−334.9
\(\partial V/\partial\rho\)24.212.5−66.6103.3

Derivatives per unit of each parameter, European options.

Knock-outs are short variance (negative derivatives in \(v_0\) and \(\theta\)) but long vol-of-vol, the mirror image of the knock-ins. The correlation matters most for the up barriers: \(\partial V/\partial\rho=103\) for the CUI. With \(\rho\lt0\), a rising spot comes with falling volatility, which makes the up barrier harder to reach. Since the calibration only pins \(\rho\xi\) well at short maturities, this is precisely where two models fitted to the same vanillas can disagree on barrier prices.

Profiles. Price and Greeks of the European options on a grid of spots from 6600 to 9400, with all options priced on the same paths in each scenario (30,000 paths, 222 s):

Price and seven Greeks of the four knock-out options as a function of the spot
Knock-out options: price and Greeks against the spot. Vertical lines: spot, strike, down barrier 7200, up barrier 8800.

A knock-out loses all its value at the barrier, so its Gamma spikes close to it (the PUO's Gamma reaches 0.0026 just below 8800, the CDO's 0.0017 just above 7200) and its Vega falls to zero. The CUO's Vega is most negative around the strike (−11.5 at 8000), where the option has value to lose. These concentrations of Gamma near the barrier are what makes barrier options hard to hedge in practice.

Price and seven Greeks of the four knock-in options as a function of the spot
Knock-in options: price and Greeks against the spot. Beyond its barrier, a knock-in becomes the vanilla.

Contracts, engine and risk kept apart.

The code separates what a product is, how it is priced and how its risk is measured, so that the same engine prices vanillas and barriers under any model that can simulate paths:

products.py Exercise (European, Bermudan, American), VanillaOption and BarrierOption, built from its code (from_code("PDO", ...)). A product knows its payoff and barrier, nothing about the model.
monte_carlo.py MonteCarloPricer: path cache, Brownian bridge, survival weights, Longstaff–Schwartz, control variate and antithetic averaging. It only needs generate_paths and zc_rate from the model.
greeks.py Greeks: spot, volatility, rate and time bumps, Heston parameter sensitivities, tables and spot profiles, each value with its standard error.
KO / KI pricers KO_pricer and KI_pricer: one call per option, returning the product, the price, its standard error and, on request, the Greeks.
Call Price 95% interval
KO_pricer(heston, "PDO", 8000, 7200, 1.0, exercise="bermudan", exercise_period=1/12)199.32±1.72
KI_pricer(heston, "CUI", 8000, 8800, 1.0, exercise="american")429.58±1.72

The two entry points of the project.

What the pricer still approximates.

01

Discretization

The Euler full truncation scheme is biased when the Feller condition is violated (ratio 0.49 here). The bias is not visible on the vanillas, but the Andersen QE scheme would be safer. The Brownian bridge correction assumes a constant variance over each step.

Simulation
02

Early exercise

Longstaff–Schwartz gives a lower bound, estimated on the same paths as the price. An upper bound (Andersen–Broadie duality) would bracket the true price. Bermudan dates are rounded to the closest simulation date.

Exercise
03

Noisy second-order Greeks

Gamma, Vanna and Volga remain noisy near the barrier despite common random numbers. Smoothing the payoff, or pathwise and likelihood-ratio estimators, would reduce the noise. Theta keeps the curves and the model unchanged.

Greeks
04

Model risk

Heston fits the vanillas but its forward smile dynamics are imposed by the model. Barrier prices depend on these dynamics: a local volatility model fitted to the same surface would give different prices. Stochastic local volatility is the market standard for barriers.

Model
05

Products

No rebate, single barriers only, and a barrier monitored on every simulation day. Double barriers, rebates and window barriers are not supported.

Scope

From a calibrated surface to exotic risk.

Accuracy Closed-form barrier prices recovered within 1.9 standard errors, vanillas within 0.5.
Monitoring Uncorrected daily monitoring misprices barriers by up to 27%; the Brownian bridge removes this bias.
Exercise American exercise multiplies the value of a down-and-out put by 21 and turns its Vega from negative to positive.
Next steps QE scheme, duality upper bound for early exercise, rebates and double barriers, and a stochastic local volatility model to measure the model risk of barrier prices.
A barrier option is a bet on the path, not on the terminal value. Getting the path right requires continuous monitoring, an exercise policy that respects the barrier, and Greeks with their error bars: the sign of the Vega, the Delta and the Theta can all differ from those of the underlying vanilla.