Ejemplo n.º 1
0
        public static double[] simulateHist(int steps, double initialPrice, int seed, IDescretized bm)
        {
            Random r = new Random();
            double[] result = new double[steps];
            RandomGen randomNorm = new RandomGen(seed);

            result[0] = initialPrice;
            for (int i = 1; i < steps; ++i)
            {
                result[i] = bm.NextPrice(result[i - 1], randomNorm.NextDouble(bm.mean, bm.sigma));
            }
            return result;
        }
Ejemplo n.º 2
0
        public static double simulate(int steps, double initialPrice, int seed, IDescretized bm)
        {
            double result = initialPrice;
            RandomGen randomNorm = new RandomGen(seed);

            for (int i = 0; i < steps; ++i)
            {
                result = bm.NextPrice(result, randomNorm.NextDouble(bm.mean, bm.sigma));
            }

            return result;
        }