public static double FormulaBlack([ExcelArgument(Description = "put or call.")] PutOrCall putOrCall, [ExcelArgument(Description = "The strike")] double strike, [ExcelArgument(Description = "The time to maturity in years from the value date to the exercise date.")] double timeToExercise, [ExcelArgument(Description = "The forward at the option exercise date.")] double forward, [ExcelArgument(Description = "Annualized volatility.")] double vol, [ExcelArgument(Description = "The discount factor from the value date to the settlement date of the option.")] double discountFactor) { return(BlackEtc.Black(putOrCall, strike, timeToExercise, forward, vol, discountFactor)); }
public static ResultStore BlackOption(JSEBondOption bondoption, double strike, double vol, double repo, JSEBondForward bond, double yieldToMaturity) { var settleDate = bondoption.settleDate; var timeToMaturity = bondoption.timeToMaturity; var ytm = yieldToMaturity; var bondforwardprice1 = (double)bond.ForwardPrice(settleDate, ytm, repo).GetScalar(JSEBondForwardEx.Keys.ForwardPrice); var discountFactor = Math.Exp(-repo * timeToMaturity); var optionPrice = BlackEtc.Black(PutOrCall.Call, strike, timeToMaturity, bondforwardprice1, vol, discountFactor); var resultStore = new ResultStore(); resultStore.Add(Keys.BlackOption, optionPrice); return(resultStore); }