Ejemplo n.º 1
0
        public void Coupdays_ShouldReturnNumberOfDays_European_Actual_360()
        {
            var settlement = new DateTime(2012, 2, 29);
            var maturity   = new DateTime(2019, 3, 15);

            var func = new CoupdaysImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.European_30_360),
                FinancialDayFactory.Create(maturity, DayCountBasis.European_30_360),
                4,
                DayCountBasis.European_30_360
                );
            var result = func.GetCoupdays();

            Assert.AreEqual(90d, result.Result);


            settlement = new DateTime(2017, 2, 1);
            maturity   = new DateTime(2019, 5, 31);

            func = new CoupdaysImpl(
                FinancialDayFactory.Create(settlement, DayCountBasis.European_30_360),
                FinancialDayFactory.Create(maturity, DayCountBasis.European_30_360),
                4,
                DayCountBasis.European_30_360
                );
            result = func.GetCoupdays();
            Assert.AreEqual(90d, result.Result);
        }
Ejemplo n.º 2
0
        protected override FinanceCalcResult <double> ExecuteFunction(FinancialDay settlementDate, FinancialDay maturityDate, int frequency, DayCountBasis basis = DayCountBasis.US_30_360)
        {
            var impl = new CoupdaysImpl(settlementDate, maturityDate, frequency, basis);

            return(impl.GetCoupdays());
        }