private double OptionValueWrapper(DateTime ValuationDate) { //unpack the dividends into the required format and pass to COM dll OptionValue32_CS.Pricer Pricer = new OptionValue32_CS.Pricer(); return(Pricer.OptionValue( Strike, UnderlyingPrice, UnderlyingVolatility, YearsToMaturity(ValuationDate), Rate, (short)Type, (short)Style, DividendString(ValuationDate))); }
static void Test() { OptionValue32_CS.Pricer pricer = new OptionValue32_CS.Pricer(); double ret; double strikePrice, underlyingPrice, underlyingVol, yearsToMaturity, riskFreeRate; short optionType, optionStyle; string dividends; strikePrice = 0.99; underlyingPrice = 0.9; underlyingVol = 0.1; yearsToMaturity = 0.25; riskFreeRate = 0.04; optionType = 0; optionStyle = 0; dividends = "0.15/0.03"; ret = pricer.OptionValue(strikePrice, underlyingPrice, underlyingVol, yearsToMaturity, riskFreeRate, optionType, optionStyle, dividends); MessageBox.Show("Result of test was " + ret.ToString()); }