Class DiscountingSwapTradePricer


  • public class DiscountingSwapTradePricer
    extends Object
    Pricer for for rate swap trades.

    This function provides the ability to price a ResolvedSwapTrade. The product is priced by pricing the product.

    • Method Detail

      • presentValue

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

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

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

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

        The present value of the trade 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:
        trade - the trade
        provider - the rates provider
        Returns:
        the present value of the swap trade
      • explainPresentValue

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

        This returns explanatory information about the calculation.

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the explanatory information
      • presentValueSensitivity

        public PointSensitivities presentValueSensitivity​(ResolvedSwapTrade trade,
                                                          RatesProvider provider)
        Calculates the present value sensitivity of the swap trade.

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

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the present value curve sensitivity of the swap trade
      • forecastValue

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

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

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the forecast value of the swap trade
      • forecastValueSensitivity

        public PointSensitivities forecastValueSensitivity​(ResolvedSwapTrade trade,
                                                           RatesProvider provider)
        Calculates the forecast value sensitivity of the swap trade.

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

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the forecast value curve sensitivity of the swap trade
      • parRate

        public double parRate​(ResolvedSwapTrade trade,
                              RatesProvider provider)
        Calculates the par rate of the swap trade.

        The par rate is the rate for which the swap present value is 0.

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the par rate
      • parRateSensitivity

        public PointSensitivities parRateSensitivity​(ResolvedSwapTrade trade,
                                                     RatesProvider provider)
        Calculates the par rate curve sensitivity of the swap trade.

        The par rate curve sensitivity of the product is the sensitivity of the par rate to the underlying curves.

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the par rate sensitivity
      • parSpread

        public double parSpread​(ResolvedSwapTrade trade,
                                RatesProvider provider)
        Calculates the par spread of the swap trade.

        This is spread to be added to the fixed rate to have a present value of 0.

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the par spread
      • parSpreadSensitivity

        public PointSensitivities parSpreadSensitivity​(ResolvedSwapTrade trade,
                                                       RatesProvider provider)
        Calculates the par spread curve sensitivity of the swap trade.

        The par spread curve sensitivity of the product is the sensitivity of the par spread to the underlying curves.

        Parameters:
        trade - the trade
        provider - the rates provider
        Returns:
        the par spread sensitivity
      • accruedInterest

        public MultiCurrencyAmount accruedInterest​(ResolvedSwapTrade trade,
                                                   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:
        trade - the trade
        provider - the rates provider
        Returns:
        the accrued interest
      • currencyExposure

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

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