Пример #1
0
        public ActionResult Index([Bind(Include = "OptionType,StockPrice,StrikePrice,TimeToMaturity,StandardDeviationOfUnderlyingStock,Risk")] Models.OptionsPricing optionsPricingModel)
        {
            IOptionsPricingCalculator optionsPricingCalculator = new OptionsPricingCalculator();

            optionsPricingModel.Result = optionsPricingCalculator.OptionsPricing(optionsPricingModel);
            return(View(optionsPricingModel));
        }
        public void TestPut()
        {
            var optionsPricing = new OptionsPricing.Models.OptionsPricing()
            {
                OptionType     = OptionsType.Put,
                StockPrice     = 50,
                StrikePrice    = 55,
                TimeToMaturity = 1,
                StandardDeviationOfUnderlyingStock = 0.2,
                Risk = 0.09
            };
            IOptionsPricingCalculator optionsPricingCalculator = new OptionsPricingCalculator();
            var result = optionsPricingCalculator.OptionsPricing(optionsPricing);

            Assert.AreEqual(4.1279, result);
        }