public virtual void test_resolve() { FixedCouponBond @base = sut(); ResolvedFixedCouponBond resolved = @base.resolve(REF_DATA); assertEquals(resolved.LegalEntityId, LEGAL_ENTITY); assertEquals(resolved.SettlementDateOffset, DATE_OFFSET); assertEquals(resolved.YieldConvention, YIELD_CONVENTION); ImmutableList <FixedCouponBondPaymentPeriod> periodicPayments = resolved.PeriodicPayments; int expNum = 20; assertEquals(periodicPayments.size(), expNum); LocalDate unadjustedEnd = END_DATE; Schedule unadjusted = PERIOD_SCHEDULE.createSchedule(REF_DATA).toUnadjusted(); for (int i = 0; i < expNum; ++i) { FixedCouponBondPaymentPeriod payment = periodicPayments.get(expNum - 1 - i); assertEquals(payment.Currency, EUR); assertEquals(payment.Notional, NOTIONAL); assertEquals(payment.FixedRate, FIXED_RATE); assertEquals(payment.UnadjustedEndDate, unadjustedEnd); assertEquals(payment.EndDate, BUSINESS_ADJUST.adjust(unadjustedEnd, REF_DATA)); assertEquals(payment.PaymentDate, payment.EndDate); LocalDate unadjustedStart = unadjustedEnd.minusMonths(6); assertEquals(payment.UnadjustedStartDate, unadjustedStart); assertEquals(payment.StartDate, BUSINESS_ADJUST.adjust(unadjustedStart, REF_DATA)); assertEquals(payment.YearFraction, unadjusted.getPeriod(expNum - 1 - i).yearFraction(DAY_COUNT, unadjusted)); assertEquals(payment.DetachmentDate, EX_COUPON.adjust(payment.PaymentDate, REF_DATA)); unadjustedEnd = unadjustedStart; } Payment expectedPayment = Payment.of(CurrencyAmount.of(EUR, NOTIONAL), BUSINESS_ADJUST.adjust(END_DATE, REF_DATA)); assertEquals(resolved.NominalPayment, expectedPayment); }
static BondFutureTest() { for (int i = 0; i < NB_BOND; ++i) { LocalDate endDate = START_DATE[i].plus(BOND_TENOR[i]); PeriodicSchedule periodSchedule = PeriodicSchedule.of(START_DATE[i], endDate, Frequency.P6M, BUSINESS_ADJUST, StubConvention.SHORT_INITIAL, false); FixedCouponBond product = FixedCouponBond.builder().securityId(SecurityId.of("OG-Test", "Bond " + i)).dayCount(DAY_COUNT).fixedRate(RATE[i]).legalEntityId(ISSUER_ID).currency(USD).notional(NOTIONAL).accrualSchedule(periodSchedule).settlementDateOffset(SETTLEMENT_DAYS).yieldConvention(YIELD_CONVENTION).exCouponPeriod(EX_COUPON).build(); BOND_PRODUCT[i] = product; RESOLVED_BASKET[i] = product.resolve(REF_DATA); } }
//------------------------------------------------------------------------- public virtual void test_resolve() { ResolvedFixedCouponBondTrade expected = ResolvedFixedCouponBondTrade.builder().info(POSITION_INFO).product(PRODUCT.resolve(REF_DATA)).quantity(QUANTITY).build(); assertEquals(sut().resolve(REF_DATA), expected); }
//------------------------------------------------------------------------- public virtual void test_resolve() { ResolvedFixedCouponBondTrade expected = ResolvedFixedCouponBondTrade.builder().info(TRADE_INFO).product(PRODUCT.resolve(REF_DATA)).quantity(QUANTITY).settlement(ResolvedFixedCouponBondSettlement.of(SETTLEMENT_DATE, PRICE)).build(); assertEquals(sut().resolve(REF_DATA), expected); }