/// <summary>Initializes a new instance of the <see cref="ReadOnlyMoneyMarketConventions"/> class. /// </summary> /// <param name="moneyMarketConventions">The money market conventions.</param> /// <exception cref="ArgumentNullException">Thrown, if <paramref name="moneyMarketConventions"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown, if <paramref name="moneyMarketConventions"/> is not completely defined.</exception> public ReadOnlyMoneyMarketConventions(MoneyMarketConventions moneyMarketConventions) { if (moneyMarketConventions == null) { throw new ArgumentNullException("moneyMarketConventions"); } if (moneyMarketConventions.IsCompletelyDefined == false) { throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsNotWellDefined, "Money market conventions"), "moneyMarketConventions"); } BusinessDayConvention = moneyMarketConventions.BusinessDayConvention; FixingLag = moneyMarketConventions.FixingLag; BusinessDaysToSettle = moneyMarketConventions.BusinessDaysToSettle.Value; CapletTenorConvention = moneyMarketConventions.CapletTenorConvention; DayCountConvention = moneyMarketConventions.DayCountConvention; FutureBasePointValue = moneyMarketConventions.FutureBasePointValue; LiborIndexName = moneyMarketConventions.LiborIndexName; LiborRateRoundingRule = moneyMarketConventions.LiborRateRoundingRule; }
/// <summary>Initializes a new instance of the <see cref="ReadOnlySwapMarketConventions"/> class. /// </summary> /// <param name="swapMarketConventions">The swap market conventions.</param> /// <exception cref="ArgumentNullException">Thrown, if <paramref name="swapMarketConventions"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown, if <paramref name="swapMarketConventions"/> is not completely defined.</exception> public ReadOnlySwapMarketConventions(SwapMarketConventions swapMarketConventions) { if (swapMarketConventions == null) { throw new ArgumentNullException("swapMarketConventions"); } if (swapMarketConventions.IsCompletelyDefined == false) { throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsNotWellDefined, "Swap market conventions"), "swapMarketConventions"); } BusinessDaysToSettle = swapMarketConventions.BusinessDaysToSettle.Value; FixingLag = swapMarketConventions.FixingLag; FixedBusinessDayConvention = swapMarketConventions.FixedBusinessDayConvention; FixedDayCountConvention = swapMarketConventions.FixedDayCountConvention; FixedFrequency = swapMarketConventions.FixedFrequency; FloatingBusinessDayConvention = swapMarketConventions.FloatingBusinessDayConvention; FloatingDayCountConvention = swapMarketConventions.FloatingDayCountConvention; FloatingFrequency = swapMarketConventions.FloatingFrequency; }
/// <summary>Sets the fixing lag, i.e. the number of business days taken into account for calculation of fixing dates, for example <c>-2</c> and sets the <see cref="FixingLagState"/> to <see cref="ConventionState.StandardValue"/>. /// </summary> /// <param name="value">The number of business days for fixing date calculation.</param> internal void SetStandardFixingLag(IFixingLag value) { m_FixingLag = value; m_FixingLagState = ConventionState.StandardValue; }
/// <summary>Gets the start and end date of the timeframe. /// </summary> /// <param name="referenceDate">A reference date (can be a business day or a holiday).</param> /// <param name="holidayCalendar">The (settlement) holiday calendar.</param> /// <param name="fixingLag">The fixing lag, i.e. a method used to calculate the fixing date with respect to the period. Will be applied to the IMM Date (even if the IMM date is not a business day).</param> /// <param name="startDate">The start date of the time span with respect to <paramref name="referenceDate"/> (output).</param> /// <param name="endDate">The end date of the time span with respect to <paramref name="referenceDate"/> (output).</param> /// <param name="tenor">The tenor that represents the time span; if the end date of the current object is not specified by its <see cref="TenorTimeSpan"/> representation, <paramref name="tenorRoundingRule"/> /// will be applied to <paramref name="startDate"/> and <paramref name="endDate"/> for the calculation of a <see cref="TenorTimeSpan"/> representation.</param> /// <param name="tenorRoundingRule"> A rounding rule which will be take into account if and only if the end date of the current object is not specified by its <see cref="TenorTimeSpan"/> representation.</param> /// <param name="logger">An optional logger.</param> public DateTime GetStartAndEndDate(DateTime referenceDate, IHolidayCalendar holidayCalendar, IFixingLag fixingLag, out DateTime startDate, out DateTime endDate, out TenorTimeSpan tenor, TenorTimeSpan.RoundingRule tenorRoundingRule = TenorTimeSpan.RoundingRule.NearestMonth, ILogger logger = null) { tenor = Tenor; return(GetStartAndEndDate(referenceDate, holidayCalendar, fixingLag, out startDate, out endDate, logger)); }
/// <summary>Gets the start and end date of the timeframe. /// </summary> /// <param name="referenceDate">A reference date (can be a business day or a holiday).</param> /// <param name="holidayCalendar">The (settlement) holiday calendar.</param> /// <param name="fixingLag">The fixing lag, i.e. a method used to calculate the fixing date with respect to the period. Will be applied to the IMM Date (even if the IMM date is not a business day).</param> /// <param name="startDate">The start date of the time span with respect to <paramref name="referenceDate"/> (output).</param> /// <param name="endDate">The end date of the time span with respect to <paramref name="referenceDate"/> (output).</param> /// <param name="logger">An optional logger.</param> /// <returns>The fixing date of with respect to the (interest) period.</returns> public DateTime GetStartAndEndDate(DateTime referenceDate, IHolidayCalendar holidayCalendar, IFixingLag fixingLag, out DateTime startDate, out DateTime endDate, ILogger logger = null) { var IMMDate = Next(referenceDate); startDate = StartDateAdjustment.GetAdjustedDate(IMMDate, holidayCalendar); endDate = EndDateAdjustment.GetAdjustedDate(startDate.AddTenorTimeSpan(Tenor), holidayCalendar); return(fixingLag.GetFixingDate(IMMDate, holidayCalendar)); }
/// <summary>Gets the start and end date of the timeframe. /// </summary> /// <param name="referenceDate">A reference date (can be a business day or a holiday).</param> /// <param name="holidayCalendar">The (settlement) holiday calendar.</param> /// <param name="fixingLag">The fixing lag, i.e. the number of business days taken into account for the calculation of fixing dates etc., for example <c>-2</c>.</param> /// <param name="startDate">The start date of the time span with respect to <paramref name="referenceDate" /> (output).</param> /// <param name="endDate">The end date of the time span with respect to <paramref name="referenceDate" /> (output).</param> /// <param name="logger">An optional logger.</param> /// <returns>The fixing date of with respect to the (interest) period.</returns> public DateTime GetStartAndEndDate(DateTime referenceDate, IHolidayCalendar holidayCalendar, IFixingLag fixingLag, out DateTime startDate, out DateTime endDate, ILogger logger = null) { GetStartAndEndDate(referenceDate, holidayCalendar, out startDate, out endDate, logger); return(fixingLag.GetFixingDate(startDate, holidayCalendar)); }
/// <summary>Initializes the <see cref="FixingLag" /> class. /// </summary> static FixingLag() { Minus1BDay = new ConstFixingLag(-1); Minus2BDays = new ConstFixingLag(-2); }