.cdsIndexId(INDEX_ID) .legalEntityIds(LEGAL_ENTITIES) .notional(NOTIONAL) .paymentOnDefault(PaymentOnDefault.NONE) .protectionStart(ProtectionStartOfDay.NONE)
.cdsIndexId(StandardId.of("CDX-Name", indexName)) .currency(notional.getCurrency()) .notional(notional.getAmount()) .paymentSchedule(scheduleBuilder.build()) .fixedRate(fixedRate)
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)))); }
.buySell(cdsProduct.getBuySell()) .currency(cdsProduct.getCurrency()) .notional(cdsProduct.getNotional()) .cdsIndexId(cdsIndexId) .legalEntityIds(legalEntityIds)
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); }