Пример #1
0
        public static object eqCurveIRGetDiscountFactor(
            [ExcelArgument(Description = "curve id ")] string ObjectId,
            [ExcelArgument(Description = "tenors ")] DateTime dt,
            [ExcelArgument(Description = "trigger ")] object trigger)
        {
            if (ExcelUtil.CallFromWizard())
            {
                return("");
            }

            string callerAddress = ExcelUtil.getActiveCellAddress();

            try
            {
                Xl.Range rng = ExcelUtil.getActiveCellRange();

                if (!ObjectId.Contains('@'))
                {
                    ObjectId = "CRV@" + ObjectId;
                }

                YieldTermStructureHandle curve = OHRepository.Instance.getObject <YieldTermStructureHandle>(ObjectId);
                Date refDate = curve.referenceDate();

                Date   dt2      = EliteQuant.EQConverter.ConvertObject <Date>(dt);
                double discount = curve.discount(dt2);

                return(discount);
            }
            catch (Exception e)
            {
                ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message);
                return("#EQ_ERR!");
            }
        }