/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ImmutableTermDepositConvention beanToCopy) { this.currency = beanToCopy.getCurrency(); this.name = beanToCopy.getName(); this.businessDayAdjustment = beanToCopy.getBusinessDayAdjustment(); this.dayCount = beanToCopy.getDayCount(); this.spotDateOffset = beanToCopy.getSpotDateOffset(); }
@Override public ImmutableTermDepositConvention build() { return new ImmutableTermDepositConvention( currency, name, businessDayAdjustment, dayCount, spotDateOffset); }
Tenor tenor = Tenor.ofMonths(mmMonths1[i]); ImmutableTermDepositConvention convention = (ImmutableTermDepositConvention) TermDepositConventions.USD_SHORT_DEPOSIT_T2; nodes1.add(DepositIsdaCreditCurveNode.of(QuoteId.of(StandardId.of("OG", idValues1[i])), convention.getSpotDateOffset(), convention.getBusinessDayAdjustment(), tenor, convention.getDayCount()));
@Test(dataProvider = "spotAndConv") public void test_spotAndConv(ImmutableTermDepositConvention convention, int spotT, BusinessDayConvention conv) { assertEquals(convention.getSpotDateOffset().getDays(), spotT); assertEquals(convention.getBusinessDayAdjustment().getConvention(), conv); }
@Override public String toString() { return getName(); }
/** * Obtains a convention based on the specified currency, business day adjustment, * day count convention and spot date offset. * * @param name the name of the convention, such as 'GBP-Deposit-ON' * @param currency the currency, in which the payments are made * @param businessDayAdjustment the business day adjustment to apply to the start and end date * @param dayCount the day count convention, used to convert dates to a numerical value * @param spotDateOffset the offset of the spot value date from the trade date * @return the convention */ public static ImmutableTermDepositConvention of( String name, Currency currency, BusinessDayAdjustment businessDayAdjustment, DayCount dayCount, DaysAdjustment spotDateOffset) { return ImmutableTermDepositConvention.builder() .name(name) .currency(currency) .businessDayAdjustment(businessDayAdjustment) .dayCount(dayCount) .spotDateOffset(spotDateOffset) .build(); }
public void test_serialization() { ImmutableTermDepositConvention test = ImmutableTermDepositConvention.of( "EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS); assertSerialization(test); }
public void coverage() { ImmutableTermDepositConvention test1 = ImmutableTermDepositConvention.of( "EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS); coverImmutableBean(test1); ImmutableTermDepositConvention test2 = ImmutableTermDepositConvention.of( "GBP-Deposit", GBP, BDA_MOD_FOLLOW, ACT_365F, DaysAdjustment.ofBusinessDays(0, GBLO)); coverBeanEquals(test1, test2); coverPrivateConstructor(TermDepositConventions.class); coverPrivateConstructor(StandardTermDepositConventions.class); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 575402001: // currency return ((ImmutableTermDepositConvention) bean).getCurrency(); case 3373707: // name return ((ImmutableTermDepositConvention) bean).getName(); case -1065319863: // businessDayAdjustment return ((ImmutableTermDepositConvention) bean).getBusinessDayAdjustment(); case 1905311443: // dayCount return ((ImmutableTermDepositConvention) bean).getDayCount(); case 746995843: // spotDateOffset return ((ImmutableTermDepositConvention) bean).getSpotDateOffset(); } return super.propertyGet(bean, propertyName, quiet); }
public void coverage() { TermDepositTemplate test1 = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION); coverImmutableBean(test1); TermDepositTemplate test2 = TermDepositTemplate.of(Period.ofMonths(6), ImmutableTermDepositConvention.of( "GBP-Dep", GBP, BDA_MOD_FOLLOW, ACT_365F, DaysAdjustment.ofBusinessDays(2, GBLO))); coverBeanEquals(test1, test2); }
public void test_of() { ImmutableTermDepositConvention test = ImmutableTermDepositConvention.of( "EUR-Deposit", EUR, BDA_MOD_FOLLOW, ACT_360, PLUS_TWO_DAYS); assertEquals(test.getName(), "EUR-Deposit"); assertEquals(test.getBusinessDayAdjustment(), BDA_MOD_FOLLOW); assertEquals(test.getCurrency(), EUR); assertEquals(test.getDayCount(), ACT_360); assertEquals(test.getSpotDateOffset(), PLUS_TWO_DAYS); }
public void test_builder_full() { ImmutableTermDepositConvention test = ImmutableTermDepositConvention.builder() .name("Test") .businessDayAdjustment(BDA_MOD_FOLLOW) .currency(EUR) .dayCount(ACT_360) .spotDateOffset(PLUS_TWO_DAYS) .build(); assertEquals(test.getName(), "Test"); assertEquals(test.getBusinessDayAdjustment(), BDA_MOD_FOLLOW); assertEquals(test.getCurrency(), EUR); assertEquals(test.getDayCount(), ACT_360); assertEquals(test.getSpotDateOffset(), PLUS_TWO_DAYS); }