Class DiscountingSwapProductPricer


  • public class DiscountingSwapProductPricer
    extends java.lang.Object
    Pricer for for rate swap products.

    This function provides the ability to price a ResolvedSwap. The product is priced by pricing each leg.

    • Method Detail

      • presentValue

        public CurrencyAmount presentValue​(ResolvedSwap swap,
                                           Currency currency,
                                           RatesProvider provider)
        Calculates the present value of the swap product, converted to the specified currency.

        The present value of the product is the value on the valuation date. This is the discounted forecast value. The result is converted to the specified currency.

        Parameters:
        swap - the product
        currency - the currency to convert to
        provider - the rates provider
        Returns:
        the present value of the swap product in the specified currency
      • presentValue

        public MultiCurrencyAmount presentValue​(ResolvedSwap swap,
                                                RatesProvider provider)
        Calculates the present value of the swap product.

        The present value of the product is the value on the valuation date. This is the discounted forecast value. The result is expressed using the payment currency of each leg.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the present value of the swap product
      • forecastValue

        public MultiCurrencyAmount forecastValue​(ResolvedSwap swap,
                                                 RatesProvider provider)
        Calculates the forecast value of the swap product.

        The forecast value of the product is the value on the valuation date without present value discounting. The result is expressed using the payment currency of each leg.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the forecast value of the swap product
      • accruedInterest

        public MultiCurrencyAmount accruedInterest​(ResolvedSwap swap,
                                                   RatesProvider provider)
        Calculates the accrued interest since the last payment.

        This determines the payment period applicable at the valuation date and calculates the accrued interest since the last payment.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the accrued interest of the swap product
      • parRate

        public double parRate​(ResolvedSwap swap,
                              RatesProvider provider)
        Computes the par rate for swaps with a fixed leg.

        The par rate is the common rate on all payments of the fixed leg for which the total swap present value is 0.

        At least one leg must be a fixed leg. The par rate will be computed with respect to the first fixed leg in which all the payments are fixed payments with a unique accrual period (no compounding) and no FX reset. If the fixed leg is compounding, the par rate is computed only when the number of fixed coupon payments is 1 and accrual factor of each sub-period is 1

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the par rate
        Throws:
        java.lang.IllegalArgumentException - if there is no fixed leg
      • parSpread

        public double parSpread​(ResolvedSwap swap,
                                RatesProvider provider)
        Computes the par spread for swaps.

        The par spread is the common spread on all payments of the first leg for which the total swap present value is 0.

        The par spread will be computed with respect to the first leg. For that leg, all the payments have a unique accrual period or multiple accrual periods with Flat compounding and no FX reset.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the par rate
      • presentValueSensitivity

        public PointSensitivityBuilder presentValueSensitivity​(ResolvedSwap swap,
                                                               RatesProvider provider)
        Calculates the present value sensitivity of the swap product.

        The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the present value curve sensitivity of the swap product
      • presentValueSensitivity

        public PointSensitivityBuilder presentValueSensitivity​(ResolvedSwap swap,
                                                               Currency currency,
                                                               RatesProvider provider)
        Calculates the present value sensitivity of the swap product converted in a given currency.

        The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.

        Parameters:
        swap - the product
        currency - the currency to convert to
        provider - the rates provider
        Returns:
        the present value curve sensitivity of the swap product converted in the given currency
      • forecastValueSensitivity

        public PointSensitivityBuilder forecastValueSensitivity​(ResolvedSwap swap,
                                                                RatesProvider provider)
        Calculates the forecast value sensitivity of the swap product.

        The forecast value sensitivity of the product is the sensitivity of the forecast value to the underlying curves.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the forecast value curve sensitivity of the swap product
      • parRateSensitivity

        public PointSensitivityBuilder parRateSensitivity​(ResolvedSwap swap,
                                                          RatesProvider provider)
        Calculates the par rate curve sensitivity for a swap with a fixed leg.

        The par rate is the common rate on all payments of the fixed leg for which the total swap present value is 0.

        At least one leg must be a fixed leg. The par rate will be computed with respect to the first fixed leg. All the payments in that leg should be fixed payments with a unique accrual period (no compounding) and no FX reset.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the par rate curve sensitivity of the swap product
        Throws:
        java.lang.IllegalArgumentException - if there is no fixed leg
      • parSpreadSensitivity

        public PointSensitivityBuilder parSpreadSensitivity​(ResolvedSwap swap,
                                                            RatesProvider provider)
        Calculates the par spread curve sensitivity for a swap.

        The par spread is the common spread on all payments of the first leg for which the total swap present value is 0.

        The par spread is computed with respect to the first leg. For that leg, all the payments have a unique accrual period (no compounding) and no FX reset.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the par spread curve sensitivity of the swap product
      • explainPresentValue

        public ExplainMap explainPresentValue​(ResolvedSwap swap,
                                              RatesProvider provider)
        Explains the present value of the swap product.

        This returns explanatory information about the calculation.

        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the explanatory information
      • currencyExposure

        public MultiCurrencyAmount currencyExposure​(ResolvedSwap swap,
                                                    RatesProvider provider)
        Calculates the currency exposure of the swap product.
        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the currency exposure of the swap product
      • currentCash

        public MultiCurrencyAmount currentCash​(ResolvedSwap swap,
                                               RatesProvider provider)
        Calculates the current cash of the swap product.
        Parameters:
        swap - the product
        provider - the rates provider
        Returns:
        the current cash of the swap product