/** * 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)); }
/** * Creates a template based on this convention, specifying the period to start. * * <p>This returns a template based on this convention. 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. * * @param periodToStart the period from the spot date to the start date * @return the template */ public default FraTemplate toTemplate(Period periodToStart) { return FraTemplate.of( periodToStart, periodToStart.plus(getIndex().getTenor().getPeriod()), this); }