Class RawOptionData

  • All Implemented Interfaces:
    java.io.Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class RawOptionData
    extends java.lang.Object
    implements org.joda.beans.ImmutableBean, java.io.Serializable
    Raw data from the volatility market.
    See Also:
    Serialized Form
    • Method Detail

      • of

        public static RawOptionData of​(java.util.List<java.time.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​(java.util.List<java.time.Period> expiries,
                                                      DoubleArray strikes,
                                                      ValueType strikeType,
                                                      DoubleMatrix data,
                                                      java.lang.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​(java.util.List<java.time.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​(java.util.List<java.time.Period> expiries,
                                                      DoubleArray strikes,
                                                      ValueType strikeType,
                                                      DoubleMatrix data,
                                                      DoubleMatrix error,
                                                      java.lang.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​(java.time.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<java.time.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 java.util.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 java.util.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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object