public static void RunBSOptTest(Boolean CP, double fwdPrice, double strike, double vol, double r, double t) { var result = (object[, ])BlackScholesMertonModel.Greeks(CP, fwdPrice, strike, vol, t); Debug.WriteLine(String.Format("Premium : {0} Delta : {1} Gamma : {2} Vega : {3} Theta : {4} Rho : {5}", result[0, 0], result[0, 1], result[0, 2], result[0, 3], result[0, 4], result[0, 5])); Debug.WriteLine(String.Format("Premium : {0} Delta : {1} Gamma : {2} Vega : {3} Theta : {4} Rho : {5}", result[1, 0], result[1, 1], result[1, 2], result[1, 3], result[1, 4], result[1, 5])); }
/// <summary> /// Standard (Black-Scholes) option valuation /// r = Continuously compounded interest rate between now and time t. /// Discount factor is exp(-r * t). /// </summary> /// <param name="callFlag">The call/put flag.</param> /// <param name="fwdPrice">Price fixed today for purchase of asset at time t</param> /// <param name="strike">Exercise price of option</param> /// <param name="vol">Per cent volatility in units of (year)^(-1/2)</param> /// <param name="t">Time in years to the maturity of the option.</param> /// <returns>An array of results for Black Scholes.</returns> public object Greeks(bool callFlag, double fwdPrice, double strike, double vol, double t) { var model = BlackScholesMertonModel.Greeks(callFlag, fwdPrice, strike, vol, t); return(model); }