示例#1
0
        public OptionPricingViewModel(OptionPricePlotViewModel plotViewModel)
        {
            base.ViewName  = "Option Pricing Window";
            _plotViewModel = plotViewModel;

            ResultProperties = new ObservableCollection <Property>();
            ResultProperties.Add(new Property(ResultKeyConstants.Price, ""));
            ResultProperties.Add(new Property(ResultKeyConstants.Delta, ""));
            ResultProperties.Add(new Property(ResultKeyConstants.Vega, ""));

            InputProperties = new List <Property>();
            Selection     instrumentTypes     = new Selection();
            List <object> instrumentTypesList = new List <object>();

            instrumentTypesList.Add("American Option");
            instrumentTypesList.Add("European Option");
            instrumentTypes.Items        = instrumentTypesList;
            instrumentTypes.SelectedItem = instrumentTypes.Items[0];
            InputProperties.Add(new Property(InputKeyConstants.OptionType, instrumentTypes));

            Selection     methodTypes = new Selection();
            List <object> methodList  = new List <object>();

            methodList.Add("CRR Binomial Method");
            methodTypes.Items = methodList;
            InputProperties.Add(new Property(InputKeyConstants.BinomialType, methodTypes));

            InputProperties.Add(new Property(InputKeyConstants.NumberOfSteps, 10.0));
            InputProperties.Add(new Property(InputKeyConstants.InterestRate, 0.05));
            InputProperties.Add(new Property(InputKeyConstants.Volatility, 0.5));
            InputProperties.Add(new Property(InputKeyConstants.Strike, 0.5));
            InputProperties.Add(new Property(InputKeyConstants.Expiry, 1.0));
            InputProperties.Add(new Property(InputKeyConstants.CostOfCarry, 0.1));
            InputProperties.Add(new Property(InputKeyConstants.CurrentPrice, 0.5));
            InputProperties.Add(new Property(InputKeyConstants.IsCall, 1.0));

            CalculateOptionPriceCommand = new RelayCommand(param => this.CalculateOptionPrice());
        }
示例#2
0
 private void initPanels()
 {
     _topLeftUserControl     = new OptionPricePlotViewModel();
     _bottomLeftUserControl  = new OptionPricingViewModel(_topLeftUserControl as OptionPricePlotViewModel);
     _bottomRightUserControl = new StocksViewModel();
 }