Class RawOptionData
- java.lang.Object
-
- com.opengamma.strata.pricer.option.RawOptionData
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class RawOptionData extends Object implements org.joda.beans.ImmutableBean, Serializable
Raw data from the volatility market.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<DoubleArray,DoubleArray>
availableSmileAtExpiry(Period expiry)
For a given expiration returns all the data available.boolean
equals(Object obj)
DoubleMatrix
getData()
Gets the data.ValueType
getDataType()
Gets the type of the raw data.Optional<DoubleMatrix>
getError()
Gets the measurement error of the option data.ImmutableList<Period>
getExpiries()
Gets the expiry values.OptionalDouble
getShift()
Gets the shift for which the raw data is valid.DoubleArray
getStrikes()
Gets the strike values.ValueType
getStrikeType()
Gets the value type of the strike-like dimension.int
hashCode()
static org.joda.beans.TypedMetaBean<RawOptionData>
meta()
The meta-bean forRawOptionData
.org.joda.beans.TypedMetaBean<RawOptionData>
metaBean()
static RawOptionData
of(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, DoubleMatrix error, ValueType dataType)
Obtains an instance of the raw data with error.static RawOptionData
of(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, ValueType dataType)
Obtains an instance of the raw volatility.static RawOptionData
ofBlackVolatility(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, DoubleMatrix error, Double shift)
Obtains an instance of the raw data with error for shifted Black (log-normal) volatility.static RawOptionData
ofBlackVolatility(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, Double shift)
Obtains an instance of the raw volatility for shifted Black (log-normal) volatility.String
toString()
-
-
-
Method Detail
-
of
public static RawOptionData of(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, ValueType dataType)
Obtains an instance of the raw volatility.The data values can be model parameters (like Black or normal volatilities) or direct option prices.
- Parameters:
expiries
- the expiriesstrikes
- the strikes-like datastrikeType
- the value type of the strike-like dimensiondata
- the datadataType
- the data type- Returns:
- the instance
-
ofBlackVolatility
public static RawOptionData ofBlackVolatility(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, Double shift)
Obtains an instance of the raw volatility for shifted Black (log-normal) volatility.- Parameters:
expiries
- the expiriesstrikes
- the strikes-like datastrikeType
- the value type of the strike-like dimensiondata
- the datashift
- the shift- Returns:
- the instance
-
of
public static RawOptionData of(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, DoubleMatrix error, ValueType dataType)
Obtains an instance of the raw data with error.The data values can be model parameters (like Black or normal volatilities) or direct option prices.
- Parameters:
expiries
- the expiriesstrikes
- the strikes-like datastrikeType
- the value type of the strike-like dimensiondata
- the dataerror
- the errordataType
- the data type- Returns:
- the instance
-
ofBlackVolatility
public static RawOptionData ofBlackVolatility(List<Period> expiries, DoubleArray strikes, ValueType strikeType, DoubleMatrix data, DoubleMatrix error, Double shift)
Obtains an instance of the raw data with error for shifted Black (log-normal) volatility.- Parameters:
expiries
- the expiriesstrikes
- the strikes-like datastrikeType
- the value type of the strike-like dimensiondata
- the dataerror
- the errorshift
- the shift- Returns:
- the instance
-
availableSmileAtExpiry
public Pair<DoubleArray,DoubleArray> availableSmileAtExpiry(Period expiry)
For a given expiration returns all the data available.- Parameters:
expiry
- the expiration- Returns:
- the strikes and related volatilities for all available data at the given expiration
-
meta
public static org.joda.beans.TypedMetaBean<RawOptionData> meta()
The meta-bean forRawOptionData
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<RawOptionData> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getExpiries
public ImmutableList<Period> getExpiries()
Gets the expiry values.- Returns:
- the value of the property, not null
-
getStrikes
public DoubleArray getStrikes()
Gets the strike values. Can be directly strike or moneyness (simple or log)- Returns:
- the value of the property, not null
-
getStrikeType
public ValueType getStrikeType()
Gets the value type of the strike-like dimension.- Returns:
- the value of the property, not null
-
getData
public DoubleMatrix getData()
Gets the data. The values can be model parameters (like Black or normal volatilities) or direct option prices. The first (outer) dimension is the expiry, the second dimension is the strike. A 'NaN' value indicates that the data is not available.- Returns:
- the value of the property, not null
-
getError
public Optional<DoubleMatrix> getError()
Gets the measurement error of the option data.These will be used if the option data is calibrated by a least square method.
data
anderror
must have the same number of elements.- Returns:
- the optional value of the property, not null
-
getDataType
public ValueType getDataType()
Gets the type of the raw data.- Returns:
- the value of the property, not null
-
getShift
public OptionalDouble getShift()
Gets the shift for which the raw data is valid. Used only if the dataType is 'BlackVolatility'.- Returns:
- the optional value of the property, not null
-
-