예제 #1
0
        public virtual void price_from_yield_intatmat()
        {
            Bill      bill           = US_BILL.toBuilder().yieldConvention(BillYieldConvention.INTEREST_AT_MATURITY).build();
            double    yield          = 0.01;
            LocalDate settlementDate = LocalDate.of(2018, 8, 17);
            double    af             = bill.DayCount.relativeYearFraction(settlementDate, MATURITY_DATE);
            double    priceExpected  = 1.0d / (1 + yield * af);
            double    priceComputed  = bill.priceFromYield(yield, settlementDate);

            assertEquals(priceExpected, priceComputed, TOLERANCE_PRICE);
        }