Speed

Knocked Out, Knocked In

A barrier option's payoff depends on the whole price path: a knock-out pays the plain payoff unless the path ever touched the barrier, a knock-in pays it only if the path did.

The question

A plain call pays the last price minus the strike, if that is positive. A barrier call adds a level, the barrier. A knock-out call is cancelled if the price ever reaches the barrier; a knock-in call exists only if it does. The last price alone no longer decides the payoff. What does, and which payoff does each kind give on one price path?

This lesson works on a made-up path of six prices and asks the engine for the payoffs. The path and the numbers are assumptions of the lesson, not data about any market.

Work it by hand

Take the path 100, 104, 111, 122, 117, 109, a strike of 100 and an upper barrier of 120. A barrier above the start is an up barrier; the price touches it when a point is at or above it. Here 122 is above 120, so the path touched the barrier on its fourth point.

The plain call pays the last price minus the strike: 109 - 100 = 9. The up-and-out call was cancelled when the path touched 120, so it pays 0. The up-and-in call came into existence at that moment and pays what the plain call pays, 9. Exactly one of the two pays the plain payoff, which is the subject of the next lesson.

Move the barrier to 125 and the path never touches it: the knock-out pays 9 and the knock-in pays 0. At exactly 122 the path touches it, and the knock-out pays 0.

Run it

Lines 1 to 3 build three options with a one-year life and the given strike: the up-and-out call and the up-and-in call at the barrier barrier, and a plain call. Lines 4 and 5 ask the engine for the payoff of each barrier option along the whole path, rounded to cents with lmf.round, because the computer stores decimals in binary.

Lines 6 to 14 return the picture: the path and the barrier as a flat line. Line 15 returns the plain payoff, which the picture does not draw. Line 16 returns the two payoffs as text.

A line through six prices: 100, 104, 111, 122, 117 and 109, rising above a flat line at the barrier 120 at the fourth point and falling below it again. The program returns the text out 0.00, in 9.00.
let up_out = instrument.barrier_call(strike, 1.0, barrier, "up-out");
let up_in = instrument.barrier_call(strike, 1.0, barrier, "up-in");
let plain = instrument.european_call(strike, 1.0);
let out = lmf.round(up_out.path_payoff(path), 2);
let inn = lmf.round(up_in.path_payoff(path), 2);
let step = float_list();
let line = float_list();
for (i in range(0, path.len())) {
  step.add(float(i));
  line.add(barrier);
}
lmcode_return_put("step", step);
lmcode_return_put("path", path);
lmcode_return_put("barrier", line);
lmcode_return_put("plain", lmf.money(plain.path_payoff(path)));
let answer = "out " + lmf.money(out) + ", in " + lmf.money(inn);
{
  "answer": "out 0.00, in 9.00",
  "step": [
    0,
    1,
    2,
    3,
    4,
    5
  ],
  "path": [
    100,
    104,
    111,
    122,
    117,
    109
  ],
  "barrier": [
    120,
    120,
    120,
    120,
    120,
    120
  ],
  "plain": "9.00"
}

You can change the path, the strike and the barrier. The strike and the barrier must be positive: a strike or a barrier of 0 or less stops line 1 with "Line 1: option strike must be positive" or "Line 1: barrier must be positive". Every price of the path must be positive: a price of 0 stops line 4 with "Line 4: Option.path_payoff: prices must be positive, got 0 at index 1". A path of one price is allowed; it is its own last price.

A barrier at or below the first price has been touched at once, so the knock-out pays 0. The type up-out or up-in is fixed in lines 1 and 2; another word there stops that line with "Line 1: barrier type must be up-in, up-out, down-in or down-out".

Your turn

The list path holds a price path, today's price first. The program below should return the payoff, in whole cents, of a down-and-out put with strike strike and barrier barrier, a put that is cancelled when a price is at or below the barrier. 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 six prices, 100, 94, 91, 97, 102 and 108.
let option = instrument.european_put(strike, 1.0);
let last = path.at(path.len() - 1);
let answer = 0;
if (last > barrier) {
  answer = int(math_round(lmf.round(option.payoff(last), 2) * 100.0));
}
{
  "answer": 200
}

path is a price path, today's price first, one-year life, all prices positive. A down-and-out put with strike strike and barrier barrier pays max(strike - last price, 0) at expiry unless some price of the path, the first included, is at or below barrier, and then it pays nothing. Return the payoff in whole cents.

Read the result carefully

The path has six points. Whether a real barrier is touched depends on how the contract says that the price is watched: on every trade, on a daily close, at one time a day. This lesson looks at every point of the list, and says nothing about how often a real contract would. The next lessons come back to it.

No rebate is paid when the option is cancelled in this model, and the payoff is not discounted: it is the amount at expiry on this one path. The path is made up. A single path says what the option would have paid on that path, not what it is worth. It describes a model on made-up inputs and is not investment advice.

Recap

  • A barrier option's payoff depends on the path.
  • A knock-out pays the plain payoff unless the path touched the barrier; a knock-in pays it only if it did.
  • Touching means at or beyond the barrier, the first point included.
  • This lesson's payoffs are for one made-up path and are not discounted.