Module net.finmath.lib
Class CapletVolatilitySurface
java.lang.Object
net.finmath.marketdata.model.volatility.caplet.CapletVolatilitySurface
- All Implemented Interfaces:
VolatilitySurface
public class CapletVolatilitySurface extends Object implements VolatilitySurface
This class implements a caplet volatility surface.
- Author:
- Daniel Willhalm, Christian Fries (review and fixes)
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.finmath.marketdata.model.volatilities.VolatilitySurface
VolatilitySurface.QuotingConvention -
Constructor Summary
Constructors Constructor Description CapletVolatilitySurface(String name, LocalDate referenceDate, double[][] volatilityMatrix, double[] maturityVector, double[] strikeVector, ForwardCurve forwardCurve, VolatilitySurface.QuotingConvention volatilityConvention, DiscountCurve discountCurve)The constructor of the caplet volatility surface class.CapletVolatilitySurface(String name, LocalDate referenceDate, double volatility, double[] maturityVector, double[] strikeVector, ForwardCurve forwardCurve, VolatilitySurface.QuotingConvention volatilityConvention, DiscountCurve discountCurve)The constructor of the caplet volatility surface class. -
Method Summary
Modifier and Type Method Description doubleconvertFromTo(double optionMaturity, double optionStrike, double value, VolatilitySurface.QuotingConvention fromQuotingConvention, VolatilitySurface.QuotingConvention toQuotingConvention)Convert the value of a caplet from one quoting convention to another quoting convention.doubleconvertFromTo(AnalyticModel model, double optionMaturity, double optionStrike, double value, VolatilitySurface.QuotingConvention fromQuotingConvention, VolatilitySurface.QuotingConvention toQuotingConvention)Convert the value of a caplet from one quoting convention to another quoting convention.DiscountCurvegetDiscountCurve()ForwardCurvegetForwardCurve()StringgetName()Returns the name of the volatility surface.VolatilitySurface.QuotingConventiongetQuotingConvention()Return the default quoting convention of this surface.LocalDategetReferenceDate()Return the reference date of this surface, i.e. the date associated with t=0.doublegetValue(double maturity, double strike, VolatilitySurface.QuotingConvention quotingConvention)Method that returns the volatility value.doublegetValue(AnalyticModel model, double maturity, double strike, VolatilitySurface.QuotingConvention quotingConvention)Returns the price or implied volatility for the corresponding maturity and strike.
-
Constructor Details
-
CapletVolatilitySurface
public CapletVolatilitySurface(String name, LocalDate referenceDate, double[][] volatilityMatrix, double[] maturityVector, double[] strikeVector, ForwardCurve forwardCurve, VolatilitySurface.QuotingConvention volatilityConvention, DiscountCurve discountCurve)The constructor of the caplet volatility surface class. A volatility matrix is used to create the surface- Parameters:
name- The name of the surface.referenceDate- The reference date of the surface.volatilityMatrix- The matrix with caplet volatilities as entries.maturityVector- The maturities of the rows of the volatility matrix.strikeVector- The caplet strikes.forwardCurve- The forward curve.volatilityConvention- The volatility convention.discountCurve- The discount curve.
-
CapletVolatilitySurface
public CapletVolatilitySurface(String name, LocalDate referenceDate, double volatility, double[] maturityVector, double[] strikeVector, ForwardCurve forwardCurve, VolatilitySurface.QuotingConvention volatilityConvention, DiscountCurve discountCurve)The constructor of the caplet volatility surface class. A single volatility is used and all matrix entries will be that value. This constructor is used if we want to price a cap given a cap volatility.- Parameters:
name- The name of the surface.referenceDate- The reference date of the surface.volatility- The volatility.maturityVector- The maturities of the rows of the volatility matrix.strikeVector- The caplet strikes.forwardCurve- The forward curve.volatilityConvention- The volatility convention.discountCurve- The discount curve.
-
-
Method Details
-
getValue
public double getValue(double maturity, double strike, VolatilitySurface.QuotingConvention quotingConvention)Method that returns the volatility value.- Specified by:
getValuein interfaceVolatilitySurface- Parameters:
maturity- The desired maturity.strike- The desired strikequotingConvention- The desired quoting convention.- Returns:
- the volatility value for the given maturity, strike and quoting convention.
-
getValue
public double getValue(AnalyticModel model, double maturity, double strike, VolatilitySurface.QuotingConvention quotingConvention)Description copied from interface:VolatilitySurfaceReturns the price or implied volatility for the corresponding maturity and strike.- Specified by:
getValuein interfaceVolatilitySurface- Parameters:
model- An analytic model providing a context. Some curves do not need this (may be null).maturity- The option maturity for which the price or implied volatility is requested.strike- The option strike for which the price or implied volatility is requested.quotingConvention- The quoting convention to be used for the return value.- Returns:
- The price or implied volatility depending on the quoting convention.
-
getName
Description copied from interface:VolatilitySurfaceReturns the name of the volatility surface.- Specified by:
getNamein interfaceVolatilitySurface- Returns:
- The name of the volatility surface.
-
getQuotingConvention
Description copied from interface:VolatilitySurfaceReturn the default quoting convention of this surface.- Specified by:
getQuotingConventionin interfaceVolatilitySurface- Returns:
- the quotingConvention
-
getReferenceDate
Description copied from interface:VolatilitySurfaceReturn the reference date of this surface, i.e. the date associated with t=0.- Specified by:
getReferenceDatein interfaceVolatilitySurface- Returns:
- The date identified as t=0.
-
getForwardCurve
-
getDiscountCurve
-
convertFromTo
public double convertFromTo(AnalyticModel model, double optionMaturity, double optionStrike, double value, VolatilitySurface.QuotingConvention fromQuotingConvention, VolatilitySurface.QuotingConvention toQuotingConvention)Convert the value of a caplet from one quoting convention to another quoting convention.- Parameters:
model- An analytic model providing the context when fetching required market date.optionMaturity- Option maturity of the caplet.optionStrike- Option strike of the caplet.value- Value of the caplet given in the form offromQuotingConvention.fromQuotingConvention- The quoting convention of the given value.toQuotingConvention- The quoting convention requested.- Returns:
- Value of the caplet given in the form of
toQuotingConvention.
-
convertFromTo
public double convertFromTo(double optionMaturity, double optionStrike, double value, VolatilitySurface.QuotingConvention fromQuotingConvention, VolatilitySurface.QuotingConvention toQuotingConvention)Convert the value of a caplet from one quoting convention to another quoting convention.- Parameters:
optionMaturity- Option maturity of the caplet.optionStrike- Option strike of the caplet.value- Value of the caplet given in the form offromQuotingConvention.fromQuotingConvention- The quoting convention of the given value.toQuotingConvention- The quoting convention requested.- Returns:
- Value of the caplet given in the form of
toQuotingConvention.
-