Class DiscountingSwapTradePricer
- java.lang.Object
-
- com.opengamma.strata.pricer.swap.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.
-
-
Field Summary
Fields Modifier and Type Field Description static DiscountingSwapTradePricer
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description DiscountingSwapTradePricer(DiscountingSwapProductPricer productPricer)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiCurrencyAmount
accruedInterest(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the accrued interest since the last payment.CashFlows
cashFlows(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the future cash flows of the swap trade.MultiCurrencyAmount
currencyExposure(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the currency exposure of the swap trade.MultiCurrencyAmount
currentCash(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the current cash of the swap trade.ExplainMap
explainPresentValue(ResolvedSwapTrade trade, RatesProvider provider)
Explains the present value of the swap trade.MultiCurrencyAmount
forecastValue(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the forecast value of the swap trade.PointSensitivities
forecastValueSensitivity(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the forecast value sensitivity of the swap trade.DiscountingSwapProductPricer
getProductPricer()
Gets the underlying product pricer.double
parRate(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the par rate of the swap trade.PointSensitivities
parRateSensitivity(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the par rate curve sensitivity of the swap trade.double
parSpread(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the par spread of the swap trade.PointSensitivities
parSpreadSensitivity(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the par spread curve sensitivity of the swap trade.CurrencyAmount
presentValue(ResolvedSwapTrade trade, Currency currency, RatesProvider provider)
Calculates the present value of the swap trade, converted to the specified currency.MultiCurrencyAmount
presentValue(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the present value of the swap trade.PointSensitivities
presentValueSensitivity(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the present value sensitivity of the swap trade.
-
-
-
Field Detail
-
DEFAULT
public static final DiscountingSwapTradePricer DEFAULT
Default implementation.
-
-
Constructor Detail
-
DiscountingSwapTradePricer
public DiscountingSwapTradePricer(DiscountingSwapProductPricer productPricer)
Creates an instance.- Parameters:
productPricer
- the pricer forResolvedSwap
-
-
Method Detail
-
getProductPricer
public DiscountingSwapProductPricer getProductPricer()
Gets the underlying product pricer.- Returns:
- the product pricer
-
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 tradecurrency
- the currency to convert toprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- the rates provider- Returns:
- the par spread sensitivity
-
cashFlows
public CashFlows cashFlows(ResolvedSwapTrade trade, RatesProvider provider)
Calculates the future cash flows of the swap trade.Each expected cash flow is added to the result. This is based on
forecastValue(ResolvedSwapTrade, RatesProvider)
.- Parameters:
trade
- the tradeprovider
- the rates provider- Returns:
- the cash flows
-
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 tradeprovider
- 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 tradeprovider
- 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 tradeprovider
- the rates provider- Returns:
- the current cash of the swap trade
-
-