期權定價
跳躍擴散模型中障礙期權的估值
我正在嘗試使用蒙特卡羅方法評估障礙期權的價值。股票遵循跳躍擴散模型。我正在使用Metwally 和 Atiya中描述的方法。作者描述了這些步驟,因此在 matlab 中編寫算法應該很容易。我已經在 matlab 中實現了第一個算法,如本文所述,但我的結果與作者的結果不同。例如,我下面的程式碼給出了 5.1,但根據作者的結果,它應該是 9.013。
我遇到的另一個問題是機率 $ P_i $ 在模擬過程中有時為負數或大於 1。論文中的公式可能是錯誤的嗎?如何編碼以避免這種情況。我已經使用它,因為它是在紙上。
clc clear all t = cputime; %%%%%%%%%%%%%%%%%%% Parameters %%%%%%%%%%%%%%%% S0 = 100.0; X = 110.0; H = 85.0; R = 1.0; r = 0.05; sigma = 0.25; T = 1.0; %%%%%%%%%%%%%%%% Jump Parameters %%%%%%%%%%%%%% lam = 2.0; muA = 0.0; sigmaA = 0.1; %%%%%%%%%%%%%%% calculated parameters %%%%%%%%%% k = exp(muA+0.5*sigmaA*sigmaA)-1; c = r-0.5*sigma^2-lam*k; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% N = 1e5; % Monte carlo runs DP = zeros(N,1); for n = 1:N I = 1; jumpTimes = 0:exprnd(lam):T; %interjump times Exp(lam) K = size(jumpTimes,2)-1; jumpTimes(end+1) = T; x = log(S0); for i = 1:K+1 tau = jumpTimes(i+1)-jumpTimes(i); xbefore = x + c*tau + sigma*sqrt(tau)*randn(); p = 1.0-exp(-2.0*(log(H)-x)*(log(H)-xbefore)/(tau*sigma^2)); p = p*(xbefore > log(H)); b = (jumpTimes(i+1)-jumpTimes(i))/(1.0-p); s = jumpTimes(i)+b*rand(); if s <= jumpTimes(i+1) && s >= jumpTimes(i) gamma = exp(-(x-xbefore+c*tau)^2/(2*sigma^2*tau))/(sigma*sqrt(2*pi*tau)); g = (x-log(H))/(2*gamma*pi*sigma^2)*(s-jumpTimes(i))^(-1.5)*(jumpTimes(i+1)-s)^(-0.5)*... exp(-((xbefore-log(H)-c*(jumpTimes(i+1)-s))^2/(2*(jumpTimes(i+1)-s)*sigma^2)+... (x-log(H)+c*(s-jumpTimes(i)))^2/(2*(s-jumpTimes(i))*sigma^2))); DP(n)= R*b*g*exp(-r*s); I = 0; break end A = muA + sigmaA*randn(); xafter = xbefore + A; if xafter <= log(H) DP(n) = R*exp(-r*jumpTimes(i+1)); I = 0; break end x = xafter; end if I==1 % no crossing happened DP(n) = exp(-r*T)*max(exp(xbefore) - X, 0.0); end end DOC = mean(DP) e = (cputime-t)/60;
錯誤是,您最後沒有儲存相同路徑的隨機數:
xbefore = x + c*tau + sigma*sqrt(tau)*randn() A = muA + sigmaA*randn(); xafter = xbefore + A;
但最後你通過創建一個新的隨機數在這裡設置不同的路徑:
xT = log(S0)+(c+muA*lambda)*T+sqrt((sigma^2+(muA^2+sigmaA^2)*lambda)*T)*randn();
randn()每次都會生成一個新的隨機變數,因此您需要儲存特定路徑以確保它在xT處採用相同的路徑,而不是通過對xT使用另一個***randn()**來採用新路徑。
例如使用另一個虛擬變數:
rand = randn();
在每個循環中使用相同的數字,並且
path = path+randn();
最後儲存xT的總路徑。
您的程式碼有一個錯誤,它通過 exprnd(lam) 選擇一個隨機跳轉時間,然後生成一個跳轉時間向量,跳轉以相同的間隔重複。它應該為每次跳躍選擇一個新的隨機時間。