Class ImmutableFxSwapConvention

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

    public final class ImmutableFxSwapConvention
    extends java.lang.Object
    implements FxSwapConvention, ImmutableBean, java.io.Serializable
    A market convention for FX swap trades

    This defines the market convention for a FX swap based on a particular currency pair.

    The convention is defined by four 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
    • Near date, the date on which the near leg of the swap is exchanged, typically equal to the spot date
    • Far date, the date on which the far leg of the swap is exchanged, typically a number of months or years after the spot date
    The period between the spot date and the start/end date is specified by FxSwapTemplate, not by this convention.
    See Also:
    Serialized Form
    • Method Detail

      • of

        public static ImmutableFxSwapConvention of​(CurrencyPair currencyPair,
                                                   DaysAdjustment spotDateOffset)
        Obtains a convention based on the specified currency pair and spot date offset.

        Use the builder for unusual conventions.

        Parameters:
        currencyPair - the currency pair associated to the convention
        spotDateOffset - the spot date offset
        Returns:
        the convention
      • of

        public static ImmutableFxSwapConvention of​(CurrencyPair currencyPair,
                                                   DaysAdjustment spotDateOffset,
                                                   BusinessDayAdjustment businessDayAdjustment)
        Obtains a convention based on the specified currency pair, spot date offset and adjustment.

        Use the builder for unusual conventions.

        Parameters:
        currencyPair - the currency pair associated to the convention
        spotDateOffset - the spot date offset
        businessDayAdjustment - the business day adjustment to apply
        Returns:
        the convention
      • 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 spot date offset calendar if not specified.

        Returns:
        the business day adjustment, not null
      • toTrade

        public FxSwapTrade toTrade​(TradeInfo tradeInfo,
                                   java.time.LocalDate startDate,
                                   java.time.LocalDate endDate,
                                   BuySell buySell,
                                   double notional,
                                   double nearFxRate,
                                   double farLegForwardPoints)
        Description copied from interface: FxSwapConvention
        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 FX Swap, the amount in the first currency of the pair is received in the near leg and paid in the far leg, while the second currency is paid in the near leg and received in the far leg.

        Specified by:
        toTrade in interface FxSwapConvention
        Parameters:
        tradeInfo - additional information about the trade
        startDate - the start date
        endDate - the end date
        buySell - the buy/sell flag
        notional - the notional amount, in the payment currency of the template
        nearFxRate - the FX rate for the near leg
        farLegForwardPoints - the FX points to be added to the FX rate at the far leg
        Returns:
        the trade
      • toString

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

        public CurrencyPair getCurrencyPair()
        Gets the currency pair associated with the convention.
        Specified by:
        getCurrencyPair in interface FxSwapConvention
        Returns:
        the value of the property, not null
      • getSpotDateOffset

        public DaysAdjustment getSpotDateOffset()
        Gets the offset of the spot value date from the trade date.

        The offset is applied to the trade date and is typically plus 2 business days in the joint calendar of the two currencies. The start and end date of the FX swap are relative to the spot date.

        Specified by:
        getSpotDateOffset in interface FxSwapConvention
        Returns:
        the value of the property, 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