Beispiel #1
0
        /// <summary>
        /// Execute the command
        /// </summary>
        /// <param name="parameter">the parameter</param>
        public override void Execute(object parameter)
        {
            _viewModel.ClearResults();

            try
            {
                var result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(
                                                       _viewModel.StockPrice,
                                                       _viewModel.StrikePrice,
                                                       _viewModel.StandardDeviation / 100M,
                                                       _viewModel.RiskInterest / 100M,
                                                       _viewModel.Time
                                                       ));

                _viewModel.D1         = result.D1.ToRound(_viewModel.Precision);
                _viewModel.D2         = result.D2.ToRound(_viewModel.Precision);
                _viewModel.CallOption = result.CallOption.ToRound(_viewModel.Precision);
                _viewModel.PutOption  = result.PutOption.ToRound(_viewModel.Precision);
            }
            catch (Exception ex)
            {
                AlertBox.ShowError(ex);
            }
        }
Beispiel #2
0
        public void Initialize()
        {
            _calculator = new BlackScholesCalculator();

            _result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(45, 23, 0.10M, 0.15M, 123M));
        }
Beispiel #3
0
        public void Initialize()
        {
            _calculator = new BlackScholesCalculator();

            _result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(50, 55, 0.2M, 0.09M, 365M));
        }
        public void Initialize()
        {
            _calculator = new BlackScholesCalculator();

            _result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(56, 32, 0.74M, 0.02M, 99M));
        }
        public void Initialize()
        {
            _calculator = new BlackScholesCalculator();

            _result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(64, 60, 0.27M, 0.045M, 180M));
        }
Beispiel #6
0
        public void Initialize()
        {
            _calculator = new BlackScholesCalculator();

            _result = _calculator.Calculate(BlackScholesCalculatorPricingData.NewPricingData(28, 30, 0.37M, 0.15M, 251M));
        }
Beispiel #7
0
 public void AssertNullArgumentException()
 {
     Assert.ThrowsException <ArgumentNullException>(() => _calculator.Calculate(null));
 }
 public void Should_ThrowException_When_NullArgs()
 {
     Assert.ThrowsException <ArgumentNullException>(() => _calculator.Calculate(null));
 }