/// <summary> /// The main ctor. /// </summary> /// <param name="termCurve"></param> /// <param name="baseDate"></param> /// <param name="centralBankMonthRules"></param> /// <param name="centralBankDays"></param> /// <param name="centralBank"></param> /// <param name="dayCounter"></param> public GapStepInterpolator(TermCurve termCurve, DateTime baseDate, int centralBankMonthRules, DateTime[] centralBankDays, CentralBanks centralBank, IDayCounter dayCounter) : base(ConvertTermCurve(centralBank.ToString(), termCurve, baseDate, centralBankDays, dayCounter), baseDate, dayCounter) { CentralBankDateRuleMonths = centralBankMonthRules; CentralBank = centralBank; CentralBankDays = centralBankDays; }
/// <summary> /// Initializes a new instance of the <see cref="CentralBankDate"/> class. /// </summary> /// <param name="centralBankName">The central Bank Name.</param> protected CentralBankDate(CentralBanks centralBankName) { CentralBankName = centralBankName; ValidMeetingMonths = new List <int> { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; ValidQuarterlyMonths = new List <int> { 3, 6, 9, 12 }; }
//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); }
/// <summary> /// Creates the date time vector for the request Central Bank. /// </summary> /// <param name="baseDate">The base date.</param> /// <param name="centralBank">The requested central bank.</param> /// <param name="centralBankDateRuleMonths">The rules.</param> /// <param name="lastDate">The last date required.</param> /// <returns>An array of relevant dates.</returns> public static DateTime[] GetCentralBankDays(DateTime baseDate, CentralBanks centralBank, int centralBankDateRuleMonths, DateTime lastDate) { ICentralBankDate date = null; switch (centralBank) { case CentralBanks.RBA: date = new RBADate(); break; case CentralBanks.BNZ: date = new BNZDate(); break; case CentralBanks.BOE: date = new BOEDate(); break; case CentralBanks.BOJ: date = new BOJDate(); break; case CentralBanks.ECB: date = new ECBDate(); break; case CentralBanks.FOMC: date = new FOMCDate(); break; case CentralBanks.BHK: date = new BHKDate(); break; } if (date != null) { var dates1 = date.GetCentralBankDays(baseDate, centralBankDateRuleMonths); var dates2 = date.GetCentralBankDays(dates1[dates1.Count - 1], lastDate, false); //DateTime[] dates3 = new DateTime[dates1.Length + dates2.Length]; var result = new List <DateTime>(); // OMFG // result.AddRange(dates1); result.AddRange(dates2); return(result.ToArray()); } return(new DateTime[] {}); }
/// <summary> /// Initializes a new instance of the <see cref="CentralBankDate"/> class. /// </summary> /// <param name="centralBankName">The central Bank Name.</param> /// <param name="validMeetingMonths">The valid Meeting Months.</param> /// <param name="validQuarterlyMonths">The valid quarterly Months.</param> protected CentralBankDate(CentralBanks centralBankName, List <int> validMeetingMonths, List <int> validQuarterlyMonths) { CentralBankName = centralBankName; ValidMeetingMonths = validMeetingMonths; ValidQuarterlyMonths = validQuarterlyMonths; }