# 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

| Name | Unit | Default | Meaning |
|---|---|---|---|
| `spot` | price | 100 | Current underlying price |
| `strike` | price | 100 | Strike |
| `barrier` | price | 90 | Barrier level (below spot for down, above for up) |
| `barrier_type` | text | down-and-out | down-and-out, down-and-in, up-and-out or up-and-in |
| `option_type` | text | call | call or put |
| `vol` | fraction/yr | 0.20 | Volatility |
| `rate` | fraction/yr | 0.05 | Risk-free rate, continuously compounded |
| `div` | fraction/yr | 0.0 | Dividend yield |
| `maturity` | years | 1.0 | Time to expiry |
| `n_paths` | count | 262,144 | Monte 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

- **Value**: the option price, in the same currency as the spot price.
- **delta**: change in price per 1.00 change in the spot price.
- **vega**: change in price per 1.00 change in volatility (per 0.01, divide by 100).
- **rho**: change in price per 1.00 change in the interest rate (per 0.01, divide by 100).
- **Timing** of the calculation in milliseconds.

## 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:

| Sensitivity | One pass | Bump-and-revalue | Gap (relative to the largest sensitivity) |
|---|---|---|---|
| delta | 0.82473 | 0.82471 | 0.00005% |
| vega | 11.8103 | 11.8114 | 0.002% |
| rho | 47.6529 | 47.6482 | 0.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

- One European call or put with a single barrier: down or up, knock-out or knock-in.
- The barrier is monitored continuously, through the Brownian-bridge crossing probability on 50 time steps.
- The underlying follows the Black–Scholes model: lognormal, with constant volatility, interest rate and dividend yield.
- No rebate is paid when a knock-out option is knocked out.

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:

| Output | Result |
|---|---|
| Price | 8.6915 |
| delta | 0.8247 |
| vega | 11.81 per 1.00 of volatility (about 0.118 per volatility point) |
| rho | 47.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.
