public static object eqInstGetOptionGreeks( [ExcelArgument(Description = "id of option ")] string ObjectId, [ExcelArgument(Description = "Greek type ")] string gtype, [ExcelArgument(Description = "Option type (VANILLA or MULTIASSET)")] string otype, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ""; callerAddress = ExcelUtil.getActiveCellAddress(); try { Xl.Range rng = ExcelUtil.getActiveCellRange(); if (ExcelUtil.isNull(gtype)) { gtype = "NPV"; } if (ExcelUtil.isNull(otype)) { otype = "VANILLA"; } if (otype == "VANILLA") { VanillaOption option = OHRepository.Instance.getObject <VanillaOption>(ObjectId); switch (gtype.ToUpper()) { case "NPV": return(option.NPV()); case "DELTA": return(option.delta()); case "GAMMA": return(option.gamma()); case "VEGA": return(option.vega()); case "THETA": return(option.theta()); case "RHO": return(option.rho()); default: return(0); } } else if (otype == "MULTIASSET") { BasketOption option = OHRepository.Instance.getObject <BasketOption>(ObjectId); switch (gtype.ToUpper()) { case "NPV": return(option.NPV()); case "DELTA": return(option.delta()); case "GAMMA": return(option.gamma()); case "VEGA": return(option.vega()); case "THETA": return(option.theta()); case "RHO": return(option.rho()); default: return(0); } } else { return("Unknown option type"); } } catch (Exception e) { ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message); return("#EQ_ERR!"); } }