I got a put option, which can be exercised 3 times, all at different times, which are each month of a year $$t_1 = \frac{1}{12}, t_2 = \frac{2}{12} ... t_{12} = 1$$. Respectively, if exercised at $$t_n$$, the owner is paid $$\max(K - S_{t_n}, 0)$$

The underlying price follows standard geometric BM $$\frac{dS_t}{S_t} = (r - q)dt + \sigma dW_t$$

$S_0 = 100, K = 100, r = 0.06, q = 0.02, \sigma = 0.02, W_t$ - standard brownian motion

  1. I need to use quadratic polynomial basis function in the regression and only regress on the in the money paths.

  2. After I estimate the continuation values, I need to run an independent simulation in order to obtain a low-biased price.

So I started with the preparation for (creation of simulations) Longstaff-Schwartz.

import numpy as np

def blackscholes_mc(S, vol, r, q, ts, npaths):
    nsteps = len(ts) - 1
    ts = np.asfarray(ts)[:, np.newaxis]
    W = np.cumsum(np.vstack((np.zeros((1, npaths), dtype=np.float),
                             np.random.randn(nsteps, npaths) * np.sqrt(np.diff(ts, axis=0)))),
    paths = np.exp(-0.5*vol**2*ts + vol*W)*S*np.exp((r-q)*ts)
    return paths

S = 100
vol = 0.2
r = 0.06
q = 0.02
K = 100
T = 1

ts = np.linspace(0, 1, 13)
paths = blackscholes_mc(S, vol, r, q, ts=ts, npaths=10000)

Now, here comes the part where I'm basically wondering whether I'm going in the right direction. Because if I go wrong, I'll waste to much time.

The implementation of LS algorithm for a standard put option I came up with (just 1 exercise, the independent simulation + polynomial regression).

payoff = np.maximum(K-paths[-1], 0)
payoff_array = [0]
for i in range(len(ts)-2, 0, -1):
    discount = np.exp(-r*(ts[i+1]-ts[i]))
    payoff = payoff*discount
    p = np.polyfit(paths[i][K-paths[i] > 0], payoff[K-paths[i] > 0], deg=2)
    contval = np.polyval(p, paths[i])
    exerval = np.maximum(K-paths[i], 0)
    ind = exerval > contval
    payoff[ind] = exerval[ind]

arr = payoff_array[::-1]

paths2 = blackscholes_mc(S, vol, r, q, ts=ts, npaths=100000)
payoff2 = np.maximum(K-paths2[-1], 0)
for i in range(len(ts)-2, 0, -1):
    discount = np.exp(-r*(ts[i+1]-ts[i]))
    payoff2 = payoff2*discount
    contval = arr[i]
    exerval = np.maximum(K-paths2[i], 0)
    ind = exerval > contval
    payoff2[ind] = exerval[ind]

This algorithm will find, for each path, the first moment when you exercise the option, take the payoff, discount it to the beginning and calculate the average of all paths' resulting payoff in the end. I regress only on the in the money paths, giving the [K-paths[i] > $0$] condition for the np.polyfit (that should suffice, right?). At each time point I save the payoff (the average of all path's payoffs, which are equal to the value of the created polynomial function at the stock price) into an array, which I construct inside the loop. I started it with zero just to have easier time working with it later. Then, I flip the array, create new, 100k simulation, where the only difference is that for my contval, which determines the policy (exercise or continue) I use the precalculated payoffs from previous simulation. As a result I end up doing the same thing as in the first simulation, i.e arrive going backwards to the start, find a stopping time (first exercise) for each path, discount each payoff to the present and, after taking average, return as a resulting payoff.

Now, for 3 exercises though, which can't happen during the same months, I have an idea to create an array for reach path, fill it up with the non-zero payoffs during the second simulation and then in the end take out 3 last values (i.e 3 first values, since this is backwards algorithm) and then discount them properly followed by summing them up. And then I'd do that for all paths and calculate the average. Would that be correct way to asses the value of such option or am I doing something wrong/misunderstanding?

I'd appreciate some input. Thank you in advance

  • $\begingroup$ Hello one more time. Did you read the actual paper from longstaff schwartz ? $\endgroup$ – Ezy Feb 23 at 1:34
  • $\begingroup$ Hello, not sure what do you mean by "one more time". I did read plenty of papers about it, but alas. Although I did make progress in the question, I've not arrived to the solution yet $\endgroup$ – Makina Feb 23 at 2:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.