Class SabrFormulaData
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.volatility.smile.SabrFormulaData
-
- All Implemented Interfaces:
SmileModelData
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class SabrFormulaData extends Object implements SmileModelData, org.joda.beans.ImmutableBean, Serializable
The data bundle for SABR formula.The bundle contains the SABR model parameters, alpha, beta, rho and nu, as an array.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
double
getAlpha()
Gets the alpha parameter.double
getBeta()
Gets the beta parameter.double
getNu()
Obtains the nu parameters.int
getNumberOfParameters()
Obtains the number of model parameters.double
getParameter(int index)
Obtains a model parameter specified by the index.DoubleArray
getParameters()
Gets the model parameters.double
getRho()
Gets the rho parameter.int
hashCode()
boolean
isAllowed(int index, double value)
Checks the value satisfies the constraint for a model parameter.static org.joda.beans.TypedMetaBean<SabrFormulaData>
meta()
The meta-bean forSabrFormulaData
.org.joda.beans.TypedMetaBean<SabrFormulaData>
metaBean()
static SabrFormulaData
of(double[] parameters)
Obtains an instance of the SABR formula data.static SabrFormulaData
of(double alpha, double beta, double rho, double nu)
Obtains an instance of the SABR formula data.String
toString()
SabrFormulaData
with(int index, double value)
Creates a new smile model data bundle with a model parameter replaced.SabrFormulaData
withAlpha(double alpha)
Returns a copy of this instance with alpha replaced.SabrFormulaData
withBeta(double beta)
Returns a copy of this instance with beta replaced.SabrFormulaData
withNu(double nu)
Returns a copy of this instance with nu replaced.SabrFormulaData
withRho(double rho)
Returns a copy of this instance with rho replaced.
-
-
-
Method Detail
-
of
public static SabrFormulaData of(double alpha, double beta, double rho, double nu)
Obtains an instance of the SABR formula data.- Parameters:
alpha
- the alpha parameterbeta
- the beta parameterrho
- the rho parameternu
- the nu parameter- Returns:
- the instance
-
of
public static SabrFormulaData of(double[] parameters)
Obtains an instance of the SABR formula data.The parameters in the input array should be in the order of alpha, beta, rho and nu.
- Parameters:
parameters
- the parameters- Returns:
- the instance
-
getAlpha
public double getAlpha()
Gets the alpha parameter.- Returns:
- the alpha parameter
-
getBeta
public double getBeta()
Gets the beta parameter.- Returns:
- the beta parameter
-
getRho
public double getRho()
Gets the rho parameter.- Returns:
- the rho parameter
-
getNu
public double getNu()
Obtains the nu parameters.- Returns:
- the nu parameter
-
withAlpha
public SabrFormulaData withAlpha(double alpha)
Returns a copy of this instance with alpha replaced.- Parameters:
alpha
- the new alpha- Returns:
- the new data instance
-
withBeta
public SabrFormulaData withBeta(double beta)
Returns a copy of this instance with beta replaced.- Parameters:
beta
- the new beta- Returns:
- the new data instance
-
withRho
public SabrFormulaData withRho(double rho)
Returns a copy of this instance with rho replaced.- Parameters:
rho
- the new rho- Returns:
- the new data instance
-
withNu
public SabrFormulaData withNu(double nu)
Returns a copy of this instance with nu replaced.- Parameters:
nu
- the new nu- Returns:
- the new data instance
-
getNumberOfParameters
public int getNumberOfParameters()
Description copied from interface:SmileModelData
Obtains the number of model parameters.- Specified by:
getNumberOfParameters
in interfaceSmileModelData
- Returns:
- the number of model parameters
-
getParameter
public double getParameter(int index)
Description copied from interface:SmileModelData
Obtains a model parameter specified by the index.- Specified by:
getParameter
in interfaceSmileModelData
- Parameters:
index
- the index- Returns:
- the model parameter
-
isAllowed
public boolean isAllowed(int index, double value)
Description copied from interface:SmileModelData
Checks the value satisfies the constraint for a model parameter.The parameter is specified by
index
.- Specified by:
isAllowed
in interfaceSmileModelData
- Parameters:
index
- the indexvalue
- the value- Returns:
- true if allowed, false otherwise
-
with
public SabrFormulaData with(int index, double value)
Description copied from interface:SmileModelData
Creates a new smile model data bundle with a model parameter replaced.The parameter is specified by
index
and replaced byvalue
.- Specified by:
with
in interfaceSmileModelData
- Parameters:
index
- the indexvalue
- the value- Returns:
- the new bundle
-
meta
public static org.joda.beans.TypedMetaBean<SabrFormulaData> meta()
The meta-bean forSabrFormulaData
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<SabrFormulaData> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getParameters
public DoubleArray getParameters()
Gets the model parameters.This must be an array of length 4. The parameters in the array are in the order of alpha, beta, rho and nu. The constraints for the parameters are defined in
isAllowed(int, double)
.- Returns:
- the value of the property, not null
-
-