/** * Obtains a template based on the specified period and index. * * <p>The period from the spot date to the start date is specified. The period from the spot date * to the end date will be the period to start plus the tenor of the index. * * <p>For example, a '2 x 5' FRA has a period to the start date of 2 months. The index will be a 3 * month index, such as 'USD-LIBOR-3M'. The period to the end date will be the period to the start * date plus the index tenor. * * @param periodToStart the period between the spot date and the start date * @param index the index that defines the market convention * @return the template */ public static FraTemplate of(Period periodToStart, IborIndex index) { return of( periodToStart, periodToStart.plus(index.getTenor().getPeriod()), FraConvention.of(index)); }
/** * Obtains a convention based on the specified index. * * <p>This uses the index name to find the matching convention. By default, this will always * return a convention, however configuration may be added to restrict the conventions that are * registered. * * @param index the index, from which the index name is used to find the matching convention * @return the convention * @throws IllegalArgumentException if no convention is registered for the index */ public static IborFixingDepositConvention of(IborIndex index) { ArgChecker.notNull(index, "index"); return extendedEnum().lookup(index.getName()); }