Option Returns





Kerry Back

Option Data from Yahoo

import yfinance as yf
tick = yf.Ticker('aapl')
  • tick.options is the set of traded maturities
  • tick.option_chain(“some date”) is an object containing call and put data
  • tick.option_chain(“some date”).calls is a dataframe of call info
  • tick.option_chain(“some date”).puts is a dataframe of put info

Apple stock price on Feb 10, 2023

tick.history().iloc[-1].round(2)
Open                 153.77
High                 154.33
Low                  152.60
Close                153.09
Volume          14560992.00
Dividends              0.00
Stock Splits           0.00
Name: 2023-02-09 00:00:00, dtype: float64

Apple calls on Feb 10, 2023

df = tick.option_chain("2023-03-17").calls
df = df.set_index("strike")
df.iloc[:,2:5].loc[130:170]

lastPrice bid ask
strike
130.0 23.83 23.80 24.10
135.0 19.40 19.30 19.50
140.0 15.00 15.00 15.20
145.0 11.05 11.00 11.20
150.0 7.65 7.65 7.80
155.0 4.84 4.80 4.85
160.0 2.83 2.81 2.83
165.0 1.50 1.52 1.53
170.0 0.76 0.75 0.76

Possible call returns

Suppose we bought the 140 (in the money) or the 150 or the 160 (out of the money) calls at the last prices shown.

Apple puts on Feb 10, 2023

df = tick.option_chain("2023-03-17").puts
df = df.set_index("strike")
df.iloc[:,2:5].loc[130:170]

lastPrice bid ask
strike
130.0 0.57 0.55 0.56
135.0 0.92 0.91 0.92
140.0 1.52 1.50 1.51
145.0 2.52 2.54 2.55
150.0 4.10 4.05 4.10
155.0 6.55 6.30 6.35
160.0 8.95 9.30 9.50
165.0 12.89 13.00 13.20
170.0 17.35 17.20 17.55

Possible put returns

Suppose we bought the 140 (out of the money) or the 150 or the 160 (in the money) puts at the last prices shown.