com.opengamma.strata.pricer.swaption

Interface SwaptionVolatilities

• Method Summary

All Methods
Modifier and Type Method and Description
FixedIborSwapConvention getConvention()
Gets the convention of the swap for which the data is valid.
SwaptionVolatilitiesName getName()
Gets the name of these volatilities.
default LocalDate getValuationDate()
Gets the valuation date.
ZonedDateTime getValuationDateTime()
Gets the valuation date-time.
ValueType getVolatilityType()
Gets the type of volatility returned by the volatility(java.time.ZonedDateTime, double, double, double) method.
CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Calculates the parameter sensitivity.
default CurrencyParameterSensitivities parameterSensitivity(PointSensitivity... pointSensitivities)
Calculates the parameter sensitivity.
double price(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)
Calculates the price.
double priceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)
Calculates the price delta.
double priceGamma(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)
Calculates the price gamma.
double priceTheta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)
Calculates the price theta.
double priceVega(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)
Calculates the price vega.
double relativeTime(ZonedDateTime dateTime)
Converts a time and date to a relative year fraction.
double tenor(LocalDate startDate, LocalDate endDate)
Calculates the tenor of the swap based on its start date and end date.
double volatility(double expiry, double tenor, double strike, double forward)
Calculates the volatility at the specified expiry.
default double volatility(ZonedDateTime expiryDateTime, double tenor, double strike, double forward)
Calculates the volatility at the specified expiry.
SwaptionVolatilities withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.
SwaptionVolatilities withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
• Methods inherited from interface com.opengamma.strata.market.MarketDataView

findData
• Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData

getParameter, getParameterCount, getParameterMetadata
• Method Detail

• getName

SwaptionVolatilitiesName getName()
Gets the name of these volatilities.
Returns:
the name
• getConvention

FixedIborSwapConvention getConvention()
Gets the convention of the swap for which the data is valid.
Returns:
the convention
• getValuationDate

default LocalDate getValuationDate()
Gets the valuation date.

The volatilities are calibrated for this date.

Specified by:
getValuationDate in interface MarketDataView
Returns:
the valuation date
• getValuationDateTime

ZonedDateTime getValuationDateTime()
Gets the valuation date-time.

The volatilities are calibrated for this date-time.

Returns:
the valuation date-time
• withParameter

SwaptionVolatilities withParameter(int parameterIndex,
double newValue)
Description copied from interface: ParameterizedData
Returns a copy of the data with the value at the specified index altered.

This instance is immutable and unaffected by this method call.

Specified by:
withParameter in interface ParameterizedData
Parameters:
parameterIndex - the zero-based index of the parameter to get
newValue - the new value for the specified parameter
Returns:
a parameterized data instance based on this with the specified parameter altered
• withPerturbation

SwaptionVolatilities withPerturbation(ParameterPerturbation perturbation)
Description copied from interface: ParameterizedData
Returns a perturbed copy of the data.

The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.

This instance is immutable and unaffected by this method call.

Specified by:
withPerturbation in interface ParameterizedData
Parameters:
perturbation - the perturbation to apply
Returns:
a parameterized data instance based on this with the specified perturbation applied
• volatility

default double volatility(ZonedDateTime expiryDateTime,
double tenor,
double strike,
double forward)
Calculates the volatility at the specified expiry.

This relies on tenor supplied by tenor(LocalDate, LocalDate).

Parameters:
expiryDateTime - the option expiry
tenor - the tenor of the instrument as a year fraction
strike - the option strike rate
forward - the forward rate of the underlying swap
Returns:
the volatility
Throws:
RuntimeException - if the value cannot be obtained
• volatility

double volatility(double expiry,
double tenor,
double strike,
double forward)
Calculates the volatility at the specified expiry.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
strike - the option strike rate
forward - the forward rate of the underlying swap
Returns:
the volatility
Throws:
RuntimeException - if the value cannot be obtained
• parameterSensitivity

default CurrencyParameterSensitivities parameterSensitivity(PointSensitivity... pointSensitivities)
Calculates the parameter sensitivity.

This computes the CurrencyParameterSensitivities associated with the PointSensitivities. This corresponds to the projection of the point sensitivity to the internal parameters representation.

Parameters:
pointSensitivities - the point sensitivities
Returns:
the sensitivity to the underlying parameters
• parameterSensitivity

CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Calculates the parameter sensitivity.

This computes the CurrencyParameterSensitivities associated with the PointSensitivities. This corresponds to the projection of the point sensitivity to the internal parameters representation.

Parameters:
pointSensitivities - the point sensitivities
Returns:
the sensitivity to the underlying parameters
• price

double price(double expiry,
double tenor,
PutCall putCall,
double strike,
double forward,
double volatility)
Calculates the price.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate). This relies on volatility supplied by volatility(double, double, double, double).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
putCall - whether the option is put or call
strike - the option strike rate
forward - the forward rate of the underlying swap
volatility - the volatility
Returns:
the price
Throws:
RuntimeException - if the value cannot be obtained
• priceDelta

double priceDelta(double expiry,
double tenor,
PutCall putCall,
double strike,
double forward,
double volatility)
Calculates the price delta.

This is the forward driftless delta.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate). This relies on volatility supplied by volatility(double, double, double, double).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
putCall - whether the option is put or call
strike - the option strike rate
forward - the forward rate of the underlying swap
volatility - the volatility
Returns:
the delta
Throws:
RuntimeException - if the value cannot be obtained
• priceGamma

double priceGamma(double expiry,
double tenor,
PutCall putCall,
double strike,
double forward,
double volatility)
Calculates the price gamma.

This is the second order sensitivity of the forward option value to the forward.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate). This relies on volatility supplied by volatility(double, double, double, double).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
putCall - whether the option is put or call
strike - the option strike rate
forward - the forward rate of the underlying swap
volatility - the volatility
Returns:
the gamma
Throws:
RuntimeException - if the value cannot be obtained
• priceTheta

double priceTheta(double expiry,
double tenor,
PutCall putCall,
double strike,
double forward,
double volatility)
Calculates the price theta.

This is the driftless sensitivity of the present value to a change in time to maturity.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate). This relies on volatility supplied by volatility(double, double, double, double).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
putCall - whether the option is put or call
strike - the option strike rate
forward - the forward rate of the underlying swap
volatility - the volatility
Returns:
the theta
Throws:
RuntimeException - if the value cannot be obtained
• priceVega

double priceVega(double expiry,
double tenor,
PutCall putCall,
double strike,
double forward,
double volatility)
Calculates the price vega.

This is the sensitivity of the option forward price to the implied volatility.

This relies on expiry supplied by relativeTime(ZonedDateTime). This relies on tenor supplied by tenor(LocalDate, LocalDate). This relies on volatility supplied by volatility(double, double, double, double).

Parameters:
expiry - the time to expiry as a year fraction
tenor - the tenor of the instrument as a year fraction
putCall - whether the option is put or call
strike - the option strike rate
forward - the forward rate of the underlying swap
volatility - the volatility
Returns:
the vega
Throws:
RuntimeException - if the value cannot be obtained
• relativeTime

double relativeTime(ZonedDateTime dateTime)
Converts a time and date to a relative year fraction.

When the date is after the valuation date (and potentially time), the returned number is negative.

Parameters:
dateTime - the date-time to find the relative year fraction of
Returns:
the relative year fraction
• tenor

double tenor(LocalDate startDate,
LocalDate endDate)
Calculates the tenor of the swap based on its start date and end date.
Parameters:
startDate - the start date
endDate - the end date
Returns:
the tenor