Class VolatilitySwaptionPhysicalProductPricer
- java.lang.Object
-
- com.opengamma.strata.pricer.swaption.VolatilitySwaptionPhysicalProductPricer
-
- Direct Known Subclasses:
BlackSwaptionPhysicalProductPricer
,NormalSwaptionPhysicalProductPricer
,SabrSwaptionPhysicalProductPricer
public class VolatilitySwaptionPhysicalProductPricer extends Object
Pricer for swaption with physical 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 has already expired, a negative number is returned by
SwaptionVolatilities.relativeTime(ZonedDateTime)
.
-
-
Field Summary
Fields Modifier and Type Field Description static VolatilitySwaptionPhysicalProductPricer
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description VolatilitySwaptionPhysicalProductPricer(DiscountingSwapProductPricer swapPricer)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 physical.protected void
validateSwaption(ResolvedSwaption swaption)
Validates that the swaption is single currency physical.
-
-
-
Field Detail
-
DEFAULT
public static final VolatilitySwaptionPhysicalProductPricer DEFAULT
Default implementation.
-
-
Constructor Detail
-
VolatilitySwaptionPhysicalProductPricer
public VolatilitySwaptionPhysicalProductPricer(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 derivative is computed in the formula underlying the volatility (Black or Normal), it does not take into account the potential change of implied volatility induced by the change of forward. The number computed by this method is closely related to thepresentValueSensitivityRatesStickyStrike(com.opengamma.strata.product.swaption.ResolvedSwaption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.swaption.SwaptionVolatilities)
method.Related methods: Some concrete classes to this interface also implement a
presentValueSensitivity
method which take into account the change of implied volatility.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
-
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 physical.- Parameters:
swaption
- the swaptionratesProvider
- the rates providerswaptionVolatilities
- the volatilities
-
validateSwaption
protected void validateSwaption(ResolvedSwaption swaption)
Validates that the swaption is single currency physical.- Parameters:
swaption
- the swaption
-
-