Ejemplo n.º 1
0
        public void TestComputeAmericanCallByBinomialPricer()
        {
            var n      = 15;
            var rf     = 0.02;
            var option = new Option
            {
                Type       = OptionType.Call,
                Underlying = new Security {
                    Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01
                },
                Strike         = 110,
                TimeToMaturity = 0.25,
            };

            using (ReportTime.Start())
            {
                BinomialPricer.ComputeOption(option, rf, n);
            }
        }
Ejemplo n.º 2
0
        public static void TestComputeAmericanPutByBinomialPricer()
        {
            var n      = 15;
            var rf     = 0.02;
            var option = new Option
            {
                Type       = OptionType.Put,
                Underlying = new Security {
                    Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01
                },
                Strike         = 110,
                TimeToMaturity = 0.25,
            };

            using (ReportTime.Start())
            {
                BinomialPricer.ComputeOption(option, rf, n);
                Assert.Greater(option.FairPrice, 2.60);
                Assert.Less(option.FairPrice, 2.61);
            }
        }
Ejemplo n.º 3
0
        public static void TestComputeAmericanPutByBinomialPricer()
        {
            var n      = 15;
            var rf     = 0.02;
            var option = new Option
            {
                Type       = OptionType.Put,
                Underlying = new Security {
                    Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01
                },
                Strike         = 110,
                TimeToMaturity = 0.25,
            };

            using (ReportTime.Start())
            {
                BinomialPricer.ComputeOption(option, rf, n);
                Console.WriteLine(option.FairPrice >= 12.359);
                Console.WriteLine(option.FairPrice <= 12.360);
            }
        }