Calculate the closed-form price of a single-barrier (knock-in or knock-out, up or down) European option using the Reiner & Rubinstein (1991) formulas.

A barrier option is a path-dependent option whose payoff (and existence) depends on whether the underlying stock price touches a pre-specified barrier level at any point before expiration:

  • Knock-out: the option becomes worthless if the barrier is touched.
  • Knock-in: the option only comes into existence if the barrier is touched.
  • Down barrier: the barrier is below the current stock price.
  • Up barrier: the barrier is above the current stock price.

The barrier level is defined relative to the current stock price through barrier_percentage, e.g. a value of 0.9 sets the barrier at 90% of the current stock price (a sensible default for a down barrier).

The formula is as follows (Reiner & Rubinstein, 1991, in the notation of Haug, 2007):

\[H = \text{Barrier Percentage} \cdot S,\;\; \text{with Barrier Percentage defaulting to 0.9}\] \[b = r - q,\;\; \mu = (b - \sigma ^{2} / 2) / \sigma ^{2},\;\; \lambda = \sqrt{\mu ^{2} + 2r / \sigma ^{2}},\;\; \text{φ} = 1 \;\text{for}\; a \;\text{call and} - 1 \;\text{for}\; a \;\text{put},\;\; \text{η} = 1 \;\text{for}\; a \;\text{down barrier and} - 1 \;\text{for an up barrier}\] \[x_{1} = \ln(S / K) / (\operatorname{sigmasqrt}(T)) + (1 + \mu) \operatorname{sigmasqrt}(T),\;\; x_{2} = \ln(S / H) / (\operatorname{sigmasqrt}(T)) + (1 + \mu) \operatorname{sigmasqrt}(T)\] \[y_{1} = \ln(H ^{2} / (S \cdot K)) / (\operatorname{sigmasqrt}(T)) + (1 + \mu) \operatorname{sigmasqrt}(T),\;\; y_{2} = \ln(H / S) / (\operatorname{sigmasqrt}(T)) + (1 + \mu) \operatorname{sigmasqrt}(T)\] \[z = \ln(H / S) / (\operatorname{sigmasqrt}(T)) + \operatorname{lambdasigmasqrt}(T)\] \[A = \text{φS} \cdot e ^{(b - r) T} \cdot N(\text{φx1}) - \text{φK} \cdot e ^{- \text{rT}} \cdot N(\text{φx1} - \operatorname{φsigmasqrt}(T)),\;\; \text{and B the same with x2 in place of x1}\] \[C = \text{φS} \cdot e ^{(b - r) T} \cdot (H / S) ^{\operatorname{2}(\mu + 1)} \cdot N(\text{ηy1}) - \text{φK} \cdot e ^{- \text{rT}} \cdot (H / S) ^{\text{2mu}} \cdot N(\text{ηy1} - \operatorname{ηsigmasqrt}(T)),\;\; \text{and D the same with y2 in place of y1}\] \[E = \text{Rebate} \cdot e ^{- \text{rT}} \cdot (N(\text{ηx2} - \operatorname{ηsigmasqrt}(T)) - (H / S) ^{\text{2mu}} \cdot N(\text{ηy2} - \operatorname{ηsigmasqrt}(T)))\] \[F = \text{Rebate} \cdot ((H / S) ^{\mu + \lambda} \cdot N(\text{ηz}) + (H / S) ^{\mu - \lambda} \cdot N(\text{ηz} - \operatorname{2ηlambdasigmasqrt}(T)))\] \[\text{Down-and-Out Call} (\text{the default}) = A - C + F \;\text{if}\; K > H,\;\; \text{else B - D + F}\] \[\text{Down-and-In Call} = C + E \;\text{if}\; K > H,\;\; \text{else A - B + D + E}\] \[\text{Up-and-Out Call} = F \;\text{if}\; K > H,\;\; \text{else A - B + C - D + F}\] \[\text{Up-and-In Call} = A + E \;\text{if}\; K > H,\;\; \text{else B - C + D + E}\] \[\text{Down-and-Out Put} = A - B + C - D + F \;\text{if}\; K > H,\;\; \text{else F}\] \[\text{Down-and-In Put} = B - C + D + E \;\text{if}\; K > H,\;\; \text{else A + E}\] \[\text{Up-and-Out Put} = B - D + F \;\text{if}\; K > H,\;\; \text{else A - C + F}\] \[\text{Up-and-In Put} = A - B + D + E \;\text{if}\; K > H,\;\; \text{else C + E}\]

