Exemple #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));
 }
Exemple #2
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));
 }
Exemple #3
0
 public void test_null() {
   IborIndex test = IborIndex.of("GBP-LIBOR-3M");
   assertThrowsIllegalArg(() -> test.calculateEffectiveFromFixing(null));
   assertThrowsIllegalArg(() -> test.calculateFixingFromEffective(null));
   assertThrowsIllegalArg(() -> test.calculateMaturityFromEffective(null));
 }