/// <summary>Initializes a new instance of the <see cref="SimpleThenPeriodicCompounding" /> class.
        /// </summary>
        /// <param name="frequency">The frequency of the compounding to apply after time-to-maturity of one year.</param>
        internal SimpleThenPeriodicCompounding(IDateScheduleFrequency frequency)
        {
            if (frequency == null)
            {
                throw new ArgumentNullException("frequency");
            }
            Frequency = frequency;

            var frequencyTenor = frequency.GetFrequencyTenor();

            if (TenorTimeSpan.IsNull(frequencyTenor) == true)
            {
                throw new ArgumentException("frequency");
            }

            if (frequencyTenor.Years != 0)
            {
                PaymentsPerYear = 1.0 / frequencyTenor.Years;
            }
            if (frequencyTenor.Months != 0)
            {
                PaymentsPerYear += 12.0 / frequencyTenor.Months;
            }
            if (frequencyTenor.Days != 0)
            {
                PaymentsPerYear += 365.0 / frequencyTenor.Days;
            }
            Name = new IdentifierString(String.Format("Simple;{0}", Frequency.Name.String));
        }
        /// <summary>Initializes a new instance of the <see cref="PeriodicInterestCompounding"/> class.
        /// </summary>
        /// <param name="frequency">The frequency of the compounding.</param>
        protected internal PeriodicInterestCompounding(IDateScheduleFrequency frequency)
        {
            if (frequency == null)
            {
                throw new ArgumentNullException("frequency");
            }
            Frequency = frequency;

            TenorTimeSpan frequencyTenor = frequency.GetFrequencyTenor();

            if (TenorTimeSpan.IsNull(frequencyTenor) == true)
            {
                throw new ArgumentException("frequency");
            }

            if (frequencyTenor.Years != 0)
            {
                PaymentsPerYear = 1.0 / frequencyTenor.Years;
            }
            if (frequencyTenor.Months != 0)
            {
                PaymentsPerYear += 12.0 / frequencyTenor.Months;
            }
            if (frequencyTenor.Days != 0)
            {
                PaymentsPerYear += 365.0 / frequencyTenor.Days;
            }
        }
 /// <summary>Gets a <see cref="IndividualDateScheduleFrequency"/> object.
 /// </summary>
 /// <param name="frequencyTenor">The frequency tenor.</param>
 /// <param name="individualDateScheduleFrequency">The individual date schedule frequency (output).</param>
 /// <returns>A value indicating whether <paramref name="individualDateScheduleFrequency"/> contains valid data.</returns>
 internal static bool TryCreate(TenorTimeSpan frequencyTenor, out IDateScheduleFrequency individualDateScheduleFrequency)
 {
     if (TenorTimeSpan.IsNull(frequencyTenor) || (frequencyTenor.IsPositive == false))
     {
         individualDateScheduleFrequency = null;
         return(false);
     }
     individualDateScheduleFrequency = new IndividualDateScheduleFrequency(frequencyTenor);
     return(true);
 }
        /// <summary>Initializes a new instance of the <see cref="IRCapletTenorConventionConstant"/> class.
        /// </summary>
        /// <param name="liborRateTenor">The (unique) libor rate tenor.</param>
        /// <exception cref="ArgumentException">Thrown, if <paramref name="liborRateTenor"/> represents a tenor leq or equal <c>0</c>.</exception>
        public IRCapletTenorConventionConstant(TenorTimeSpan liborRateTenor)
        {
            if (TenorTimeSpan.IsNull(liborRateTenor) || (liborRateTenor.IsPositive == false))
            {
                throw new ArgumentException("liborRateTenor");
            }
            m_LiborRateTenor = liborRateTenor.AsFrequency();

            m_Name     = new IdentifierString(String.Format("Constant caplet tenor {0}", liborRateTenor.ToString()));
            m_LongName = new IdentifierString(String.Format(IRCapletTenorConventionResources.ConstantTenorLongName, liborRateTenor.ToString()));
        }
        /// <summary>Initializes a new instance of the <see cref="IndividualDateScheduleFrequency"/> class.
        /// </summary>
        /// <param name="frequencyTenor">The frequency tenor.</param>
        /// <exception cref="ArgumentException">Thrown, if <paramref name="frequencyTenor"/> represents a
        /// tenor with a negative sign or the null-tenor.</exception>
        /// <remarks>The <see cref="Name"/> will be set to the <see cref="System.String"/> representation of
        /// <paramref name="frequencyTenor"/>.</remarks>
        public IndividualDateScheduleFrequency(TenorTimeSpan frequencyTenor)
        {
            if (TenorTimeSpan.IsNull(frequencyTenor) || (frequencyTenor.IsPositive == false))
            {
                throw new ArgumentException("frequencyTenor");
            }
            m_FrequencyTenor = frequencyTenor;
            string frequencyTenorAsString = frequencyTenor.ToString();

            m_Name     = new IdentifierString(frequencyTenorAsString);
            m_LongName = new IdentifierString(String.Format(DateFactoryResources.IndividualLongName, frequencyTenorAsString));
        }
Beispiel #6
0
 /// <summary>Determines whether a specified date schedule frequency is the frequency 'once'.
 /// </summary>
 /// <param name="dateScheduleFrequency">The date schedule frequency.</param>
 /// <returns>
 ///     <c>true</c> if the specified date schedule frequency is the frequency 'once'; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsOnceFrequency(this IDateScheduleFrequency dateScheduleFrequency)
 {
     return((dateScheduleFrequency != null) ? TenorTimeSpan.IsNull(dateScheduleFrequency.GetFrequencyTenor()) : false);
 }