PeriodicSchedule.of(startDate, endDate, P3M, BusinessDayAdjustment.NONE, SHORT_INITIAL, RollConventions.NONE); CdsIndex test = CdsIndex.builder() .paymentSchedule(sch) .buySell(SELL) .currency(JPY) .dayCount(ACT_365F) .fixedRate(COUPON) .cdsIndexId(INDEX_ID) .legalEntityIds(LEGAL_ENTITIES) .notional(NOTIONAL) .paymentOnDefault(PaymentOnDefault.NONE) .protectionStart(ProtectionStartOfDay.NONE) .settlementDateOffset(SETTLE_DAY_ADJ) .stepinDateOffset(STEPIN_DAY_ADJ) .build(); assertEquals(test.getPaymentSchedule(), sch); assertEquals(test.getBuySell(), SELL);
String indexName = indexOptEl.get().getChild("indexName").getContent(); CdsIndex cdsIndex = CdsIndex.builder() .buySell(buySell) .cdsIndexId(StandardId.of("CDX-Name", indexName)) .currency(notional.getCurrency()) .notional(notional.getAmount()) .paymentSchedule(scheduleBuilder.build()) .fixedRate(fixedRate) .dayCount(dayCount) .build(); return CdsIndexTrade.builder() .info(tradeInfoBuilder.build())
date(2025, 6, 20), Frequency.P3M, TEMPLATE.getConvention().getSettlementDateOffset().getCalendar(), 0.01); CdsIndex cdsIndexMod = cdsIndex.toBuilder() .paymentSchedule( cdsIndex.getPaymentSchedule().toBuilder() .rollConvention(RollConventions.DAY_20) .startDateBusinessDayAdjustment(cdsIndex.getPaymentSchedule().getBusinessDayAdjustment()) .build()) .build(); CdsIndexTrade expected = CdsIndexTrade.builder() .product(cdsIndexMod) date(2025, 6, 20), Frequency.P3M, TEMPLATE.getConvention().getSettlementDateOffset().getCalendar(), rate); CdsIndex cdsIndexMod1 = cdsIndex1.toBuilder() .paymentSchedule( cdsIndex.getPaymentSchedule().toBuilder() .rollConvention(RollConventions.DAY_20) .startDateBusinessDayAdjustment(cdsIndex1.getPaymentSchedule().getBusinessDayAdjustment()) .build()) .build(); CdsIndexTrade expected1 = CdsIndexTrade.builder() .product(cdsIndexMod1)
.info(cdsTrade.getInfo()) .product(CdsIndex.builder() .buySell(cdsProduct.getBuySell()) .currency(cdsProduct.getCurrency()) .notional(cdsProduct.getNotional()) .cdsIndexId(cdsIndexId) .legalEntityIds(legalEntityIds) .dayCount(cdsProduct.getDayCount()) .paymentSchedule(cdsProduct.getPaymentSchedule()) .fixedRate(cdsProduct.getFixedRate()) .paymentOnDefault(cdsProduct.getPaymentOnDefault()) .protectionStart(cdsProduct.getProtectionStart()) .settlementDateOffset(cdsProduct.getSettlementDateOffset()) .stepinDateOffset(cdsProduct.getStepinDateOffset()) .build()) .build(); return CdsIndexCalibrationTrade.of(cdsIndex, quote);
public void cdsIndex01() { String location = "classpath:com/opengamma/strata/loader/fpml/cdindex-ex01-cdx.xml"; ByteSource resource = ResourceLocator.of(location).getByteSource(); List<Trade> trades = FpmlDocumentParser.of(FpmlPartySelector.matching("Party2")).parseTrades(resource); assertEquals(trades.size(), 1); CdsIndexTrade cdsTrade = (CdsIndexTrade) trades.get(0); assertEquals(cdsTrade.getInfo().getTradeDate(), Optional.of(date(2005, 1, 24))); CdsIndex expected = CdsIndex.builder() .buySell(BUY) .cdsIndexId(StandardId.of("CDX-Name", "Dow Jones CDX NA IG.2")) .currency(USD) .notional(25000000d) .paymentSchedule(PeriodicSchedule.builder() .startDate(date(2004, 3, 23)) .endDate(date(2009, 3, 20)) .startDateBusinessDayAdjustment(BusinessDayAdjustment.NONE) .endDateBusinessDayAdjustment(BusinessDayAdjustment.NONE) .businessDayAdjustment(BusinessDayAdjustment.NONE) .frequency(Frequency.P3M) .build()) .fixedRate(0.0060) .dayCount(ACT_360) .build(); assertEqualsBean(cdsTrade.getProduct(), expected); assertEquals(cdsTrade.getUpfrontFee().get(), AdjustablePayment.of(USD, 16000, AdjustableDate.of(date(2004, 3, 23)))); }
public void coverage() { coverImmutableBean(PRODUCT); CdsIndex other = CdsIndex.builder() .buySell(SELL) .cdsIndexId(StandardId.of("OG", "AA-INDEX")) .legalEntityIds(ImmutableList.of(StandardId.of("OG", "ABC1"), StandardId.of("OG", "ABC2"))) .currency(JPY) .notional(1d) .paymentSchedule( PeriodicSchedule.of( LocalDate.of(2014, 1, 4), LocalDate.of(2020, 11, 20), P6M, BusinessDayAdjustment.of(BusinessDayConventions.FOLLOWING, JPTO), StubConvention.SHORT_FINAL, RollConventions.NONE)) .fixedRate(0.01) .dayCount(ACT_365F) .paymentOnDefault(PaymentOnDefault.NONE) .protectionStart(ProtectionStartOfDay.NONE) .settlementDateOffset(DaysAdjustment.NONE) .stepinDateOffset(DaysAdjustment.NONE) .build(); coverBeanEquals(PRODUCT, other); }
/** * Sets the {@code legalEntityIds} property in the builder * from an array of objects. * @param legalEntityIds the new value, not null * @return this, for chaining, not null */ public Builder legalEntityIds(StandardId... legalEntityIds) { return legalEntityIds(ImmutableList.copyOf(legalEntityIds)); }