Class ImmutableFraConvention

  • All Implemented Interfaces:
    Named, FraConvention, TradeConvention, java.io.Serializable, Bean, ImmutableBean

    public final class ImmutableFraConvention
    extends java.lang.Object
    implements FraConvention, ImmutableBean, java.io.Serializable
    A market convention for forward rate agreement (FRA) trades.

    This defines the market convention for a FRA against a particular index. In most cases, the index contains sufficient information to fully define the convention. As such, no other fields need to be specified when creating an instance. The name of the convention is the same as the name of the index by default. The getters will default any missing information on the fly, avoiding both null and Optional.

    The convention 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 date
    • End date, the date on which the implied deposit ends, typically a number of months after the spot 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
    The period between the spot date and the start/end date is specified by FraTemplate, not by this convention.
    See Also:
    Serialized Form
    • Method Detail

      • of

        public static ImmutableFraConvention of​(IborIndex index)
        Obtains a convention based on the specified index.

        The standard market convention for a FRA is based exclusively on the index. This creates an instance that contains the index. The instance is not dereferenced using the FraConvention name, as such the result of this method and FraConvention.of(IborIndex) can differ.

        Use the builder for unusual conventions.

        Parameters:
        index - the index, the market convention values are extracted from the index
        Returns:
        the convention
      • getName

        public java.lang.String getName()
        Gets the convention name, such as 'GBP-LIBOR-3M'. This is the same as the name of the index by default.

        This will default to the name of the index if not specified.

        Specified by:
        getName in interface FraConvention
        Specified by:
        getName in interface Named
        Returns:
        the convention name
      • getCurrency

        public Currency getCurrency()
        Gets the primary currency, providing a default result if no override specified.

        This is the currency of the FRA and the currency that payment is made in. The data model permits this currency to differ from that of the index, however the two are typically the same.

        This will default to the currency of the index if not specified.

        Returns:
        the currency, not null
      • getDayCount

        public DayCount getDayCount()
        Gets the day count convention applicable, providing a default result if no override specified.

        This is used to convert dates to a numerical value. The data model permits the day count to differ from that of the index, however the two are typically the same.

        This will default to the day count of the index if not specified.

        Returns:
        the day count, not null
      • getSpotDateOffset

        public DaysAdjustment getSpotDateOffset()
        Gets the offset of the spot value date from the trade date, providing a default result if no override specified.

        The offset is applied to the trade date and is typically plus 2 business days. The start and end date of the FRA term are relative to the spot date.

        This will default to the effective date offset of the index if not specified.

        Specified by:
        getSpotDateOffset in interface FraConvention
        Returns:
        the spot date offset, not null
      • getBusinessDayAdjustment

        public BusinessDayAdjustment getBusinessDayAdjustment()
        Gets the business day adjustment to apply to the start and end date, providing a default result if no override specified.

        The start and end date are typically defined as valid business days and thus do not need to be adjusted. If this optional property is present, then the start and end date will be adjusted as defined here.

        This will default to 'ModifiedFollowing' using the index fixing calendar if not specified.

        Returns:
        the business day adjustment, not null
      • getFixingDateOffset

        public DaysAdjustment getFixingDateOffset()
        Gets the offset of the fixing date from the start date, providing a default result if no override specified.

        The offset is applied to the start date and is typically minus 2 business days. The data model permits the offset to differ from that of the index, however the two are typically the same.

        This will default to the fixing date offset of the index if not specified.

        Returns:
        the fixing date offset, not null
      • getPaymentDateOffset

        public DaysAdjustment getPaymentDateOffset()
        Gets the offset of the payment date from the start date, providing a default result if no override specified.

        Defines the offset from the start date to the payment date. In most cases, the payment date is the same as the start date, so the default of zero is appropriate.

        This will default to zero if not specified.

        Returns:
        the payment date offset, not null
      • getDiscounting

        public FraDiscountingMethod getDiscounting()
        Gets the method to use for discounting, providing a default result if no override specified.

        There are different approaches FRA pricing in the area of discounting. This method specifies the approach for this FRA.

        This will default 'AFMA' if the index has the currency 'AUD' or 'NZD' and to 'ISDA' otherwise.

        Returns:
        the discounting method, not null
      • createTrade

        public FraTrade createTrade​(java.time.LocalDate tradeDate,
                                    java.time.Period periodToStart,
                                    java.time.Period periodToEnd,
                                    BuySell buySell,
                                    double notional,
                                    double fixedRate,
                                    ReferenceData refData)
        Description copied from interface: FraConvention
        Creates a trade based on this convention, specifying the end of the FRA.

        This returns a trade based on the specified periods. 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.

        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.

        The start date will be the trade date, plus spot offset, plus period to start, adjusted to a valid business day. The end date will be the trade date, plus spot offset, plus period to end, adjusted to a valid business day. The adjustment of the start and end date occurs at trade creation. The payment date offset is also applied at trade creation. When the Fra is resolved, the start and end date are not adjusted again but the payment date is.

        Specified by:
        createTrade in interface FraConvention
        Parameters:
        tradeDate - the date of the trade
        periodToStart - the period between the spot date and the start date
        periodToEnd - the period between the spot date and the end date
        buySell - the buy/sell flag
        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
      • toTrade

        public FraTrade toTrade​(TradeInfo tradeInfo,
                                java.time.LocalDate startDate,
                                java.time.LocalDate endDate,
                                java.time.LocalDate paymentDate,
                                BuySell buySell,
                                double notional,
                                double fixedRate)
        Description copied from interface: FraConvention
        Creates a trade based on this convention.

        This returns a trade based on the specified dates. 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.

        Specified by:
        toTrade in interface FraConvention
        Parameters:
        tradeInfo - additional information about the trade
        startDate - the start date, which should be adjusted to be a valid business day
        endDate - the end date, which should be adjusted to be a valid business day
        paymentDate - the payment date, which should be adjusted to be a valid business day
        buySell - the buy/sell flag
        notional - the notional amount, in the payment currency of the template
        fixedRate - the fixed rate, typically derived from the market
        Returns:
        the trade
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • builder

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

        public IborIndex getIndex()
        Gets the Ibor index.

        The floating rate to be paid is based on this index It will be a well known market index such as 'GBP-LIBOR-3M'.

        Specified by:
        getIndex in interface FraConvention
        Returns:
        the value of the property, not null
      • toBuilder

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object