Market Data’s Option Chain API allows you to get real-time option chains for equities or indices. The query can be as simple or complex as you need and it is possible to sort and filter your request so that only contracts that meet your criteria are returned. You can even backtest your strategies by looking up historical option chains going back to 2005.
Our Option Chain API allows you to experiment with the AAPL ticker without registration (no API key needed). So, just click on each of the examples below to see the output in a new tab. If you find the API useful, you can register an account and get a free API key that will work for 100 requests daily so you can download option chains for other tickers.
How To Get A Live Option Chain from the API
To get a live option chain, use the endpoint without any optional parameters. So, to get a real-time quote for AAPL, just add the ticker to the endpoint.
The option chain will output the option symbol, the underlying symbol, the expiration date, the strike, whether the option is a call or a put, and when the contract was first traded. Once you obtain the option symbols in the chain, you can then send a query to the quotes API endpoint to get a quote, greeks, and other data for the contracts you need.
How To Get A Historical Option Chain from the API
To get a historical option chain, add the parameter
date to the query and the date in
YYYY-MM-DD format. So, if you needed the quote for January 6, 2020 the query would be
Option chains go back to 2005 and data is not adjusted for splits, dividends, or any other corporate actions. All data is as-traded on the date you query. So if you are backtesting options strategies on stocks that have split, make sure to keep this in mind.
Filter The Option Chain API
Sometimes you may only be interested in a specific strike, expiration, side, or moneyness. The Option Chain API includes a number of filters that let you search the chain and return only the contracts you are looking for. Best yet, multiple filters can be stacked and used together to further restrict the result, narrowing in on specific contracts that match your needs.
Filter the Option Chain API for Strike
Often times you may be looking for a specific
strike and you don’t need all the data in the chain. Instead of downloading the entire chain and filtering locally, you can query the API with a filter for strike and the API will remove contracts that don’t match your strike. For example, if you needed the option chain with the $150 strike, you could filter using
strike=150 and the API will filter out the other strikes.
Filter the Option Chain API by Side
If you only need calls or puts, you can omit the side you don’t need by filtering by side. Just use the
side parameter and request the side you need.
Filter the Option Chain API by Moneyness
Sometimes you only want in the money or out of the money options. There’s a filter for that. Combine the
range parameter with itm or otm to filter out the options you don’t want. If you just wanted in the money options for AAPL, you could use
Filter the Option Chain API by Expiration Date
There are numerous ways to filter the option chain for expirations. You can filter for a single expiration, a range of expirations, or use days to expiry to most closely match a date in the future, relative to the current date.
Filter the Option Chain API For a Single Expiration Date
Filter for expiration by using the
expiration parameter and the expiration date you need. For example,
expiration=2024-01-19 will return just the options expiring January of 2024.
Filter the Option Chain API For Expirations Between Two Dates
Let’s say you wanted to get all options expiring in the first half of 2024. You could use the
to=2024-06-30 parameters to filter out all options that don’t fall between those dates
Filter the Option Chain API For Expirations From A Specific Year or Month
year parameter to filter the chain for options that expire in a specific month or year. For example, if you use
month=1 you will get all the LEAP options for AAPL that expire in January. And if you use
year=2022 only options from 2022 will be returned, filtering out those long-term LEAP options.
Filter the Option Chain API Using A Days To Expiration (DTE) Target
Sometimes it is useful to target an expiration a fixed number of days in the future. You can use the dte parameter to accomplish this. For example, if you wanted to get the expirations for AAPL 45 days in the future, you could use
dte=45. If there is no exact match, the
dte parameter will provide the expiration that most closely matches the number of days you provide.
Filter In or Out Monthly, Quarterly, or Weekly Options As Needed
You may not want to trade quarterly options. Or perhaps you only want to trade monthly expirations. You can use the
quarterly parameters along with
false to filter these options in or out. If you use true, you will only return those options, excluding all others. If you use false, you will omit them from your results.
For example, if you wanted to exclude monthly options and get weeklies and quarterlies, set
monthly=false. You could get monthly options only and exclude both weeklies and quarterlies by using
Filter the Option Chain API By Liquidity
If you are only analyzing liquid options, it can be helpful to exclude non-liquid contracts from the chain. The API makes this easy using several liquidity filters, allowing each trader to filter options according to his or her own liquidity preferences.
Filter by Minimum Open Interest
Remove options with a low open interest using the
minOpenInterest parameter. For example, if we only wanted AAPL options with an open interest of 1000 or more, we would set
minOpenInterest=1000 and the query will remove options that don’t have many open contracts outstanding.
Filter by Minimum Volume
Remove options that are not actively traded by setting a
minVolume filter. For example, filter out AAPL options with less than 100 trades by using
Filter by Maximum Bid/Ask Spread
Sometimes it is helpful to remove options that have large bid/ask spreads due to the impossibility of closing the contracts at a profit. Use the
maxBidAskSpread parameter to filter out options that don’t offer enough liquidity. In this example, we’ll filter out AAPL contracts that have a spread larger than $0.10 by using
Filter by Maximum Bid/Ask Spread, Relative to the Underlying
Sometimes it can be helpful to filter out contracts based on the price of the underlying. A $250 stock with a $0.25 bid/ask spread may be acceptable while a $2.5 stock with a $0.25 bid/ask spread could be excessive. By pegging the bid/ask spread relative to the underlying using
maxBidAskSpreadPct, a more accurate picture of liquidity can be obtained.
In our example, we’ll use
maxBidAskSpreadPct=.1 to filter out contracts of AAPL that have a bid/ask spread higher than 0.1% of the underlying.
Stack Multiple Filters At Once To Further Refine the Option Chain API Output
Want to get all options for $150 AAPL puts for 2023? You can stack 3 filters together to do that. Set
year=2023. There is no limit to the number of filters you can stack together to filter the option chain to your exact specifications.