Class VolatilitySwaptionCashParYieldProductPricer
- java.lang.Object
-
- com.opengamma.strata.pricer.swaption.VolatilitySwaptionCashParYieldProductPricer
-
- Direct Known Subclasses:
BlackSwaptionCashParYieldProductPricer
,NormalSwaptionCashParYieldProductPricer
,SabrSwaptionCashParYieldProductPricer
public class VolatilitySwaptionCashParYieldProductPricer extends Object
Pricer for swaption with par yield curve method of cash settlement based on volatilities.The swap underlying the swaption must have a fixed leg on which the forward rate is computed. The underlying swap must be single currency.
The volatility parameters are not adjusted for the underlying swap convention.
The value of the swaption after expiry is 0. For a swaption which already expired, negative number is returned by
SwaptionVolatilities.relativeTime(ZonedDateTime)
.
-
-
Field Summary
Fields Modifier and Type Field Description static VolatilitySwaptionCashParYieldProductPricer
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description VolatilitySwaptionCashParYieldProductPricer(DiscountingSwapProductPricer swapPricer)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
calculateNumeraire(ResolvedSwaption swaption, ResolvedSwapLeg fixedLeg, double forward, RatesProvider ratesProvider)
Calculates the numeraire, used to multiply the results.protected double
calculateStrike(ResolvedSwapLeg fixedLeg)
Calculates the strike.MultiCurrencyAmount
currencyExposure(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Computes the currency exposure of the swaption.protected ResolvedSwapLeg
fixedLeg(ResolvedSwap swap)
Checks that there is exactly one fixed leg and returns it.double
forwardRate(ResolvedSwaption swaption, RatesProvider ratesProvider)
Provides the forward rate.protected DiscountingSwapProductPricer
getSwapPricer()
Gets the swap pricer.double
impliedVolatility(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Computes the implied volatility of the swaption.CurrencyAmount
presentValue(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value of the swaption.CurrencyAmount
presentValueDelta(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value delta of the swaption.CurrencyAmount
presentValueGamma(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value gamma of the swaption.SwaptionSensitivity
presentValueSensitivityModelParamsVolatility(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value sensitivity to the implied volatility of the swaption.PointSensitivityBuilder
presentValueSensitivityRatesStickyStrike(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value sensitivity of the swaption to the rate curves.CurrencyAmount
presentValueTheta(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value of the swaption.protected void
validate(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Validates that the rates and volatilities providers are coherent and that the swaption is single currency cash par-yield.protected void
validateSwaption(ResolvedSwaption swaption)
Validates that the swaption is single currency cash par-yield.
-
-
-
Field Detail
-
DEFAULT
public static final VolatilitySwaptionCashParYieldProductPricer DEFAULT
Default implementation.
-
-
Constructor Detail
-
VolatilitySwaptionCashParYieldProductPricer
public VolatilitySwaptionCashParYieldProductPricer(DiscountingSwapProductPricer swapPricer)
Creates an instance.- Parameters:
swapPricer
- the pricer forSwap
-
-
Method Detail
-
getSwapPricer
protected DiscountingSwapProductPricer getSwapPricer()
Gets the swap pricer.- Returns:
- the swap pricer
-
presentValue
public CurrencyAmount presentValue(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value of the swaption.The result is expressed using the currency of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the present value
-
currencyExposure
public MultiCurrencyAmount currencyExposure(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Computes the currency exposure of the swaption.This is equivalent to the present value of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the currency exposure
-
impliedVolatility
public double impliedVolatility(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Computes the implied volatility of the swaption.- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the implied volatility associated with the swaption
-
forwardRate
public double forwardRate(ResolvedSwaption swaption, RatesProvider ratesProvider)
Provides the forward rate.This is the par rate for the forward starting swap that is the underlying of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates provider- Returns:
- the forward rate
-
presentValueDelta
public CurrencyAmount presentValueDelta(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value delta of the swaption.The present value delta is given by
pvbp * priceDelta
wherepriceDelta
is the first derivative of the price with respect to forward.The result is expressed using the currency of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the present value delta of the swaption
-
presentValueGamma
public CurrencyAmount presentValueGamma(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value gamma of the swaption.The present value gamma is given by
pvbp * priceGamma
wherepriceGamma
is the second derivative of the price with respect to forward.The result is expressed using the currency of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the present value gamma of the swaption
-
presentValueTheta
public CurrencyAmount presentValueTheta(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value of the swaption.The present value theta is given by
pvbp * priceTheta
wherepriceTheta
is the minus of the price sensitivity totimeToExpiry
.The result is expressed using the currency of the swaption.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the present value theta of the swaption
-
presentValueSensitivityRatesStickyStrike
public PointSensitivityBuilder presentValueSensitivityRatesStickyStrike(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value sensitivity of the swaption to the rate curves.The present value sensitivity is computed in a "sticky strike" style, i.e. the sensitivity to the curve nodes with the volatility at the swaption strike unchanged. This sensitivity does not include a potential change of volatility due to the implicit change of forward rate or moneyness.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the point sensitivity to the rate curves
-
presentValueSensitivityModelParamsVolatility
public SwaptionSensitivity presentValueSensitivityModelParamsVolatility(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Calculates the present value sensitivity to the implied volatility of the swaption.The sensitivity to the implied volatility is also called vega.
- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities- Returns:
- the point sensitivity to the volatility
-
calculateNumeraire
protected double calculateNumeraire(ResolvedSwaption swaption, ResolvedSwapLeg fixedLeg, double forward, RatesProvider ratesProvider)
Calculates the numeraire, used to multiply the results.- Parameters:
swaption
- the swapfixedLeg
- the fixed legforward
- the forward rateratesProvider
- the rates provider- Returns:
- the numeraire
-
calculateStrike
protected double calculateStrike(ResolvedSwapLeg fixedLeg)
Calculates the strike.- Parameters:
fixedLeg
- the fixed leg- Returns:
- the strike
-
fixedLeg
protected ResolvedSwapLeg fixedLeg(ResolvedSwap swap)
Checks that there is exactly one fixed leg and returns it.- Parameters:
swap
- the swap- Returns:
- the fixed leg
-
validate
protected void validate(ResolvedSwaption swaption, RatesProvider ratesProvider, SwaptionVolatilities swaptionVolatilities)
Validates that the rates and volatilities providers are coherent and that the swaption is single currency cash par-yield.- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities
-
validateSwaption
protected void validateSwaption(ResolvedSwaption swaption)
Validates that the swaption is single currency cash par-yield.- Parameters:
swaption
- the swaption
-
-