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
- standard
data: Union[list[openbb_core.provider.abstract.data.Data], openbb_core.provider.abstract.data.Data]
target: str
underlying_price: float
The price of the underlying asset.
option_type: Literal['otm', 'itm', 'calls', 'puts']
Default: otm
The type of df to display. Default is 'otm'.
dte_min: int
Minimum days to expiration (DTE) to filter options.
dte_max: int
Maximum days to expiration (DTE) to filter options.
moneyness: float
Specify a % moneyness to target for display,
strike_min: float
Minimum strike price to filter options.
strike_max: float
Maximum strike price to filter options.
oi: bool
Default: False
Filter for only options that have open interest. Default is False.
volume: bool
Default: False
Filter for only options that have trading volume. Default is False.
chart: bool
Default: False
Whether to return a chart or not. Default is False.
theme: Literal['dark', 'light']
Default: dark
The theme to use for the chart. Default is 'dark'.
chart_params: dict
Additional parameters to pass to the charting library.
target: str
Default: implied_volatility
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.