Speed

How Often You Look at the Barrier

The closed form for a knock-out watches the barrier at every instant; a contract that looks only on a few dates is touched less often and is worth more. The demo simulates the up-and-out call for 1 to 32 looks and sets it beside the continuous price.

The question

In the last lesson the barrier was watched at every instant. A real contract says when the price is looked at: every trade, a daily close, once a month. A price that rises above the barrier between two looks and falls back is never seen. Does it matter for the price how often the barrier is looked at?

The lesson prices an up-and-out call with the barrier looked at 1, 2, 4, 8, 16 and 32 equally spaced dates, by simulation, and with the closed form for continuous watching. The inputs are assumptions of the lesson.

Work it by hand

Take a made-up path of six prices, 100, 108, 124, 111, 105, 113, a strike of 100 and an up barrier of 120. Looking at every point, the price 124 is seen: the barrier is touched and the knock-out pays 0.

Look only at the first and the last point, as a contract with one look at expiry would, and the path shows 100 and 113. The barrier is not touched, and the knock-out pays the plain payoff 113 - 100 = 13. The excursion to 124 happened between two looks and nobody saw it.

So fewer looks, fewer cancellations, a higher price: a knock-out is worth more the less often the barrier is watched.

Run it

The program prices the same up-and-out call six times with pricing.monte_carlo_steps(paths, seed, n), which draws paths paths and looks at the barrier on n equally spaced points, 1, 2, 4, 8, 16 and 32 (lines 6 to 12, n doubling at line 11). Lines 13 to 15 add the closed form for continuous watching.

Lines 16 to 18 return the looks, the prices and the standard errors; the picture draws the prices. Line 20 returns the plain call in whole cents, rounded with lmf.round; no knock-out can be worth more than it.

Seven bars, for 1, 2, 4, 8, 16 and 32 looks and for continuous watching. The prices fall from about 3.00 with one look to about 1.56 with 32 looks, and the last bar, continuous watching, is 1.18.
let m = model.black_scholes(spot, rate, 0.0, vol);
let op = instrument.barrier_call(strike, 1.0, barrier, "up-out");
let call = instrument.european_call(strike, 1.0);
let looks = str_list(); let price = float_list(); let err = float_list();
let n = 1;
for (k in range(0, 6)) {
  let r = pricing.price(op, m, pricing.monte_carlo_steps(paths, seed, n));
  looks.add(str(n));
  price.add(lmf.round(r.price(), 4));
  err.add(lmf.round(r.stderr(), 4));
  n = n * 2;
}
looks.add("continuous");
price.add(lmf.round(pricing.price(op, m, pricing.analytic()).price(), 4));
err.add(0.0);
lmcode_return_put("looks", looks);
lmcode_return_put("price", price);
lmcode_return_put("stderr", err);
let plain = pricing.price(call, m, pricing.analytic()).price();
let answer = int(math_round(lmf.round(plain, 2) * 100.0));
{
  "answer": 1045,
  "looks": [
    "1",
    "2",
    "4",
    "8",
    "16",
    "32",
    "continuous"
  ],
  "price": [
    2.9969,
    2.6535,
    2.2031,
    2.0674,
    1.8319,
    1.5599,
    1.1761
  ],
  "stderr": [
    0.0732,
    0.0706,
    0.063,
    0.0617,
    0.0584,
    0.054,
    0
  ]
}

With 5,000 paths and the seed 42 the recording shows the prices in the picture: they fall from 3.00 with one look to 1.56 with 32 looks, and the continuous price is 1.18. Each simulated price has a standard error from 0.054 to 0.073, and another seed gives other numbers, so two neighbouring bars can be closer than their errors.

You can change paths, seed and the market inputs.

Keep the barrier above the spot: otherwise line 7 stops with "Line 7: barrier touched: the spot 100 is already at or beyond the up-out barrier 95" (for a barrier of 95). The paths times the 32 looks must stay at most 4,000,000: from 130,000 paths line 7 stops with "Line 7: monte carlo: paths times steps must be at most 4000000, got 130000 x 32 = 4160000", and 0 paths stops with "Line 7: monte carlo: paths must be 1..4000000, got 0".

One path stops line 7 with "Line 7: monte carlo: the standard error needs at least 2 paths, got 1", and a seed of 0 or less stops line 7 with "Line 7: pricing.monte_carlo_steps: seed must be 1..2147483647 (0 would mean a clock-based seed), got 0".

A volatility of 0 or less stops line 1 ("Line 1: model.black_scholes: volatility must be positive") and a strike of 0 or less stops line 2 ("Line 2: option strike must be positive"). A rate of 0 or below 0 runs. More paths take longer in proportion. Very few paths give nonsense: with 2 paths the prices are 0 for most looks and 5.1101 for 2 looks, with a standard error as large as the price.

Your turn

The list path holds a price for every month, thirteen points from today. The up-and-out call has the strike strike and the barrier barrier, but the barrier is looked at only at every every-th point, starting with today's price. Every case has an every that divides the twelve months, so the last price is always a look.

The program below should return the payoff of the call in whole cents. Decide whether it does, and find the candidates that do. Check runs each candidate on the data shown and on eight others.

A line through thirteen monthly prices: 100, 103, 108, 115, 119, 123, 118, 112, 109, 111, 114, 116 and 118.
let option = instrument.barrier_call(strike, 1.0, barrier, "up-out");
let pay = option.path_payoff(path);
let answer = int(math_round(lmf.round(pay, 2) * 100.0));
{
  "answer": 0
}

path holds thirteen monthly prices, today's price first; every divides 12. An up-and-out call with the strike strike (one year) is cancelled if a price among the looks is at or above barrier. The looks are the points 0, every, 2 * every, and so on up to the last. Return the call's payoff in whole cents, the plain payoff at the last price if it was not cancelled.

Read the result carefully

The simulated prices carry a sampling error and depend on the seed. The stepped price does not converge to the closed form at a fixed number of looks: 32 looks still give 1.56 against 1.18. Which of the two fits a contract depends on its rule for observing the price, and the model's constant volatility is a further assumption.

The payoffs in Your turn are on a given list of monthly prices, not on simulated ones, so no sampling error enters. Whether a real barrier is touched depends on the contract's observation rule; this lesson does not say which one a contract has. It describes a model on made-up inputs and is not investment advice.

Recap

  • A barrier looked at only on some dates is touched less often than one watched at every instant.
  • So a knock-out is worth more the fewer looks it has, and the continuous closed form is the lowest price of the family.
  • The simulated prices carry a sampling error and change with the seed.
  • On a given path, only the looked-at points decide whether the option is cancelled.