Class FraTemplate

  • All Implemented Interfaces:
    TradeTemplate, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class FraTemplate
    extends Object
    implements TradeTemplate, org.joda.beans.ImmutableBean, Serializable
    A template for creating a forward rate agreement (FRA) trade.

    This defines almost all the data necessary to create a FraTrade. The trade date, notional and fixed rate are required to complete the template and create the trade. As such, it is often possible to get a market price for a trade based on the template. The market price is typically quoted as a bid/ask on the fixed rate.

    The template is defined by six dates.

    • Trade date, the date that the trade is agreed
    • Spot date, the base for date calculations, typically 2 business days after the trade date
    • Start date, the date on which the implied deposit starts, typically a number of months after the spot value date
    • End date, the date on which the implied deposit ends, typically a number of months after the spot value date
    • Fixing date, the date on which the index is to be observed, typically 2 business days before the start date
    • Payment date, the date on which payment is made, typically the same as the start date
    Some of these dates are specified by the convention embedded within this template.
    See Also:
    Serialized Form
    • Method Detail

      • of

        public static FraTemplate of​(Period periodToStart,
                                     IborIndex index)
        Obtains a template based on the specified period and index.

        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.

        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.

        Parameters:
        periodToStart - the period between the spot date and the start date
        index - the index that defines the market convention
        Returns:
        the template
      • of

        public static FraTemplate of​(Period periodToStart,
                                     Period periodToEnd,
                                     FraConvention convention)
        Obtains a template based on the specified periods and convention.

        The periods from the spot date to the start date and to the end date are specified.

        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.

        Parameters:
        periodToStart - the period between the spot date and the start date
        periodToEnd - the period between the spot date and the end date
        convention - the market convention
        Returns:
        the template
      • createTrade

        public FraTrade createTrade​(LocalDate tradeDate,
                                    BuySell buySell,
                                    double notional,
                                    double fixedRate,
                                    ReferenceData refData)
        Creates a trade based on this template.

        This returns a trade based on the specified date. The notional is unsigned, with buy/sell determining the direction of the trade. If buying the FRA, the floating rate is received from the counterparty, with the fixed rate being paid. If selling the FRA, the floating rate is paid to the counterparty, with the fixed rate being received.

        Parameters:
        tradeDate - the date of the trade
        buySell - the buy/sell flag, see Fra.getBuySell()
        notional - the notional amount, in the payment currency of the template
        fixedRate - the fixed rate, typically derived from the market
        refData - the reference data, used to resolve the trade dates
        Returns:
        the trade
        Throws:
        ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data
      • meta

        public static FraTemplate.Meta meta()
        The meta-bean for FraTemplate.
        Returns:
        the meta-bean, not null
      • builder

        public static FraTemplate.Builder builder()
        Returns a builder used to create an instance of the bean.
        Returns:
        the builder, not null
      • metaBean

        public FraTemplate.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getPeriodToStart

        public Period getPeriodToStart()
        Gets the period between the spot value date and the start date.

        In a FRA described as '2 x 5', the period to the start date is 2 months.

        Returns:
        the value of the property, not null
      • getPeriodToEnd

        public Period getPeriodToEnd()
        Gets the period between the spot value date and the end date.

        In a FRA described as '2 x 5', the period to the end date is 5 months. The difference between the start date and the end date typically matches the tenor of the index, however this is not validated.

        When building, this will default to the period to start plus the tenor of the index if not specified.

        Returns:
        the value of the property, not null
      • getConvention

        public FraConvention getConvention()
        Gets the underlying FRA convention.

        This specifies the market convention of the FRA to be created.

        Returns:
        the value of the property, not null
      • toBuilder

        public FraTemplate.Builder toBuilder()
        Returns a builder that allows this bean to be mutated.
        Returns:
        the mutable builder, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object