/// <summary>Gets a mutable Bond Market convention template which is initially filled with values of /// the current instance, i.e. with some standard conventions. /// </summary> /// <returns>A mutable Bond Market convention template.</returns> public BondMarketConventions GetMutableTemplate() { BondMarketConventions marketConventions = new BondMarketConventions(); marketConventions.SetStandardDayCountconvention(DayCountConvention); marketConventions.SetStandardBusinessDayConvention(BusinessDayConvention); marketConventions.SetStandardBusinessDaysToSettle(BusinessDaysToSettle); marketConventions.SetStandardCouponFrequency(CouponFrequency); return(marketConventions); }
/// <summary>Initializes a new instance of the <see cref="ReadOnlyBondMarketConventions"/> class. /// </summary> /// <param name="bondMarketConventions">The bond market conventions.</param> /// <exception cref="ArgumentNullException">Thrown, if <paramref name="bondMarketConventions"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown, if <paramref name="bondMarketConventions"/> is not completely defined.</exception> public ReadOnlyBondMarketConventions(BondMarketConventions bondMarketConventions) { if (bondMarketConventions == null) { throw new ArgumentNullException("bondMarketConventions"); } if (bondMarketConventions.IsCompletelyDefined == false) { throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsNotWellDefined, "Bond market conventions"), "bondMarketConventions"); } BusinessDaysToSettle = bondMarketConventions.BusinessDaysToSettle.Value; BusinessDayConvention = bondMarketConventions.BusinessDayConvention; CouponFrequency = bondMarketConventions.CouponFrequency; DayCountConvention = bondMarketConventions.DayCountConvention; }
/// <summary>Adds default market conventions that are taken into account into a specific logger. /// </summary> /// <param name="logger">The logger.</param> /// <param name="marketConventions">The market conventions which are taken into account.</param> /// <param name="userMarketConventionInput">The user input of market conventions.</param> public static void Add_Info(this ILogger logger, ReadOnlyBondMarketConventions marketConventions, BondMarketConventions userMarketConventionInput = null) { if ((logger != null) && (marketConventions != null)) { //if ((userMarketConventionInput == null) || (userMarketConventionInput.BusinessDayConventionState != ConventionState.UserInput)) //{ // logger.Add_Info_StandardValue("Business day convention", marketConventions.BusinessDayConvention.Name); //} //if ((userMarketConventionInput == null) || (userMarketConventionInput.BusinessDaysToSettleState != ConventionState.UserInput)) //{ // logger.Add_Info_StandardValue("Business days to settle", marketConventions.BusinessDaysToSettle); //} //if ((userMarketConventionInput == null) || (userMarketConventionInput.DayCountConventionState != ConventionState.UserInput)) //{ // logger.Add_Info_StandardValue("Day count convention", marketConventions.DayCountConvention.Name); //} //if ((userMarketConventionInput == null) || (userMarketConventionInput.CouponFrequencyState != ConventionState.UserInput)) //{ // logger.Add_Info_StandardValue("Coupon frequency", marketConventions.CouponFrequency.Name); //} } }