Where S is the stock price (the traded close on the pricing date), K is the strike price, H is the barrier, r is the continuously compounded risk-free rate, q is the continuous dividend yield (ln(1 + dividend yield)), σ is the annualized volatility (the standard deviation of the daily returns over the trailing 252 trading days times √252), T is the time to expiration in years (days / 365), N is the cumulative standard normal distribution and the Rebate defaults to 0.

A useful identity is in-out parity: without a rebate, a knock-in option plus its corresponding knock-out option (same direction and barrier) equals the price of the equivalent vanilla Black-Scholes option, since the underlying either does or does not touch the barrier. With a rebate, both legs pay it in the scenario where they do not exist, so the sum exceeds the vanilla price by the value of those rebates.

Also known as: knock-in option, knock-out option, down-and-out, down-and-in, up-and-out, up-and-in option.

Barrier Option in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_barrier_option as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["META"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2025-01-01",
    end_date="2025-12-31",
)

barrier_option = toolkit.options.get_barrier_option(
    strike_price_range=0.1, strike_step_size=10, expiration_time_range=91
)

barrier_option.loc["META", ["2026-01-30", "2026-03-01", "2026-03-31"]]

Or, after setting up the Finance Toolkit MCP, ask:

What was a down-and-out call on Meta with its barrier at 90% of the share price worth at the end of 2025, for the expiries of 30 January, 1 March and 31 March 2026 and strikes within 10% of the share price in $10 steps?

Which returns:

Strike Price 2026-01-30 2026-03-01 2026-03-31
590 70.211 70.5594 71.0161
600 63.6599 65.6623 66.9713
610 57.1775 60.7959 62.9446
620 50.8693 56.0077 58.9639
630 44.8284 51.341 55.0551
640 39.1312 46.8335 51.2414
650 33.8365 42.5169 47.543
660 28.9845 38.4166 43.9768
670 24.5979 34.5518 40.557
680 20.6836 30.9358 37.2945
690 17.2345 27.5763 34.1974
700 14.2322 24.4761 31.2713
710 11.6493 21.6334 28.519
720 9.4527 19.043 25.9413

Parameters

get_barrier_option accepts the following parameters.

ParameterTypeDescriptionExample
start_datestr | NoneThe date whose price, volatility and rates the values start from; a date without prices (a weekend or a holiday) uses the last trading day before it, and a ticker without a price on that day is left out with a warning. Defaults to None, which uses the last date of the historical data."2021-01-01"
put_optionboolWhether to calculate the put option price. Defaults to False which means it will calculate the call option price.True
barrier_percentagefloatThe barrier level as a percentage of the current stock price. Defaults to 0.9 which equals 90% of the current stock price. A down barrier needs a value below 1 and an up barrier a value above 1; otherwise the barrier is already breached.1.2
barrier_directionstrEither “down” or “up”. Defaults to “down”."up"
knock_typestrEither “in” or “out”. Defaults to “out”."in"
rebatefloatThe fixed cash amount paid out if the option knocks out (or fails to knock in). Defaults to 0.0.1.0
strike_price_rangefloatThe percentage range to use for the strike prices. Defaults to 0.25 which equals 25% and thus results in strike prices from 75 to 125 if the current stock price is 100.0.1
strike_step_sizeintThe step size to use for the strike prices. Defaults to 5 which means that the strike prices will be 75, 80, 85, 90, 95, 100, 105, 110, 115 and 120 if the current stock price is 100.1
expiration_time_rangeintThe number of days to use for the time to expiration: the columns are the expirations 1 up to expiration_time_range - 1 days after the start date. Defaults to 30, which gives expirations of 1 to 29 days.90
risk_free_ratefloatThe risk free rate to use for the calculation. Defaults to None, which uses the Toolkit’s risk-free rate on the pricing date: the 10-year Treasury yield unless the Toolkit’s risk_free_rate parameter selects ‘13w’, ‘5y’ or ‘30y’, converted from its semi-annual bond-equivalent quote to continuous compounding. A rate passed here is used as given, as a continuously compounded rate.0.04
dividend_yieldfloatThe dividend yield to use for the calculation. Defaults to None, which uses the dividend yield on the pricing date (the dividends of the 365 days up to it relative to its close, as the continuously compounded ln(1 + q)). A given value is used as a continuous yield.0.02
show_input_infoboolWhether to show the input information. Defaults to False.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
standardizeboolWhether to standardize (Z-Score) the result across the time to expiration columns for each ticker and strike price. Defaults to False.True
Share