Ejemplo n.º 1
0
        public ResponseDiscountsList CalculateInflationRateList(InflationCurveSnapshot ycd, DateTime settlementDate, HashSet <DateTime> discountDates, bool ifToDraw)
        {
            ResponseDiscountsList result = new ResponseDiscountsList();

            result.ifToDraw = ifToDraw;
            try
            {
                //CalculateInflationRate1b is working for europe
                QuantLibAdaptor.IterativeInflationCurveCalculation(ycd, discountDates.ToList(), result.discountPoints);

                //    result.entryPoints = Repository.GetInflationCurveEntryData(ycd.Id, settlementDate);
                result.YcId = ycd.Id;
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }

                result.Error         = new CustomException();
                result.Error.Message = ex.Message + ex.StackTrace;
            }

            return(result);
        }
Ejemplo n.º 2
0
        // iftoDraw indicates if only computation is required or after computation is done the chart has to be drawn by SL client
        public ResponseDiscountsList CalculateDiscountedRateList(YieldCurveData ycd, DateTime settlementDate, HashSet <DateTime> discountDates, bool ifToDraw)
        {
            ResponseDiscountsList result = new ResponseDiscountsList();

            result.ifToDraw = ifToDraw;

            try
            {
                // will be only one YieldCurveData element if idYc is provided (this is unique key)
                //YieldCurveData ycDesc = Repository.GetYieldCurveData(idYc).Single();
                ycd.settlementDate = settlementDate;
                ycd.entryPointList = DataLayer.Repository.GetYieldCurveEntryPoint(ycd.Id, settlementDate);

                QuantLibAdaptor.CalculateDiscountedRate(ycd, discountDates.ToList(), result.discountPoints);

                /*
                 * for (int i = 0; i < ycDesc.entryPoints.Count(); i++)
                 * {
                 *      result.EnabledEntry.Add(ycDesc.entryPoints[i].Enabled);
                 *      result.EntryId.Add(ycDesc.entryPoints[i].Id);
                 * }
                 */

                result.YcId        = ycd.Id;
                result.entryPoints = ycd.entryPointList;
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }

                result.Error         = new CustomException();
                result.Error.Message = ex.Message + ex.StackTrace;
            }

            return(result);
        }