java.lang.Object
net.finmath.marketdata.model.volatilities.SwaptionDataLattice
- All Implemented Interfaces:
Serializable
Saves market data of swaption on a lattice of option maturity x swap tenor x option moneyness.
Moneyness in terms of basispoints relative to par swap rate.
Access to the tenor grid is given via a variety of options:
- double, as year fraction, rounded to a monthly precision.
- int, as an offset in months.
- String, as code for the offset in the format '6M10Y'.
- Author:
- Christian Fries, Roland Bachl
- See Also:
- Serialized Form
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Quoting convention for swaption data in a lattice. -
Constructor Summary
ConstructorsConstructorDescriptionSwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, double[] maturities, double[] tenors, double[] moneynesss, double[] values)
Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, int[] maturitiesInMonths, int[] tenorsInMonths, int[] moneynessBP, double[] values)
Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, String[] tenorCodes, int[] moneynessBP, double[] values)
Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, double[] maturities, double[] tenors, double[] moneynesss, double[] values)
Create the lattice.SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, int[] maturitiesInMonths, int[] tenorsInMonths, int[] moneynessBP, double[] values)
Create the lattice.SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, String[] tenorCodes, int[] moneynessBP, double[] values)
Create the lattice. -
Method Summary
Modifier and TypeMethodDescriptionappend(SwaptionDataLattice other, AnalyticModel model)
Append the data of another lattice to this lattice.boolean
containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP)
Returns true if the lattice contains an entry at the specified location.convertLattice(SwaptionDataLattice.QuotingConvention targetConvention, double displacement, AnalyticModel model)
Convert this lattice to store data in the given convention.convertLattice(SwaptionDataLattice.QuotingConvention targetConvention, AnalyticModel model)
Convert this lattice to store data in the given convention.double
Get a view of the locations of swaptions in this lattice.int[]
Return all maturities for which data exists.double[]
getMaturities(double moneyness)
Return all valid maturities for a given moneyness.int[]
getMaturities(int moneynessBP)
Return all valid maturities for a given moneyness.int[]
Return all levels of moneyness for which data exists.double[]
Return all levels of moneyness for which data exists.Get a view of the locations of swaptions in this lattice.int[]
Return all tenors for which data exists.double[]
getTenors(double moneyness, double maturity)
Return all valid tenors for a given moneyness and maturity.int[]
getTenors(int moneynessBP, int maturityInMonths)
Return all valid tenors for a given moneyness and maturity.double
getValue(double maturity, double tenor, double moneyness)
Return the value in the quoting convention of this lattice.double
getValue(double maturity, double tenor, double moneyness, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)
Return the value in the given quoting convention.double
getValue(int maturityInMonths, int tenorInMonths, int moneynessBP)
Return the value in the quoting convention of this lattice.double
getValue(int maturityInMonths, int tenorInMonths, int moneynessBP, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)
Return the value in the given quoting convention.double
Return the value in the quoting convention of this lattice.double
getValue(String tenorCode, int moneynessBP, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)
Return the value in the given quoting convention.int
size()
toString()
-
Constructor Details
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, double[] maturities, double[] tenors, double[] moneynesss, double[] values)Create the lattice.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.maturities
- The maturities of the options as year fraction from the reference date.tenors
- The tenors of the swaps as year fraction from the reference date.moneynesss
- The moneyness' as actual difference of strike to par swap rate.values
- The values to be stored.
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, int[] maturitiesInMonths, int[] tenorsInMonths, int[] moneynessBP, double[] values)Create the lattice.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.maturitiesInMonths
- The maturities of the options as offset in months from the reference date.tenorsInMonths
- The tenors of the swaps as offset in months from the option maturity.moneynessBP
- The moneyness' in basis points on the par swap rate.values
- The values to be stored.
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, String[] tenorCodes, int[] moneynessBP, double[] values)Create the lattice.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.tenorCodes
- The schedules of the swaptions encoded in the format '6M10Y'moneynessBP
- The moneyness' in basis points on the par swap rate.values
- The values to be stored.
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, int[] maturitiesInMonths, int[] tenorsInMonths, int[] moneynessBP, double[] values)Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.displacement
- The displacement used the implied lognormal volatilities.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.maturitiesInMonths
- The maturities of the options as offset in months from the reference date.tenorsInMonths
- The tenors of the swaps as offset in months from the option maturity.moneynessBP
- The moneyness' in basis points on the par swap rate.values
- The values to be stored.
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, double[] maturities, double[] tenors, double[] moneynesss, double[] values)Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.displacement
- The displacement used the implied lognormal volatilities.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.maturities
- The maturities of the options as year fraction from the reference date.tenors
- The tenors of the swaps as year fraction from the reference date.moneynesss
- The moneyness' as actual difference of strike to par swap rate.values
- The values to be stored.
-
SwaptionDataLattice
public SwaptionDataLattice(LocalDate referenceDate, SwaptionDataLattice.QuotingConvention quotingConvention, double displacement, String forwardCurveName, String discountCurveName, SchedulePrototype floatMetaSchedule, SchedulePrototype fixMetaSchedule, String[] tenorCodes, int[] moneynessBP, double[] values)Create the lattice withSwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.- Parameters:
referenceDate
- The reference date of the swaptions.quotingConvention
- The quoting convention of the data.displacement
- The displacement used the implied lognormal volatilities.forwardCurveName
- The name of the forward curve associated with these swaptions.discountCurveName
- The name of the discount curve associated with these swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.tenorCodes
- The schedules of the swaptions encoded in the format '6M10Y'moneynessBP
- The moneyness' in basis points on the par swap rate.values
- The values to be stored.
-
-
Method Details
-
convertLattice
public SwaptionDataLattice convertLattice(SwaptionDataLattice.QuotingConvention targetConvention, AnalyticModel model)Convert this lattice to store data in the given convention. Conversion involving receiver premium assumes zero wide collar.- Parameters:
targetConvention
- The convention to store the data in.model
- The model for context.- Returns:
- The converted lattice.
-
convertLattice
public SwaptionDataLattice convertLattice(SwaptionDataLattice.QuotingConvention targetConvention, double displacement, AnalyticModel model)Convert this lattice to store data in the given convention. Conversion involving receiver premium assumes zero wide collar.- Parameters:
targetConvention
- The convention to store the data in.displacement
- The displacement to use, if applicable.model
- The model for context.- Returns:
- The converted lattice.
-
append
Append the data of another lattice to this lattice. If the other lattice follows a different quoting convention, it is automatically converted. However, this method does not check, whether the two lattices are aligned in terms of reference date, curve names and meta schedules. If the two lattices have shared data points, the data from this lattice will be overwritten.- Parameters:
other
- The lattice containing the data to be appended.model
- The model to use for context, in case the other lattice follows a different convention.- Returns:
- The lattice with the combined swaption entries.
-
getGridNodesPerMoneyness
Get a view of the locations of swaptions in this lattice. The keys of the map are the levels of moneyness for which there are swaptions, sorted in ascending order. The entries for each moneyness consist of an array of arrays { maturities, tenors }, each sorted in ascending order. Note, there is no guarantee for the grid per moneyness to be regular. Hence, getValue may still throw a NullPointerException, even when using entries from this view.- Returns:
- The view of recorded swaptions.
-
getMoneynessPerGridNode
Get a view of the locations of swaptions in this lattice. The keys of the map are pairs of maturities and tenors for which there are swaptions. The entries for each pair consist of an array of possible moneyness values, sorted in ascending order.- Returns:
- The view of recorded swaptions.
-
getMoneyness
public int[] getMoneyness()Return all levels of moneyness for which data exists.- Returns:
- The levels of moneyness in bp.
-
getMoneynessAsOffsets
public double[] getMoneynessAsOffsets()Return all levels of moneyness for which data exists. Moneyness is returned as actual difference strike - par swap rate.- Returns:
- The levels of moneyness as difference of strike to par swap rate.
-
getMaturities
public int[] getMaturities()Return all maturities for which data exists.- Returns:
- The maturities in months.
-
getMaturities
public int[] getMaturities(int moneynessBP)Return all valid maturities for a given moneyness.- Parameters:
moneynessBP
- The moneyness in bp for which to get the maturities.- Returns:
- The maturities in months.
-
getMaturities
public double[] getMaturities(double moneyness)Return all valid maturities for a given moneyness. Uses the fixing times of the fix schedule to determine fractions.- Parameters:
moneyness
- The moneyness as actual offset from par swap rate for which to get the maturities.- Returns:
- The maturities as year fraction from reference date.
-
getTenors
public int[] getTenors()Return all tenors for which data exists.- Returns:
- The tenors in months.
-
getTenors
public int[] getTenors(int moneynessBP, int maturityInMonths)Return all valid tenors for a given moneyness and maturity.- Parameters:
moneynessBP
- The moneyness in bp for which to get the tenors.maturityInMonths
- The maturities in months for which to get the tenors.- Returns:
- The tenors in months.
-
getTenors
public double[] getTenors(double moneyness, double maturity)Return all valid tenors for a given moneyness and maturity. Uses the payment times of the fix schedule to determine fractions.- Parameters:
moneyness
- The moneyness as actual offset from par swap rate for which to get the maturities.maturity
- The maturities as year fraction from the reference date.- Returns:
- The tenors as year fraction from reference date.
-
containsEntryFor
public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP)Returns true if the lattice contains an entry at the specified location.- Parameters:
maturityInMonths
- The maturity in months to check.tenorInMonths
- The tenor in months to check.moneynessBP
- The moneyness in bp to check.- Returns:
- True iff there is an entry at the specified location.
-
getValue
public double getValue(double maturity, double tenor, double moneyness)Return the value in the quoting convention of this lattice.- Parameters:
maturity
- The maturity of the option as year fraction from the reference date.tenor
- The tenor of the swap as year fraction from the reference date.moneyness
- The moneyness as actual difference of strike to par swap rate.- Returns:
- The value as stored in the lattice.
-
getValue
public double getValue(int maturityInMonths, int tenorInMonths, int moneynessBP)Return the value in the quoting convention of this lattice.- Parameters:
maturityInMonths
- The maturity of the option as offset in months from the reference date.tenorInMonths
- The tenor of the swap as offset in months from the option maturity.moneynessBP
- The moneyness in basis points on the par swap rate.- Returns:
- The value as stored in the lattice.
-
getValue
Return the value in the quoting convention of this lattice.- Parameters:
tenorCode
- The schedule of the swaption encoded in the format '6M10Y'moneynessBP
- The moneyness in basis points on the par swap rate.- Returns:
- The value as stored in the lattice.
-
getValue
public double getValue(double maturity, double tenor, double moneyness, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)Return the value in the given quoting convention. Conversion involving receiver premium assumes zero wide collar.- Parameters:
maturity
- The maturity of the option as year fraction from the reference date.tenor
- The tenor of the swap as year fraction from the reference date.moneyness
- The moneyness as actual difference of strike to par swap rate.convention
- The desired quoting convention.displacement
- The displacement to be used, if converting to log normal implied volatility.model
- The model for context.- Returns:
- The value converted to the convention.
-
getValue
public double getValue(int maturityInMonths, int tenorInMonths, int moneynessBP, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)Return the value in the given quoting convention. Conversion involving receiver premium assumes zero wide collar.- Parameters:
maturityInMonths
- The maturity of the option as offset in months from the reference date.tenorInMonths
- The tenor of the swap as offset in months from the option maturity.moneynessBP
- The moneyness in basis points on the par swap rate, as understood in the original convention.convention
- The desired quoting convention.displacement
- The displacement to be used, if converting to log normal implied volatility.model
- The model for context.- Returns:
- The value converted to the convention.
-
getValue
public double getValue(String tenorCode, int moneynessBP, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel model)Return the value in the given quoting convention. Conversion involving receiver premium assumes zero wide collar.- Parameters:
tenorCode
- The schedule of the swaption encoded in the format '6M10Y'moneynessBP
- The moneyness in basis points on the par swap rate, as understood in the original convention.convention
- The desired quoting convention.displacement
- The displacement to be used, if converting to log normal implied volatility.model
- The model for context.- Returns:
- The value converted to the convention.
-
size
public int size()- Returns:
- The number of entries in the lattice.
-
getReferenceDate
- Returns:
- The reference date of the swaptions.
-
getQuotingConvention
- Returns:
- The quoting convention used to store data.
-
getDisplacement
public double getDisplacement()- Returns:
- The displacement, used in case of
SwaptionDataLattice.QuotingConvention
.PAYERVOLATILITYLOGNORMAL
.
-
getForwardCurveName
- Returns:
- The name of the forward curve for these swaptions.
-
getDiscountCurveName
- Returns:
- The name of the discount curve for these swaptions.
-
getFloatMetaSchedule
- Returns:
- The schedule meta data for the float leg of the swaptions.
-
getFixMetaSchedule
- Returns:
- The schedule meta data for the fix leg of the swaptions.
-
toString
-