Option Chains
Get the Option Chains which gives information about the currently available options as reported by Yahoo Finance. This returns the Contract Symbol, Strike Currency, Last Price, Absolute Change, Percent Change, Volume, Open Interest, Bid Pirce, Ask Price, Expiration, Last Trade Date, Implied Volatility and whether the option is In The Money.
The data comes from Yahoo Finance and is not always available. If the data is not available, it is advised to use the theoretical calculations as provided by the Black Scholes Model as well as the Greeks to get a better understanding of the option prices over time.
Also known as: calls, puts, strike prices, expiry dates, option data.
Option Chains in Python
get_option_chains is part of the Options module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_option_chains as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
option_chains = toolkit.options.get_option_chains()
option_chains.loc[('AAPL', option_chains['In The Money'] == True), :]
Which returns:
| Strike Price | Contract Symbol | Currency | Last Price | Change | Percent Change | Volume | Open Interest | Bid | Ask | Expiration | Last Trade Date | Implied Volatility | In The Money |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 155 | AAPL240112C00155000 | USD | 29.75 | 0 | 0 | 9 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 157.5 | AAPL240112C00157500 | USD | 24.15 | 0 | 0 | 1 | 0 | 0 | 0 | 2024-01-12 | 2024-01-05 | 0 | True |
| 160 | AAPL240112C00160000 | USD | 25.75 | 0 | 0 | 11 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 162.5 | AAPL240112C00162500 | USD | 18.5 | 0 | 0 | 7 | 0 | 0 | 0 | 2024-01-12 | 2024-01-05 | 0 | True |
| 165 | AAPL240112C00165000 | USD | 20.47 | 0 | 0 | 11 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 167.5 | AAPL240112C00167500 | USD | 17.22 | 0 | 0 | 1 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 170 | AAPL240112C00170000 | USD | 15.65 | 0 | 0 | 176 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 172.5 | AAPL240112C00172500 | USD | 13.19 | 0 | 0 | 34 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 175 | AAPL240112C00175000 | USD | 10.64 | 0 | 0 | 258 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 177.5 | AAPL240112C00177500 | USD | 8.3 | 0 | 0 | 489 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 180 | AAPL240112C00180000 | USD | 5.65 | 0 | 0 | 6152 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 182.5 | AAPL240112C00182500 | USD | 3.25 | 0 | 0 | 14721 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
| 185 | AAPL240112C00185000 | USD | 1.18 | 0 | 0 | 102803 | 0 | 0 | 0 | 2024-01-12 | 2024-01-11 | 0 | True |
Parameters
get_option_chains accepts the following parameters:
- expiration_date (str | None, optional): The expiration date to use. Defaults to None which means it will use the first available expiration date.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.