public string CreateCalendar(Excel.Range propertiesRange, Excel.Range dateArray) { var properties = propertiesRange.Value[System.Reflection.Missing.Value] as object[, ]; properties = (object[, ])DataRangeHelper.TrimNulls(properties); var namedValueSet = properties.ToNamedValueSet(); var dates = DataRangeHelper.StripDateTimeRange(dateArray); var identifier = namedValueSet.GetValue <string>("UniqueIdentifier", true); var calendar = BusinessCalendarHelper.CreateCalendar(namedValueSet, dates); Engine.Cache.SaveObject(calendar, NameSpace + "." + identifier, namedValueSet); Engine.Logger.LogDebug("Loaded business center holiday dates: {0}", identifier); return(identifier); }
/// <summary> /// /// </summary> /// <param name="underlying"></param> /// <param name="spot"></param> /// <param name="callStrike"></param> /// <param name="style"></param> /// <param name="tradeDate"></param> /// <param name="expiryDate"></param> /// <param name="zeroRange"></param> /// <param name="divRange"></param> /// <param name="orcParamsRange"></param> /// <returns></returns> public double CallCollarPricer(string underlying, double spot, double callStrike, string style, DateTime tradeDate, DateTime expiryDate, Excel.Range zeroRange, Excel.Range divRange, Excel.Range orcParamsRange) { var values = orcParamsRange.Value[System.Reflection.Missing.Value] as object[, ]; values = (object[, ])DataRangeHelper.TrimNulls(values); var orcParams = RangeHelper.Convert2DArrayToClass <WingParamsRange>(ArrayHelper.RangeToMatrix(values)); var zeroArray = zeroRange.Value[System.Reflection.Missing.Value] as object[, ]; var zeroes = ObjectToArrayOfPropertiesConverter.CreateListFromHorizontalArrayRange <ZeroCurveRange>(zeroArray); var divArray = zeroRange.Value[System.Reflection.Missing.Value] as object[, ]; var divs = ObjectToArrayOfPropertiesConverter.CreateListFromHorizontalArrayRange <DividendRange>(divArray); var result = Orion.EquityCollarPricer.Collar.CallCollarPricer(underlying, spot, callStrike, style, tradeDate, expiryDate, zeroes, divs, orcParams); return(result); }