public static double GeometricAsianOptionPricing(GeometricAsianOptionProb prob) { double s = prob.SpotPrice; double k = prob.StrikePrice; double r = prob.InterestRate; double t = prob.Maturity; double sigma = prob.Volatility; int n = prob.ObservationTime; OptionTypeEnum optionType = prob.OptionType; return(getGeoAsianOptionPrice(s, k, r, t, sigma, n, optionType)); }
private void DoCalculation() { IsCalculateEnabled = false; RaisePropertyChanged("IsCalculateEnabled"); ErrorCode errcode = FirstValidation(); if (errcode != ErrorCode.OK) { Result = Utility.getErrorMsg(errcode); } else { var prob = new GeometricAsianOptionProb( _spotPrice, _volatility, _interestRate, _maturity, _strikePrice, _observationTime, _optionType ); errcode = prob.validate(); if (errcode != ErrorCode.OK) { Result = Utility.getErrorMsg(errcode); } else { Result = Math.Round(prob.calculate(), 4).ToString(); } } RaisePropertyChanged("Result"); IsCalculateEnabled = true; RaisePropertyChanged("IsCalculateEnabled"); }