예제 #1
0
        /// <summary>
        /// Creates the datatime vector for the request Central Bank.
        /// </summary>
        /// <param name="baseDate">The base date.</param>
        /// <param name="validCentralBank">The requested central bank.</param>
        /// <param name="centralBankDateRuleMonths">The rules.</param>
        /// <param name="lastDate">The last date required.</param>
        /// <returns>An aray of relevant dates.</returns>
        public object[,] GetCentralBankDates(DateTime baseDate, string validCentralBank,
                                             int centralBankDateRuleMonths, DateTime lastDate)
        {
            var result  = CentralBanksHelper.GetCBDates(baseDate, validCentralBank, centralBankDateRuleMonths, lastDate);
            var resVals = RangeHelper.ConvertArrayToRange(result);

            return(resVals);
        }
예제 #2
0
        private static TermCurve ConvertTermCurve(TermCurve termCurve, DateTime baseDate, int centralBankDateRuleMonths, IDayCounter dayCounter)
        {
            var interpolationMethod = new InterpolationMethod
            {
                Value = "PiecewiseConstantRateInterpolation"
            };

            termCurve.interpolationMethod = interpolationMethod;
            var lastDate = (DateTime)termCurve.point[termCurve.point.Length - 1].term.Items[0];

            return(InterpolateGapStepTermPoints(termCurve, CentralBanksHelper.GetCentralBankDays(baseDate, _centralBank, centralBankDateRuleMonths, lastDate), baseDate, dayCounter));//Add the extra points..
        }
예제 #3
0
        //TODO add EOM, EOQ and EOY perturbation: this transfers the step to the specific day.
        //Also needs to add EOM swaps to the asset config file.

        /// <summary>
        /// The main ctor.
        /// </summary>
        /// <param name="termCurve"></param>
        /// <param name="baseDate"></param>
        /// <param name="centralBankDateRuleMonths"></param>
        /// <param name="centralBank"></param>
        /// <param name="dayCounter"></param>
        public GapStepInterpolator(TermCurve termCurve, DateTime baseDate, int centralBankDateRuleMonths,
                                   CentralBanks centralBank, IDayCounter dayCounter)
            : base(ConvertTermCurve(termCurve, baseDate, centralBankDateRuleMonths, dayCounter), baseDate, dayCounter)
        {
            CentralBankDateRuleMonths = centralBankDateRuleMonths;
            _centralBank = centralBank;//var names = Enum.GetNames(typeof(AssetFactory.Types));
            //TODO remove this once working.
            var lastDate = (DateTime)termCurve.point[termCurve.point.Length - 1].term.Items[0];

            CentralBankDays = CentralBanksHelper.GetCentralBankDays(baseDate, centralBank, centralBankDateRuleMonths, lastDate);
            TermCurve       = InterpolateGapStepTermPoints(termCurve, CentralBankDays, baseDate, dayCounter);
        }