Understanding Stock Options Data
The key fields in options data, including general info, market activity, open interest, and Greeks.
Are you wondering what options are and how they differ from stocks?
Options are financial derivatives that give the holder the right, but not the obligation, to buy or sell an underlying asset (such as a stock) at a specific price within a set timeframe. Unlike stocks, which represent ownership, options are contracts. — Investopedia
Still curious? Let’s break it down further.
Derivatives are financial contracts whose value is based on the performance of an underlying asset, like stocks, bonds, commodities, currencies, or indices. They allow investors to speculate on price changes, hedge risks, or access assets without direct ownership. Examples include options, futures, swaps, and forwards. — CFA Institute
Simplifying the Concepts
- Options as Vouchers: Imagine paying £200 for the right to buy a car worth £10,000 within 30 days. If the car’s value rises to £12,000, you can buy it at £10,000, making a profit. If the value drops to £8,000, you can skip the purchase but lose the £200. Options give you flexibility without obligation.
- Derivatives as Value Mirrors: Like a concert ticket’s worth depends on the concert’s popularity, derivatives derive their value from an asset’s performance. In finance, these assets could be stocks, gold, or currencies.
Exploring the US Stock Options Data API
EODHD APIs recently launched their US Stock Options Data API, a significant addition to their marketplace. This API provides valuable data for traders and analysts interested in options.
Let’s dive in and see what this API has to offer!
Understanding Options Terminology
Call: A call option grants the buyer the right, but not the obligation, to purchase the underlying stock at a specified strike price on or before the expiration date. This is typically used when the buyer expects the stock price to rise.
Put: A put option gives the buyer the right, but not the obligation, to sell the underlying stock at a specified strike price on or before the expiration date. It is generally used when the buyer anticipates a decline in the stock price.
Strike Price: The predetermined price at which the buyer of a call or put option can exercise their right to buy or sell the stock. It plays a key role in determining the option’s value in relation to the market price.
Expiration Date: The deadline by which the option must be exercised. After this date, the option becomes worthless. Since options are time-sensitive, their value diminishes as the expiration date nears.
Premium: The cost paid by the buyer to the seller (writer) for the option contract. The premium is influenced by factors such as the stock price, strike price, time until expiration, and volatility.
Implied Volatility: This measures the market’s expectation of potential stock price movements over the option’s lifespan. Higher implied volatility suggests greater uncertainty and usually leads to higher premiums.
Bid/Ask: The bid is the price a buyer is willing to pay, while the ask is the price a seller is willing to accept for the option. The difference between the two is the transaction cost.
In-the-Money (ITM): A call is ITM if the stock price is above the strike price. A put is ITM if the stock price is below the strike price.
Out-of-the-Money (OTM): A call is OTM if the stock price is below the strike price. A put is OTM if the stock price is above the strike price.
At-the-Money (ATM): An option is ATM when the stock price equals the strike price.
Let’s Dive In…
To explore the API, we’ll need some code to access it and examine the data. Using an “.env” file is recommended to securely pass your API token. The file should contain a single line:
EODHD_API_TOKEN=<YOUR_TOKEN_HERE>
import os
import requests
import pandas as pd
from dotenv import load_dotenv
load_dotenv()
api_token = os.getenv("EODHD_API_TOKEN")
def get_options_data(market: str, from_date: str, to_date: str):
base_url = "https://eodhd.com/api/v2/options/"
market = f"{market}"
url = f"{base_url}{market}?from={from_date}&to={to_date}&api_token={api_token}"
print(url)
try:
response = requests.get(url, timeout=10)
response.raise_for_status()
json_response = response.json()
if "data" in json_response:
data = json_response["data"]
else:
return None
if "error" in data:
print(f"API Error: {data['error']}")
return None
df = pd.DataFrame(data)
return df
except requests.exceptions.Timeout:
print("Error: The request timed out. Please try again later.")
except requests.exceptions.ConnectionError:
print("Error: Could not connect to the API. Check your network connection.")
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
except requests.exceptions.RequestException as err:
print(f"An unexpected error occurred: {err}")
except ValueError:
print("Error: Failed to parse JSON response.")
return None
if __name__ == "__main__":
market = "AAPL.US"
from_date = "2024-01-10"
to_date = "2024-01-19"
options_df = get_options_data(market, from_date, to_date)
if not options_df.empty:
print(options_df)
The data retrieved from the API should resemble the following structure:
The data includes several fields, which I’ll explain in detail shortly. However, one notable feature of the API is its web-friendly pagination with page limit and offset parameters.
If you’re unfamiliar, this feature makes it simple to implement pagination on websites, allowing for faster data retrieval and rendering.
Here’s an example:
- To fetch the first 100 rows, you set the API limit to 100 and the offset to 0.
- For “page 2”, you set the offset to 100, which retrieves the next 100 rows starting from row 101.
This approach significantly enhances usability, especially when working with large datasets on web pages. For instance, integrating it with a JavaScript Bootstrap table can improve performance and user experience.
We appreciate this feature and hope it becomes standard across other API endpoints as well.
Inspecting the Data
The API response consists of three main fields: “meta”, “data”, and “links”.
The “meta” field provides metadata about the response and looks like this:
"meta": {
"from": "2024-01-10",
"to": "2024-01-19",
"offset": 0,
"limit": 1000,
"total": 11450
}
“data” looks like this:
{
"symbol": "AAPL240112P00245000",
"underlying_symbol": "AAPL",
"data_date": "2023-12-15",
"date": "2024-01-12",
"expiration_type": "weekly",
"type": "put",
"strike": 245,
"exchange": "NASDAQ",
"currency": "USD",
"open": null,
"high": null,
"low": null,
"last": null,
"last_size": null,
"change": null,
"pctchange": null,
"previous": null,
"previous_date": null,
"bid": 47.4,
"bid_date": "2023-12-15 14:59:59",
"bid_size": 50,
"ask": 48.25,
"ask_date": "2023-12-15 14:59:59",
"ask_size": 50,
"moneyness": null,
"volume": null,
"volume_change": null,
"volume_pctchange": null,
"open_interest": null,
"open_interest_change": null,
"open_interest_pctchange": null,
"volatility": 0.5169,
"volatility_change": null,
"volatility_pctchange": null,
"theoretical": 47.83,
"delta": -0.937793,
"gamma": 0.004625,
"theta": -0.048261,
"vega": 0.063971,
"rho": -0.071055,
"tradetime": "2023-12-15",
"vol_oi_ratio": null,
"dte": null,
"midpoint": null
}
And “links” looks like this:
"links": {
"next": "https://eodhd.com/api/v2/options/AAPL.US?from=2024-01-10&to=2024-01-19&page[offset]=1000&page[limit]=1000"
}
The “data” Field
The “data” field is particularly interesting because it includes many fields that may be unfamiliar. After researching on Investopedia, we grouped the related fields together to provide clarity:
General Information (related to the Option)
These fields describe the option itself:
symbol
: Unique identifier for the option (e.g., “AAPL240112P00245000”).
Format: Underlying Symbol + Expiry Date + Type (P=Put, C=Call) + Strike Price.underlying_symbol
: The stock or asset on which the option is based (e.g., “AAPL” for Apple).data_date
: The date this data was recorded (e.g., “2023-12-15”).date
: The option’s expiry date (e.g., “2024-01-12”).expiration_type
: Specifies if the option expires weekly or monthly.type
: Indicates whether it is a put (right to sell) or call (right to buy).strike
: The strike price, or the price at which the option grants the right to buy/sell the underlying asset (e.g., $245).exchange
: The exchange where the option trades (e.g., “NASDAQ”).currency
: The currency used for the option (e.g., “USD”).
Price and Market Data
These fields pertain to option prices and trading activity:
bid
: The highest price someone is willing to pay for the option (e.g., $47.4).bid_date
: Date and time of the bid data (e.g., “2023-12-15 14:59:59”).bid_size
: Number of contracts available at the bid price (e.g., 50 contracts).ask
: The lowest price someone is willing to sell the option for (e.g., $48.25).ask_date
: Date and time of the ask data.ask_size
: Number of contracts available at the ask price (e.g., 50 contracts).last
: The most recent price at which the option traded (e.g., null if no trades occurred).last_size
: Size (number of contracts) of the last trade.change
/pctchange
: Price change and percentage change from the previous day’s close (null if unavailable).previous
: The previous closing price of the option.volume
: Number of option contracts traded so far (null if no trades occurred).volume_change
/volume_pctchange
: Change in trading volume.
Open Interest (OI)
Open interest reflects the total number of outstanding contracts that have not been settled:
open_interest
: Total number of open contracts for this option (null if no data is available).open_interest_change
/open_interest_pctchange
: Change in open interest from the previous day.vol_oi_ratio
: Ratio of trading volume to open interest, indicating how active the option is relative to its outstanding contracts.
Volatility and Theoretical Value
These fields provide insights into the option’s potential movement and value:
volatility
: Implied volatility (0.5169) reflects the market’s expectation of price movement for the underlying asset.volatility_change
/volatility_pctchange
: Change in implied volatility over time.theoretical
: The model-based theoretical price of the option ($47.83).
The Greeks
The Greeks measure an option’s sensitivity to various market factors:
delta
: The expected change in the option’s price for a $1 move in the underlying asset.
For put options, deltas are negative. For example, -0.937793 means the option price decreases by approximately 94 cents for every $1 increase in the asset price.gamma
: The rate of change in delta for a $1 move in the underlying asset (0.004625 indicates a small change in delta).theta
: Time decay, indicating how much the option price decreases daily as expiration nears.
A theta of -0.048261 means the option loses about 4.8 cents daily.vega
: Sensitivity to changes in implied volatility.
For instance, 0.063971 indicates the option price rises by approximately 6.4 cents for every 1% increase in volatility.rho
: Sensitivity to interest rate changes.
A rho of -0.071055 means a 1% interest rate increase would decrease the option price by about 7.1 cents.
Additional Fields
moneyness
: Describes whether the option is:
In the Money (ITM): Profitable if exercised.
At the Money (ATM): Equal to the strike price.
Out of the Money (OTM): Unprofitable if exercised.
Currently, this field is null, but it helps traders evaluate the option’s value relative to the stock price.dte
: Days to expiration, showing the time remaining before the option expires.midpoint
: The average of the bid and ask prices, often used as an estimated fair price.
Summary
- General Info: Provides details to identify the option (symbol, type, expiry, strike price).
- Market Data: Offers insights into trading prices and activity.
- Open Interest: Helps gauge market sentiment and liquidity.
- Volatility and Greeks: Assesses risk, price movement, and sensitivity to time, stock price changes, or volatility.
While there’s a lot of data, it’s all valuable. This structure supports traders in making decisions about whether an option is undervalued, whether to hedge a position, or how quickly an option might lose value due to time decay.
Technical Analysis & Options Strategies
Many technical indicators for stock and crypto markets can also be applied to options, offering options-specific insights.
There are also tools tailored to options, such as:
- Options Chains
- Greek Analysis
- Volatility Tools
These could make great tutorial topics.
Additionally, some options-specific strategies worth exploring include:
- Beginner Strategies: Long Call, Long Put, Covered Call.
- Advanced Strategies: Straddle, Strangle, Vertical Spreads, Iron Condor.
Subscribe and don’t miss what’s next!
Please note that this article is for informational purposes only and should not be taken as financial advice. We do not bear responsibility for any trading decisions made based on the content of this article. Readers are advised to conduct their own research or consult with a qualified financial professional before making any investment decisions.
For those eager to delve deeper into such insightful articles and broaden their understanding of different strategies in financial markets, we invite you to follow our account and subscribe for email notifications.
Stay tuned for more valuable articles that aim to enhance your data science skills and market analysis capabilities.