Пример #1
0
 public void test_gbpLibor3m_dates() {
   IborIndex test = IborIndex.of("GBP-LIBOR-3M");
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 13)), date(2014, 10, 13));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 13)), date(2014, 10, 13));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 13)), date(2015, 1, 13));
   // weekend
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 10)), date(2014, 10, 10));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 10)), date(2014, 10, 10));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 10)), date(2015, 1, 12));
   // input date is Sunday
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 12)), date(2014, 10, 13));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 12)), date(2014, 10, 13));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 12)), date(2015, 1, 13));
 }
Пример #2
0
 public void test_euibor3m() {
   IborIndex test = IborIndex.of("EUR-EURIBOR-3M");
   assertEquals(test.getCurrency(), EUR);
   assertEquals(test.getName(), "EUR-EURIBOR-3M");
   assertEquals(test.getTenor(), TENOR_3M);
   assertEquals(test.getFixingCalendar(), EUTA);
   assertEquals(test.getFixingDateOffset(), DaysAdjustment.ofBusinessDays(-2, EUTA));
   assertEquals(test.getEffectiveDateOffset(), DaysAdjustment.ofBusinessDays(2, EUTA));
   assertEquals(
       test.getMaturityDateOffset(),
       TenorAdjustment.ofLastBusinessDay(
           TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUTA)));
   assertEquals(test.getDayCount(), ACT_360);
   assertEquals(test.toString(), "EUR-EURIBOR-3M");
 }
Пример #3
0
 public void test_usdLibor3m() {
   IborIndex test = IborIndex.of("USD-LIBOR-3M");
   assertEquals(test.getCurrency(), USD);
   assertEquals(test.getName(), "USD-LIBOR-3M");
   assertEquals(test.getTenor(), TENOR_3M);
   assertEquals(test.getFixingCalendar(), GBLO);
   assertEquals(test.getFixingDateOffset(), DaysAdjustment.ofBusinessDays(-2, GBLO));
   assertEquals(
       test.getEffectiveDateOffset(),
       DaysAdjustment.ofBusinessDays(
           2, GBLO, BusinessDayAdjustment.of(FOLLOWING, GBLO.combineWith(USNY))));
   assertEquals(
       test.getMaturityDateOffset(),
       TenorAdjustment.ofLastBusinessDay(
           TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO.combineWith(USNY))));
   assertEquals(test.getDayCount(), ACT_360);
   assertEquals(test.toString(), "USD-LIBOR-3M");
 }
Пример #4
0
 public void test_usdLibor3m_dates() {
   IborIndex test = IborIndex.of("USD-LIBOR-3M");
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 27)), date(2014, 10, 29));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 29)), date(2014, 10, 27));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 29)), date(2015, 1, 29));
   // weekend
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 10)), date(2014, 10, 14));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 14)), date(2014, 10, 10));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 14)), date(2015, 1, 14));
   // effective date is US holiday
   assertEquals(test.calculateEffectiveFromFixing(date(2015, 1, 16)), date(2015, 1, 20));
   assertEquals(test.calculateFixingFromEffective(date(2015, 1, 20)), date(2015, 1, 16));
   assertEquals(test.calculateMaturityFromEffective(date(2015, 1, 20)), date(2015, 4, 20));
   // input date is Sunday, 13th is US holiday, but not UK holiday (can fix, but not be effective)
   assertEquals(test.calculateEffectiveFromFixing(date(2014, 10, 12)), date(2014, 10, 15));
   assertEquals(test.calculateFixingFromEffective(date(2014, 10, 12)), date(2014, 10, 10));
   assertEquals(test.calculateMaturityFromEffective(date(2014, 10, 12)), date(2015, 1, 14));
 }
Пример #5
0
 public void test_gbpLibor3m() {
   IborIndex test = IborIndex.of("GBP-LIBOR-3M");
   assertEquals(test.getCurrency(), GBP);
   assertEquals(test.getName(), "GBP-LIBOR-3M");
   assertEquals(test.getTenor(), TENOR_3M);
   assertEquals(test.getFixingCalendar(), GBLO);
   assertEquals(
       test.getFixingDateOffset(),
       DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(PRECEDING, GBLO)));
   assertEquals(
       test.getEffectiveDateOffset(),
       DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(FOLLOWING, GBLO)));
   assertEquals(
       test.getMaturityDateOffset(),
       TenorAdjustment.ofLastBusinessDay(
           TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO)));
   assertEquals(test.getDayCount(), ACT_365F);
   assertEquals(test.toString(), "GBP-LIBOR-3M");
 }
Пример #6
0
 /**
  * Checks and returns an Ibor index.
  *
  * <p>If this is an Ibor index, then this returns the matching {@link IborIndex}. If not, an
  * exception is thrown.
  *
  * @param tenor the tenor of the index
  * @return the index
  * @throws IllegalStateException if the type is not an Ibor index type
  * @see #getType()
  */
 public IborIndex toIborIndex(Tenor tenor) {
   if (!type.isIbor()) {
     throw new IllegalStateException("Incorrect index type, expected Ibor: " + name);
   }
   return IborIndex.of(indexName + tenor.normalized().toString());
 }
Пример #7
0
 public void test_null() {
   IborIndex test = IborIndex.of("GBP-LIBOR-3M");
   assertThrowsIllegalArg(() -> test.calculateEffectiveFromFixing(null));
   assertThrowsIllegalArg(() -> test.calculateFixingFromEffective(null));
   assertThrowsIllegalArg(() -> test.calculateMaturityFromEffective(null));
 }
Пример #8
0
 public void test_of_lookup_null() {
   assertThrowsIllegalArg(() -> IborIndex.of(null));
 }
Пример #9
0
 public void test_of_lookup_notFound() {
   assertThrowsIllegalArg(() -> IborIndex.of("Rubbish"));
 }
Пример #10
0
 @Test(dataProvider = "name")
 public void test_of_lookup(IborIndex convention, String name) {
   assertEquals(IborIndex.of(name), convention);
 }
Пример #11
0
 public void test_usdLibor_all() {
   assertEquals(IborIndex.of("USD-LIBOR-1W").getName(), "USD-LIBOR-1W");
   assertEquals(IborIndex.of("USD-LIBOR-1W"), IborIndices.USD_LIBOR_1W);
   assertEquals(IborIndex.of("USD-LIBOR-1M").getName(), "USD-LIBOR-1M");
   assertEquals(IborIndex.of("USD-LIBOR-1M"), IborIndices.USD_LIBOR_1M);
   assertEquals(IborIndex.of("USD-LIBOR-2M").getName(), "USD-LIBOR-2M");
   assertEquals(IborIndex.of("USD-LIBOR-2M"), IborIndices.USD_LIBOR_2M);
   assertEquals(IborIndex.of("USD-LIBOR-3M").getName(), "USD-LIBOR-3M");
   assertEquals(IborIndex.of("USD-LIBOR-3M"), IborIndices.USD_LIBOR_3M);
   assertEquals(IborIndex.of("USD-LIBOR-6M").getName(), "USD-LIBOR-6M");
   assertEquals(IborIndex.of("USD-LIBOR-6M"), IborIndices.USD_LIBOR_6M);
   assertEquals(IborIndex.of("USD-LIBOR-12M").getName(), "USD-LIBOR-12M");
   assertEquals(IborIndex.of("USD-LIBOR-12M"), IborIndices.USD_LIBOR_12M);
 }