Speeding Up Monte Carlo Pricing of Exotic Options
Summary
The document presents a slow nested-loop implementation for pricing European calls, Asian options, digital calls, and up-and-in barrier calls under the Merton jump-diffusion model. It motivates the problem as a comparison with the exponential variance-gamma model and asks how to avoid loops. The responses recommend generating random draws in batches with array operations, considering quasi-Monte Carlo sequences, or implementing simulation in a compiled language.
The answers provide general performance suggestions rather than a corrected vectorized algorithm or a detailed implementation. One response cautions that the example's simulation count may be too small for dependable prices, but gives no error analysis or convergence evidence. The code itself uses simulated paths to estimate discounted payoffs; the discussion does not address variance reduction, confidence intervals, or validation against benchmark prices, so readers would need further work to assess accuracy as well as speed.
Key ideas
- The example prices call, Asian, digital, and up-and-in barrier payoffs from simulated Merton-model paths.
- Nested loops over paths and time steps are identified as a source of slow computation.
- Batch generation of random draws and array operations are suggested to improve speed.
- Quasi-Monte Carlo and compiled implementations are proposed as alternatives.
- The responses caution about simulation accuracy but provide no convergence analysis or validated implementation.
Tags
Full text
# Pricing Exotics: Monte-Carlo is too slow?
# Pricing Exotics: Monte-Carlo is too slow?
I want to price exotic options under the exponential VG model and Merton's model to compare both models.
To price exotics under Merton's model, I have written the code below. The output is the price of a Call option, Asian, Digital and Up and in Barrier Call option. However, the use of loops leads to a very slow computation. Is there a clever way to not use loops here? In case of the VG model, I can do it but in this case, I do not see it.
```
function [Call,Asian,Digital,UIBP] = ExoticPricingMerton(S0,K,mu,delta,lambda,sigma,r,q,Maturity,H)
ht = 1/252; %trading days
P = 10^3; %Number of simulations
grid = (0:ht:Maturity);
N = length(grid);
omega = r-q-((1/2)*sigma^2+lambda*(exp(mu+(1/2)*delta^2)-1));
S = zeros(P,N);
S(:,1) = S0;
for i=1:P
for j=2:length(grid)
N = poissrnd(lambda*ht);
J = cumsum([0, normrnd(mu,delta,1,N)]);
Z = normrnd(0,1);
S(i,j) = S(i,j-1)*exp(omega*ht + sigma*sqrt(ht)*Z + J(end));
end
end
%European Call option
A = max(S(:,end)-K,0);
Call = exp(-r*Maturity)*(1/P)*sum(A);
%Asian option
A = max(mean(S,2) - K,0);
Asian = exp(-r*Maturity)*(1/P)*sum(A);
%Digital price
A = max(S(:,end) - K, 0)./(S(:,end)-K);
Digital = exp(-r*Maturity)*(1/P)*sum(A);
%Up-and-in out Barrier
A1 = (max(S,[],2)-H)./abs(max(S,[],2)-H);
A2 = max(A1,0);
A = (max(S(:,end)-K,0)).*A2;
UIBP = exp(-r*Maturity)*(1/P)*sum(A);
end
```
Thanks!
## Answer by quant_dev (score 3)
https://quant.stackexchange.com/a/31726
You're using a wrong tool for the job. Write your Monte Carlo in a faster language (Java would probably suffice, if not than C++ which is standard for such things). Then you will be able to efficiently generate more than 1000 paths. In fact, doing Monte Carlo derivatives pricing with 1000 paths is worthless. Your results are, most probably, very inaccurate. Read a good book on Monte Carlo pricing before venturing further and wasting your time.
## Answer by Woraphon T (score 1)
https://quant.stackexchange.com/a/31723
I assume you are using MatLab.
You may consider pre-generating all 1,000 random numbers once before for-loop by exploiting array coding.
Another approach, have you ever tried using Quasi Monte Carlo?
Generating Quasi-Random Numbers
QMC ensures faster convergence and MatLab has functions that can generate quasi-random sequence very fast (a billion under a second).Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.