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.
ContextPersonal study — October 2026
ModelHeston calibrated on 142 CAC40 options (12/02/2025), forward from put-call parity
MethodEuler full truncation · Brownian bridge · Longstaff–Schwartz · control variate
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.
02 / Products
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-in
PDI
PUI
Put, knock-out
PDO
PUO
Call, knock-in
CDI
CUI
Call, knock-out
CDO
CUO
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:
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.
03 / Model
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:
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:
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.
04 / Monitoring
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:
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.
05 / Exercise
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\):
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.
06 / Variance Reduction
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.
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.
07 / Validation
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=7200
1029.62
1028.54
2.77
−0.39
Put K=7200
223.57
223.76
2.54
0.07
Call K=8000
491.97
491.03
2.32
−0.41
Put K=8000
467.50
467.83
3.26
0.10
Call K=8800
163.21
163.46
1.71
0.15
Put K=8800
920.31
921.84
3.60
0.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\):
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=90
6.7046
6.7078
0.0036
0.89
6.6626
−0.6%
PDO, H=90
0.1623
0.1584
0.0036
−1.08
0.2036
+25.4%
PUI, H=110
1.6170
1.5811
0.0193
−1.86
1.3903
−14.0%
PUO, H=110
5.2499
5.2851
0.0193
1.83
5.4759
+4.3%
CDI, H=90
1.5995
1.5798
0.0227
−0.87
1.3667
−14.6%
CDO, H=90
7.2278
7.2469
0.0227
0.84
7.4600
+3.2%
CUI, H=110
8.7093
8.7100
0.0031
0.23
8.6764
−0.4%
CUO, H=110
0.1180
0.1166
0.0031
−0.45
0.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.
08 / Prices
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=7200
451.09
0.32
447.41
460.58
462.09
PDO, H=7200
16.41
0.32
20.09
199.32
341.19
PUI, H=8800
63.81
1.36
55.05
64.72
66.12
PUO, H=8800
403.69
1.36
412.45
413.14
414.77
CDI, H=7200
83.65
1.35
70.73
84.30
83.79
CDO, H=7200
408.32
1.35
421.24
408.70
408.76
CUI, H=8800
428.94
0.67
423.08
429.62
429.58
CUO, H=8800
63.04
0.67
68.89
290.45
380.46
Call (vanilla)
491.97
—
—
492.59
492.70
Put (vanilla)
467.50
—
—
477.29
477.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.
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.
PDO price and 95% confidence interval as a
function of the number of paths (5,000 to
100,000).
09 / Greeks
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\):
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, Gamma
Spot ±1% (forwards move proportionally)
Per index point
Vega, Volga
\(\sqrt{v_0}\) and \(\sqrt\theta\) shifted by ±1 vol point
Per vol point
Vanna
Spot and vol together
Delta change per vol point
Rho
Zero curve ±10 bp (carry kept)
Per +1% of rates
Theta
Maturity −1 day
Per 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
PDI
451.09
−0.350
3.42
33.02
−5.18
−0.50
−31.54
−0.675
PDO
16.41
−0.008
−0.09
−2.02
3.04
0.59
−1.90
+0.057
PUI
63.81
0.141
2.50
12.90
20.38
1.02
0.62
−0.306
PUO
403.69
−0.499
0.82
18.11
−22.52
−0.93
−34.06
−0.312
CDI
83.65
−0.045
0.25
12.27
−7.83
0.90
4.33
−0.413
CDO
408.32
0.662
3.08
18.74
5.69
−0.82
40.39
−0.589
CUI
428.94
0.679
5.39
42.47
−1.32
−1.70
46.17
−1.212
CUO
63.04
−0.062
−2.06
−11.46
−0.82
1.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.
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 European
16.41
−0.008
−2.02
−1.90
0.057
PDO Bermudan
199.32
−0.196
0.89
−7.49
1.134
PDO American
341.19
−0.294
13.75
−13.98
−0.239
CUO European
63.04
−0.062
−11.46
−1.45
0.210
CUO Bermudan
290.45
0.315
1.81
12.07
−0.442
CUO American
380.46
0.437
13.92
18.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.6
5094.8
−1338.2
6023.4
\(\partial V/\partial\theta\)
−377.6
4641.8
−1677.8
5942.0
\(\partial V/\partial\kappa\)
−8.0
84.4
−45.3
121.7
\(\partial V/\partial\xi\)
14.6
−206.0
143.5
−334.9
\(\partial V/\partial\rho\)
24.2
12.5
−66.6
103.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):
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.
Knock-in options: price and Greeks against the
spot. Beyond its barrier, a knock-in becomes
the vanilla.
10 / Implementation
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.pyExercise (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.pyMonteCarloPricer: 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.pyGreeks: spot, volatility, rate
and time bumps, Heston parameter
sensitivities, tables and spot profiles,
each value with its standard error.
KO / KI pricersKO_pricer and
KI_pricer: one call per
option, returning the product, the price,
its standard error and, on request, the
Greeks.
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
12 / Summary
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.