private LocalDate calculateSettlementDate(ReferenceData refData) { if (info.getSettlementDate().isPresent()) { return info.getSettlementDate().get(); } if (info.getTradeDate().isPresent()) { LocalDate tradeDate = info.getTradeDate().get(); return product.getSettlementDateOffset().adjust(tradeDate, refData); } throw new IllegalStateException("FixedCouponBondTrade.resolve() requires either trade date or settlement date"); }
public void test_builder() { FixedCouponBond test = sut(); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getDayCount(), DAY_COUNT); assertEquals(test.getFixedRate(), FIXED_RATE); assertEquals(test.getLegalEntityId(), LEGAL_ENTITY); assertEquals(test.getCurrency(), EUR); assertEquals(test.getNotional(), NOTIONAL); assertEquals(test.getAccrualSchedule(), PERIOD_SCHEDULE); assertEquals(test.getSettlementDateOffset(), DATE_OFFSET); assertEquals(test.getYieldConvention(), YIELD_CONVENTION); assertEquals(test.getExCouponPeriod(), EX_COUPON); }
@Override public ResolvedBondFuture resolve(ReferenceData refData) { List<ResolvedFixedCouponBond> basket = deliveryBasket.stream() .map(bond -> bond.resolve(refData)) .collect(toImmutableList()); DaysAdjustment settleOffset = deliveryBasket.get(0).getSettlementDateOffset(); return ResolvedBondFuture.builder() .securityId(securityId) .deliveryBasket(basket) .conversionFactors(conversionFactors) .lastTradeDate(lastTradeDate) .firstNoticeDate(firstNoticeDate) .lastNoticeDate(lastNoticeDate) .firstDeliveryDate(firstDeliveryDate != null ? firstDeliveryDate : settleOffset.adjust(firstNoticeDate, refData)) .lastDeliveryDate(lastDeliveryDate != null ? lastDeliveryDate : settleOffset.adjust(lastNoticeDate, refData)) .rounding(rounding) .build(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1574023291: // securityId return ((FixedCouponBond) bean).getSecurityId(); case 575402001: // currency return ((FixedCouponBond) bean).getCurrency(); case 1585636160: // notional return ((FixedCouponBond) bean).getNotional(); case 304659814: // accrualSchedule return ((FixedCouponBond) bean).getAccrualSchedule(); case 747425396: // fixedRate return ((FixedCouponBond) bean).getFixedRate(); case 1905311443: // dayCount return ((FixedCouponBond) bean).getDayCount(); case -1895216418: // yieldConvention return ((FixedCouponBond) bean).getYieldConvention(); case 866287159: // legalEntityId return ((FixedCouponBond) bean).getLegalEntityId(); case 135924714: // settlementDateOffset return ((FixedCouponBond) bean).getSettlementDateOffset(); case 1408037338: // exCouponPeriod return ((FixedCouponBond) bean).getExCouponPeriod(); } return super.propertyGet(bean, propertyName, quiet); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(FixedCouponBond beanToCopy) { this.securityId = beanToCopy.getSecurityId(); this.currency = beanToCopy.getCurrency(); this.notional = beanToCopy.getNotional(); this.accrualSchedule = beanToCopy.getAccrualSchedule(); this.fixedRate = beanToCopy.getFixedRate(); this.dayCount = beanToCopy.getDayCount(); this.yieldConvention = beanToCopy.getYieldConvention(); this.legalEntityId = beanToCopy.getLegalEntityId(); this.settlementDateOffset = beanToCopy.getSettlementDateOffset(); this.exCouponPeriod = beanToCopy.getExCouponPeriod(); }
static FixedCouponBondSecurity createSecurity(FixedCouponBond product) { return FixedCouponBondSecurity.builder() .info(SecurityInfo.of(product.getSecurityId(), INFO.getPriceInfo())) .currency(product.getCurrency()) .notional(product.getNotional()) .accrualSchedule(product.getAccrualSchedule()) .fixedRate(product.getFixedRate()) .dayCount(product.getDayCount()) .yieldConvention(product.getYieldConvention()) .legalEntityId(product.getLegalEntityId()) .settlementDateOffset(product.getSettlementDateOffset()) .exCouponPeriod(product.getExCouponPeriod()) .build(); }