/** * Obtains a template based on the specified period and index. * <p> * The period from the start date to the end is specified. * The convention will be created based on the index. * * @param depositPeriod the period between the start date and the end date * @param index the index that defines the market convention * @return the template */ public static IborFixingDepositTemplate of(Period depositPeriod, IborIndex index) { return of(depositPeriod, IborFixingDepositConvention.of(index)); }
/** * Obtains a template based on the specified index. * <p> * The period from the start date to the end date will be the tenor of the index. * The convention will be created based on the index. * * @param index the index that defines the market convention * @return the template */ public static IborFixingDepositTemplate of(IborIndex index) { return of(index.getTenor().getPeriod(), IborFixingDepositConvention.of(index)); }
public void test_serialization() { IborFixingDepositTemplate test = IborFixingDepositTemplate.of(EUR_LIBOR_3M); assertSerialization(test); }
public void test_of_index() { IborFixingDepositTemplate test = IborFixingDepositTemplate.of(EUR_LIBOR_3M); assertEquals(test.getConvention(), CONVENTION); assertEquals(test.getDepositPeriod(), EUR_LIBOR_3M.getTenor().getPeriod()); }
public void test_of_periodAndIndex() { IborFixingDepositTemplate test = IborFixingDepositTemplate.of(Period.ofMonths(1), EUR_LIBOR_3M); assertEquals(test.getConvention(), CONVENTION); assertEquals(test.getDepositPeriod(), Period.ofMonths(1)); }
public void coverage() { IborFixingDepositCurveNode test = IborFixingDepositCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); coverImmutableBean(test); IborFixingDepositCurveNode test2 = IborFixingDepositCurveNode.of( IborFixingDepositTemplate.of(GBP_LIBOR_6M), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2"))); coverBeanEquals(test, test2); }
private static CurveNode curveIborFixingDepositCurveNode( String conventionStr, String label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order) { IborFixingDepositConvention convention = IborFixingDepositConvention.of(conventionStr); IborFixingDepositTemplate template = IborFixingDepositTemplate.of( convention.getIndex().getTenor().getPeriod(), convention); return IborFixingDepositCurveNode.builder() .template(template) .rateId(quoteId) .additionalSpread(spread) .label(label) .date(date) .dateOrder(order) .build(); }
public void test_createTrade() { IborFixingDepositTemplate template = IborFixingDepositTemplate.of(EUR_LIBOR_3M); double notional = 1d; double fixedRate = 0.045; LocalDate tradeDate = LocalDate.of(2015, 1, 22); IborFixingDepositTrade trade = template.createTrade(tradeDate, BUY, notional, fixedRate, REF_DATA); ImmutableIborFixingDepositConvention conv = (ImmutableIborFixingDepositConvention) template.getConvention(); LocalDate startExpected = conv.getSpotDateOffset().adjust(tradeDate, REF_DATA); LocalDate endExpected = startExpected.plus(template.getDepositPeriod()); IborFixingDeposit productExpected = IborFixingDeposit.builder() .businessDayAdjustment(conv.getBusinessDayAdjustment()) .buySell(BUY) .startDate(startExpected) .endDate(endExpected) .fixedRate(fixedRate) .index(EUR_LIBOR_3M) .notional(notional) .build(); TradeInfo tradeInfoExpected = TradeInfo.builder() .tradeDate(tradeDate) .build(); assertEquals(trade.getInfo(), tradeInfoExpected); assertEquals(trade.getProduct(), productExpected); }
fwd3Nodes[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(EUR_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, fwd3IdValues[0]))); for (int i = 0; i < fwd3FraTenors.length; i++) { fwd6Nodes[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(EUR_EURIBOR_6M), QuoteId.of(StandardId.of(SCHEME, fwd6IdValues[0]))); for (int i = 0; i < fwd6FraTenors.length; i++) {