Beispiel #1
0
    static void TestMonteCarloBSAsian(double sigma, double S, double K, double r)
    {
        int N = 100000;
        BlackScholesMonteCarlo mc = new BlackScholesMonteCarlo(sigma, r, N);

        double[] monitorDates = new double[] { 0.25, 0.5, 1 };
        double   exerciseT    = 1;

        Console.WriteLine("Asian: {0}", mc.CalculateAsianCallOptionPrice(S, K, monitorDates, exerciseT));
    }
Beispiel #2
0
    public double CalcAvgMonteCaroError(int nForAverage, int N)
    {
        double callOptionPriceBS = BlackScholesFormula.CalculateCallOptionPrice(sigma, S, K, r, T);
        double avgErr            = 0;

        for (int i = 0; i < nForAverage; ++i)
        {
            BlackScholesMonteCarlo mc = new BlackScholesMonteCarlo(sigma, r, N);
            double mcPrice            = mc.CalculateEuropeanCallOptionPrice(S, K, T);
            avgErr += Math.Abs(mcPrice - callOptionPriceBS);
        }
        return(avgErr / nForAverage);
    }