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); } }
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); } }
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); } }