Skip to main content

Options

The Options module wraps the Terminal commands for the SDK layer, providing programmatic access and greater flexibility for processing data.

How to Use

The functions in the Options sub-module are listed below, along with a short description.

PathDescription
stocks.options.pcrPut-Call Ratio
stocks.options.infoOption Information
stocks.options.unuUnusual Options Activity
stocks.options.histHistorical Option Data
stocks.options.chainsOption Chain Data
stocks.options.eodchain
stocks.options.volDisplay Volume plot
stocks.options.oiDisplay open interest plot
stocks.options.voiDisplay plot of volume and open interest
stocks.options.expirationsGet Option Expirations
stocks.options.vsurfShow volatility surface

Alternatively, the contents of the menu or a function's docstrings can be printed using Python's built-in help.

help(openbb.stocks.options)

Examples

Import Statements

The examples in this section will assume these statements are included at the top of the file:

from openbb_terminal.sdk import openbb
import pandas as pd

Unusual Options

openbb.stocks.options.unu returns a DataFrame with the current day's unusual options, those having a very high volume/open interest ratio. This function returns a Tuple containing the DataFrame and a string. Unpack it like this:

unu_df,unu_ts = openbb.stocks.options.unu(limit = 500)
unu_df = unu_df.sort_values(by = 'Vol/OI', ascending = False)

unu_df
TickerExpStrikeTypeVol/OIVolOIBidAsk
0T2023-01-0621Call6185981410.030.04
1T2023-01-0619Put40.7101732500.390.42
2SCHW2023-03-1787.5Call35.143171233.23.35
3TSLA2022-12-02192.5Put31.117968857740.010.02
4FDX2022-12-09190Call29.270982430.670.69
403FCX2022-12-0936Put2.115137290.040.06
402CAT2022-12-09227.5Put2.16012800.941.14
401NKE2022-12-02111Put2.165130600.01
400NVDA2022-12-09160Put2.1866840591.061.08
425PG2022-12-09149Put2.12411130.640.69

PCR

Get up to ten years of historical Put-Call Ratios.

openbb.stocks.options.pcr(start_date = '2012-01-01', window = 10, symbol = 'SPY')
DatePCR
2012-12-05 00:00:001.1815
2012-12-06 00:00:001.7403
2012-12-07 00:00:001.7023
2012-12-10 00:00:001.8997
2012-12-11 00:00:001.5384
2022-11-28 00:00:001.2491
2022-11-29 00:00:002.135
2022-11-30 00:00:001.5901
2022-12-01 00:00:000.9842
2022-12-02 00:00:002.1346

Chains

Get the current option chain for a selected ticker. We support the following sources: YahooFinance, Nasdaq, Tradier (Sandbox) and Intrinio. Note that each API returns slightly different data fields.

openbb.stocks.options.chains(symbol = 'SPY')
contractSymboloptionTypeexpirationstrikelastPricebidaskopenInterestvolumeimpliedVolatility
0AAPL230210C00050000call2023-02-1050101.95101.15102.8153444.73438
1AAPL230210C00055000call2023-02-105596.696.1597.858134.53125
2AAPL230210C00070000call2023-02-107076.3981.182.95013.63281
3AAPL230210C00075000call2023-02-107579.4576.178.05213.50781
4AAPL230210C00080000call2023-02-108072.5571.173.05223.21094