Beispiel #1
0
 /// <summary>
 /// Obtains a template based on the specified periods and convention.
 /// <para>
 /// The periods from the spot date to the start date and to the end date are specified.
 /// </para>
 /// <para>
 /// For example, a '2 x 5' FRA has a period to the start date of 2 months and
 /// a period to the end date of 5 months.
 ///
 /// </para>
 /// </summary>
 /// <param name="periodToStart">  the period between the spot date and the start date </param>
 /// <param name="periodToEnd">  the period between the spot date and the end date </param>
 /// <param name="convention">  the market convention </param>
 /// <returns> the template </returns>
 public static FraTemplate of(Period periodToStart, Period periodToEnd, FraConvention convention)
 {
     ArgChecker.notNull(periodToStart, "periodToStart");
     ArgChecker.notNull(periodToEnd, "periodToEnd");
     ArgChecker.notNull(convention, "convention");
     return(FraTemplate.builder().periodToStart(periodToStart).periodToEnd(periodToEnd).convention(convention).build());
 }
        public virtual void test_builder_defaults()
        {
            FraTemplate test = FraTemplate.builder().periodToStart(Period.ofMonths(2)).convention(FRA_GBP_LIBOR_3M).build();

            assertEquals(test.PeriodToStart, Period.ofMonths(2));
            assertEquals(test.PeriodToEnd, Period.ofMonths(5));     // defaulted
            assertEquals(test.Convention, FRA_GBP_LIBOR_3M);
        }
 public virtual void test_builder_insufficientInfo()
 {
     assertThrowsIllegalArg(() => FraTemplate.builder().convention(FRA_GBP_LIBOR_3M).build());
     assertThrowsIllegalArg(() => FraTemplate.builder().periodToStart(Period.ofMonths(2)).build());
 }