6. Intuition Behind the Longstaff-Schwartz Implementation#
This sections draws significant inspiration from the excellent educational materials by quantgirluk - Understanding Quantitative Finance, whose clear exposition of the Longstaff-Schwartz algorithm provided valuable implementation insights and visualization approaches.
6.1. Geometric Brownian Motion#
We will assume that the dynamics of the prices of the underlying asset follows GBM. That is to say, that the Itô process \(\{X_t\}_{t\in\mathbb{N}}\) satisfies the following stochastic differential equation (SDE)
with \(X_0 = x_0 > 0\), where \(W_t\) denotes a standard Brownian motion, and \(r, \sigma\) are known parameters.
6.2. Parameters#
\(r = 2\%\),
\(\sigma = 15\%\),
\(x_0 = 1.0\),
Maturity \(T=6\) (6 months),
\(N=50\) - simulating \(50\) paths on the grid,
\(n=120\) - simulating \(120\) time-steps (points) [20 days per month].
6.3. American Option Contracts#
\(S_0 = 1.0\) Initial stock price
We consider American put contract as a writer/seller.
The holder/buyer has the right to exercise the option at any time between today (time \(t_0 = 0\)) and maturity \(t_n = T = 6\).
If the holder decides to exercise at time \(t_i\), this means that he will sell the asset (whose market price os \(X_{t_i}\) at time \(t = t_i\)) at price \(K= 1.1\) to us (writer).
Why put? Assuming no dividends are being paid, only for the put option it is sometimes optimal to exercise earlier.
Why? Suppose we have an American call at time \(t < T\) with the payoff \([X_t - K]^+\).
Alternative strategy: the option holder may short the underlying asset (which gives the payoff \(S_t\)), and purchase the asset by the most favourable of
exercise the American call at maturity, and
buying at the market price at time \(T\).
With the alternative strategy the holder has gained amount \(S_t\) at time \(t\) and paid out an amount \(\leq K\) at time \(T\). This is clearly, better than gaining the different \(X_t - K\) at time \(t\).
Hence. it is never optimal to exercise an American call option before the expiry date.
American call option must have the same value as a European call option, i.e. \(C^{AM} = C^{EU}\).
For a put option, early exercise can be optimal, because:
We can receive \([K - X_t]\) earlier and invest it,
If the option is deep in the money (i.e., \(S_t \ll K\)) and interest rates are positive, early exercise may dominate holding,
Hence: \(P^{AM} \geq P^{EU}\), and strict inequality is possible
K = 1.1
6.4. Discretisation of the domain#
If \(S_{t_i} \geq K\), then the holder has no incentive to exercise the option (i.e. selling the asset at price \(K\) makes no sense!)
If \(S_{t_i} < K\), then the option is In-The-Money (ITM) and rhe holder may want to exercise it. The payoff in case of exercise at time \(t_i\) would be \(Y(t_i) = [K- S_{t_i}]^+\)
Let us visualise the times when the simulated paths have a positive payoff.
Next, we define the payoff function, recall \([K- S_t]^+ = \max\{(K-S_t, 0)\}\).
So, at every time \(t_i\), the holder has the right to exercise the option to obtain the payoff, $\( \textrm{Exercise Value} = Y(t_i) = [K - S_{t_i}]^+. \)$
Now, the problem is that we do not know if its better to exercise or hold (continue to $t_{i+1}). For this we need to estimate continuation value, that is we need to look one step into the and compare (immediate) exercise value vs. continuation value.
So, how do we estimate continuation value? $\( \textrm{Continuation Value} = C(t_i) = \, \textrm{?} \)$
6.5. To exercise or not to exercise - Longstaff-Schwartz Algorithm#
Why is the Monte Carlo computationally infeasible?
For a fixed \(\omega\)-path, at each node, we need to decide whether to exercise the option or not, whereas the continuation value is not known without either embedding another MC simulation at each node of each time lattice or a prior exercise strategy, since $\( C(x, t_{n-1}) = e^{-r\Delta t}\mathbb{E}[V(X_{t_n}, t_n) \mid X_{t_{n-1}} = x] \)\( \)\( V(x, t_{n-1}) = \max\{ \Lambda(x, t_{n-1}, \, C(x, t_{n-1}) \} \)$
In order to estimate continuation value, we follow the approach by Longstaff-Schwartz.
The demonstration by Dr D. Santiago’s book provides great intuition.
First, lets plot the discounted cashflows.
cashflow = np.exp(-r * (times[-2] - times[-1])) * exercise_value(X[-1, :])
x = X[-2, :]
plt.figure()
plt.plot(x, cashflow, "o", label="Discounted Cashflow")
plt.ylabel("$V(t_{n-1}, t_n)$")
plt.xlabel("Underlying Asset Price $X(t_{n-1})$")
plt.title("At time $t_{n-1}$ we want to approximate the \nContinuation values $C(t_{n-1})$")
plt.legend()
plt.show()
Second, in order to estimate the continuation value (or, the conditional expectation), the Longstaff-Schwartz implementation makes use of least-squares method to fit a polynomial function to the pairs
and then using such polynomials to approximate the continuation value as
So the question is, what if we could do approximation with simple functions (basis functions) multiplied with some weights?
So, we need to make two choices: 1 Polynomial functions e.g. Laguerre (used in paper), Hermite, Chebyshev, Jacobiused as basis functions. 2 Degree of the Polynomial.
6.5.1. Laguerre Polynomials (paper)#
Where the associated least-sqaures equation takes the following form:
fitted_laguerre
Now, we focus on only ITM points, i.e. the paths which ended up with non-zero payoff.
6.5.2. Iterating Backwards in Time#
Starting at expiry (terminal node) \(T = t_n\)
At expiry \(T\), the payoff is known: \(U(t_n) = Y(t_n) = [K- S_{t_n}]^+\).
At time \(t_{n-1}\), we need to decide if to exercise or not to exercise, based on: $\( U(t_{n-1}) = \max\{ Y(t_{n-1}, \, C(t_{n-1}) \} \)$
where \(C(t_{n-1}) \} = e^{-r (t_n - t_{n-1})}\mathbb{E}[U(t_n) \mid \mathcal{F}_{n-1}] \) and \( Y(t_{n-1}) = [K- S_{t_{n-1}}]^+ \).
Notice that if the holder does not exercise, then the option behaves likes an European (the exercise decision has to be made in the next step and there is no early exit choice, so exercise at expiry) over the period \( [t_n, t_{n-1}]\). Thus, we can discount the value \(U(t_n)\) and hence obtaining $\( \textrm{Discounted Cashflow} = V(t_{n-1}, t_n) = e^{-r(t_n - t_{n-1})} [K-S_{t_n}]^+.\)$
What did we learn?
Now, let us go path by path and see if it will be optimal to exercise early.
for idx, path in enumerate(paths[:5]):
stop = first_exercise_idx[idx]
(handle_path_before,) = plt.plot(times[:stop], path[:stop], color="lightgreen")
(handle_path_stop,) = plt.plot(times[stop-1:], path[stop-1:], ':', color="lightgrey")
if stop < len(times):
(handle_path_after,) = plt.plot(times[stop-1], path[stop-1], 'r.', zorder=3)
strike_line = plt.axhline(y=K, linestyle=':', color="black")
plt.xlabel("Time $t$")
plt.ylabel("$X_t$")
plt.title("Simulated Paths - Continue until Exericise is Optimal")
plt.legend([handle_path_before, handle_path_after, handle_path_stop, strike_line],
["Path before Exercise", "First time Exercise Optimal", "Path after Exercise", "Strike $K$"])
plt.show()