蒙特卡羅
我需要多少次蒙地卡羅執行來為通話定價?
我必須使用 Monte Carlo 對幾個電話進行定價。顯然,在執行次數和看漲期權的公平價格之間存在巨大的權衡。我知道我可以檢查近似值如何改變我減少了模擬的數量,但我想知道是否有一個大概值。
目前我正在執行 1000 次模擬。但也許500就足夠了?
它真的,真的,真的取決於你的參數,即 $ r $ , $ \sigma $ , $ K $ , $ T $ , $ S_0 $ . 例如,以下是實施我在此處回答中解釋的停止標準的一些結果。這些是迭代次數,以使 MC 呼叫價格與確切呼叫價格相差小於 0.01(例如一美分)的機率約為 0.95:
$ r = 0.02 $ , $ \sigma = 0.2 $ , $ K = 10 $ , $ T = 1 $ , $ S_0 = 10 $ : 72,382 次迭代
$ r = 0.02 $ , $ \sigma = 0.2 $ , $ K = 10 $ , $ T = 10 $ , $ S_0 = 10 $ : 1,391,379 次迭代
$ r = 0.02 $ , $ \sigma = 0.5 $ , $ K = 10 $ , $ T = 1 $ , $ S_0 = 10 $ : 625,365 次迭代
這是我的停止標準的 MATLAB 實現,如果您想自己嘗試:
%%% Estimates the price of a European call option using MC. % Continues MC estimation until we reach a 0.05 probability that % MC call price differs by more than "tol" units from exact % call price. function C = CallPricePointEstimate() %%% BS parameters - Try varying these to see how number of iters (n) % changes %%% K = 10; S = 10; r = 0.02; T = 1; sigma = 0.5; %%% MC parameters %%% % number of stock prices to generate, may need more, which are % generated in the MC loop below if idx > N_MC N_MC = 1000000; tol = 0.01; % price within $tol bound = 5; % something larger than tol n = 1; % current iteration number %%% generate normal RVs and price paths %%% Z = normrnd((r-sigma^2/2)*T, sigma*sqrt(T), N_MC, 1); ST = S*exp(Z); %%% init MC accumulators %%% sampleMean = 0; sampleVar = 0; oldMean = 0; idx = 1; % will reset to 1 if idx > N_MC %%% MC loop %%% while ((bound > tol) || (n < 30)) % if idx > N_MC, need to generate more normals if (idx > N_MC) Z = normrnd((r-sigma^2/2)*T, sigma*sqrt(T), N_MC, 1); ST = S*exp(Z); idx = 1; end payoff = exp(-r*T)*max((ST(idx) - K),0); % update mean and var sampleMean = oldMean + (payoff - oldMean)/n; if (n>1) sampleVar = (1-(1/(n-1)))*sampleVar + n*(sampleMean - oldMean)^2; end oldMean = sampleMean; bound = 1.96*sqrt(sampleVar/n); %%% updated this line %%% n = n+1; idx = idx+1; end %%% Display num samples, statistics and vfy bound = tol %%% n sampleMean; sampleVar; bound; C = sampleMean; % call price %%% exact BS price using BS formula %%% d1 = 1/(sigma*sqrt(T)) * (log(S/K) + (r + sigma^2/2)*T); d2 = d1 - sigma*sqrt(T); exact = S*normcdf(d1) - K*exp(-r*T)*normcdf(d2)
**更新:**我意識到我的程式碼中有一個錯誤:
bound
更新的地方sampleVar/sqrt(n)
應該是sqrt(sampleVar/n)
. 這導致給定參數的更快收斂。所需的迭代次數已更新。