Class 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 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 expiries
        strikes - the strikes-like data
        strikeType - the value type of the strike-like dimension
        data - the data
        dataType - 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 expiries
        strikes - the strikes-like data
        strikeType - the value type of the strike-like dimension
        data - the data
        shift - 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 expiries
        strikes - the strikes-like data
        strikeType - the value type of the strike-like dimension
        data - the data
        error - the error
        dataType - 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 expiries
        strikes - the strikes-like data
        strikeType - the value type of the strike-like dimension
        data - the data
        error - the error
        shift - 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 for RawOptionData.
        Returns:
        the meta-bean, not null
      • metaBean

        public org.joda.beans.TypedMetaBean<RawOptionData> metaBean()
        Specified by:
        metaBean in interface org.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 and error 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object