Skip to main content

surface

Filter and process the options chains data for volatility.

Data posted can be an instance of OptionsChainsData, a pandas DataFrame, or a list of dictionaries. Data should contain the fields:

  • expiration: The expiration date of the option.
  • strike: The strike price of the option.
  • option_type: The type of the option (call or put).
  • implied_volatility: The implied volatility of the option. Or 'target' field.
  • open_interest: The open interest of the option.
  • volume: The trading volume of the option.
  • dte : Optional, days to expiration (DTE) of the option.
  • underlying_price: Optional, the price of the underlying asset.

Results from the /derivatives/options/chains endpoint are the preferred input.

If underlying_price is not supplied in the data as a field, it must be provided as a parameter.

Examples

from openbb import obb
# Filter and process options chains data for volatility.
data = obb.derivatives.options.chains('AAPL', provider='cboe')
surface = obb.derivatives.options.surface(data=data.results, moneyness=20, dte_min=10, dte_max=60, chart=True)
surface.show()

Parameters

data: Union[list[openbb_core.provider.abstract.data.Data], openbb_core.provider.abstract.data.Data]

target: str

Optional: False


underlying_price: float

The price of the underlying asset.

Optional: True


option_type: Literal['otm', 'itm', 'calls', 'puts']

The type of df to display. Default is 'otm'.

Default: otm

Optional: True


dte_min: int

Minimum days to expiration (DTE) to filter options.

Optional: True


dte_max: int

Maximum days to expiration (DTE) to filter options.

Optional: True


moneyness: float

Specify a % moneyness to target for display,

Optional: True


strike_min: float

Minimum strike price to filter options.

Optional: True


strike_max: float

Maximum strike price to filter options.

Optional: True


oi: bool

Filter for only options that have open interest. Default is False.

Default: False

Optional: True


volume: bool

Filter for only options that have trading volume. Default is False.

Default: False

Optional: True


chart: bool

Whether to return a chart or not. Default is False.

Default: False

Optional: False


theme: Literal['dark', 'light']

The theme to use for the chart. Default is 'dark'.

Default: dark

Optional: True


chart_params: dict

Additional parameters to pass to the charting library.

Optional: True


target: str


Returns

results: list[list]

Serializable results.


provider: None

Provider name.


warnings: Optional[list[Warning_]]

list of warnings.


chart: Optional[Chart]

Chart object.


extra: dict[str, Any]

Extra info.