蒙地卡羅

我的monte carlo pricer的分歧問題…

  • June 20, 2011

我正在嘗試使用 Monte Carlo 實現一個普通的歐洲期權定價器,並將其結果與 BS 分析公式的結果進行比較。

我注意到隨著模擬次數的增加(從 100 萬到 1000 萬),MC 結果開始出現差異

請注意,我故意只使用一種變異數減少技術:對立變數。我希望僅僅通過增加模擬次數,我就能設法提高精度。

誰能給我一些線索或指示,說明為什麼我的結果會出現差異?

下麵包含的是定價器的 C# 程式碼:

using System;
using System.Threading.Tasks;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.Random;

namespace MonteCarlo
{
   class VanillaEuropeanCallMonteCarlo
   {
       static void Main(string[] args)
       {
           const int NUM_SIMULATIONS = 10000000;
           const decimal strike = 50m;
           const decimal initialStockPrice = 52m;
           const decimal volatility = 0.2m;
           const decimal riskFreeRate = 0.05m;
           const decimal maturity = 0.5m;
           Normal n = new Normal();
           n.RandomSource = new MersenneTwister();


           VanillaEuropeanCallMonteCarlo vanillaCallMonteCarlo = new VanillaEuropeanCallMonteCarlo();

           Task<decimal>[] simulations = new Task<decimal>[NUM_SIMULATIONS];

           for (int i = 0; i < simulations.Length; i++)
           {
               simulations[i] = new Task<decimal>(() => vanillaCallMonteCarlo.RunMonteCarloSimulation(strike, initialStockPrice, volatility, riskFreeRate, maturity, n));
               simulations[i].Start();
           }

           Task.WaitAll(simulations);

           decimal total = 0m;

           for (int i = 0; i < simulations.Length; i++)
           {
               total += simulations[i].Result;
           }

           decimal callPrice = (decimal)(Math.Exp((double)(-riskFreeRate * maturity)) * (double)total / (NUM_SIMULATIONS * 2));

           Console.WriteLine("Call Price: " + callPrice);
           Console.WriteLine("Difference: " + Math.Abs(callPrice - 4.744741008m));
       }


       decimal RunMonteCarloSimulation(decimal strike, decimal initialStockPrice, decimal volatility, decimal riskFreeRate, decimal maturity, Normal n)
       {
           decimal randGaussian = (decimal)n.Sample();
           decimal endStockPriceA = initialStockPrice * (decimal)Math.Exp((double)((riskFreeRate - (decimal)(0.5 * Math.Pow((double)volatility, 2))) * maturity + volatility * (decimal)Math.Sqrt((double)maturity) * randGaussian));
           decimal endStockPriceB = initialStockPrice * (decimal)Math.Exp((double)((riskFreeRate - (decimal)(0.5 * Math.Pow((double)volatility, 2))) * maturity + volatility * (decimal)Math.Sqrt((double)maturity) * (-randGaussian)));
           decimal sumPayoffs = (decimal)(Math.Max(0, endStockPriceA - strike) + Math.Max(0, endStockPriceB - strike));
           return sumPayoffs;
       }
   }
}

這與您之前的問題本質上是相同的問題,並且問題仍然相同:可變性不會僅僅因為您使用 1 億次抽獎而消失。比較結果的分佈 $ N $ 蒙地卡羅模擬 $ n_1 = 1,000,000 $ 與那些 $ n_2 = 10,000,000 $ . 您會看到減少,但這並不意味著每次執行都會得到更嚴格的答案。

引用自:https://quant.stackexchange.com/questions/1326