PricingLab

Barrier option: knock-out and knock-in

PricingLab by Raganel Consulting, powered by MatLogica AADC

What it values

A barrier option is an ordinary call or put with one extra condition: a price level (the barrier) that switches the option off or on if the underlying ever touches it before expiry. A knock-out option dies if the barrier is touched; a knock-in option only comes alive if it is. Because they can lapse, barrier options are cheaper than plain options, which is why they are popular in structured products and currency hedging. This model prices one barrier option, with the barrier watched continuously, and returns how the price moves with the underlying price (delta), volatility (vega) and the interest rate (rho).

Who uses this kind of number

Derivatives traders and structurers at banks, corporate treasurers who buy barrier options to hedge currency or commodity exposure more cheaply, and risk and validation teams that check prices quoted by dealers.

Inputs

NameUnitDefaultMeaning
spotprice100Current underlying price
strikeprice100Strike
barrierprice90Barrier level (below spot for down, above for up)
barrier_typetextdown-and-outdown-and-out, down-and-in, up-and-out or up-and-in
option_typetextcallcall or put
volfraction/yr0.20Volatility
ratefraction/yr0.05Risk-free rate, continuously compounded
divfraction/yr0.0Dividend yield
maturityyears1.0Time to expiry
n_pathscount262,144Monte Carlo paths (262,144 at most on the free hosted service)

Every input has a supported range; describe_model lists it. Any input you leave out takes its default. A down barrier must sit below the spot price and an up barrier above it.

Outputs

How the sensitivities are computed

The model simulates the underlying price along many paths. Between simulation dates it does not just check where the price landed; it uses the exact probability that the price touched the barrier in between (a Brownian bridge). That makes the barrier behave as if it were watched continuously, and it makes the price a smooth function of the inputs. Delta, vega and rho then come from the same run, in one forward pass and one backward pass over the calculation (adjoint algorithmic differentiation).

How they are checked

Against bump-and-revalue. The check_against_bumping tool nudges each input up and down, re-prices on the same random paths, and reports the gaps. Measured on 5 November 2026 at the default inputs, 262,144 paths, on two cores of an Intel Xeon 8280L:

SensitivityOne passBump-and-revalueGap (relative to the largest sensitivity)
delta0.824730.824710.00005%
vega11.810311.81140.002%
rho47.652947.64820.010%

All agree within the 2% tolerance the check applies. The one-pass calculation took 133 ms; bump-and-revalue needed 6 valuations and took 472 ms. The same check passes for all eight combinations of up or down, in or out, call or put.

Against the textbook formula. For a continuously watched barrier under the Black–Scholes model there is an exact closed-form price (Reiner and Rubinstein). For a down-and-out call with spot and strike 100, barrier 90, rate 5%, volatility 20% and one year to expiry, the formula gives 8.6655; the model gives 8.6915 with 262,144 paths. The same comparison is run for down-and-in calls and up-and-out and up-and-in puts.

What the model includes

It is designed to price standard single-barrier options and their hedge sensitivities, with every number checkable on the spot against bumping and against the closed form.

Worked example (default inputs)

A one-year down-and-out call, spot and strike 100, barrier 90, volatility 20%, rate 5%, no dividends. Run on 5 November 2026 with 262,144 paths:

OutputResult
Price8.6915
delta0.8247
vega11.81 per 1.00 of volatility (about 0.118 per volatility point)
rho47.65 per 1.00 of rate (about 0.477 per percentage point)

The price is a Monte Carlo estimate; the closed-form value for this option is 8.6655. The value with all three sensitivities took 200 ms.

Three ways to use it

1. From an AI tool, through the hosted MCP endpoint. In any MCP client, add a remote server with this address and no authentication:

https://mypricinglab.com/lab/mcp

Then ask, for example: “Price an up-and-out put with spot 100, strike 100 and barrier 120, and check the sensitivities against bumping.” The tools are list_models, describe_model, price_model, check_against_bumping and run_model_function. The hosted service is free, needs no login, and caps the number of paths.

2. In Excel. Install the PricingLab add-in and open the workbook PricingLab_BarrierOption.xlsx. Instructions and downloads: https://mypricinglab.com/excel

3. On your own machine. The local install runs the same tools with no size caps, and your inputs never leave your machine. It is sent on request (Linux x86-64 today; ask about Mac and Windows): write to info@mypricinglab.com. Once installed:

pricinglab mcp      # MCP server for a local MCP client
pricinglab serve    # local web server for the Excel workbook

Details: https://mypricinglab.com/install

With login

A private hosted service, with your own trades and larger runs, is available. Contact us.

Contact

PricingLab by Raganel Consulting, powered by MatLogica AADC. To run this on your own book, inside your own network, write to info@mypricinglab.com.

This page as Markdown · All models