Market Data Logo
api
Last Update: February 20, 2024

How To Use The Option Data API — With Examples!

The Option Data API allows you to easily get a real-time or historical option quote for stock, ETF, or index options.

Market Data’s Option Data API allows you to get real-time option quotes for stock options, ETF options, and index options. The query is very simple to use and only requires that you know the option symbol. Historical quotes are also available going back to 2005, which will allow you to easily see how prices have evolved over time. You can also get multiple days’ quotes in a single API request, perfect for charting.

You can experiment with the Option Data API using the AAPL ticker with no registration (no API key needed). Use your browser to click on each of the examples shown to see the API’s output. If you find the API useful, you can register a free account and get a token that will allow you to get 100 requests daily so you can download option quotes for other tickers.

Endpoint: https://api.marketdata.app/v1/options/quotes/{OptionSymbol}

Endpoint Docs: https://docs.marketdata.app/api/options/quotes

Throughout this example, we’ll add the dateformat=timestamp parameter to each link so that you can click the examples and read the dates & times in human-readable format. However, the default date/time output of the API is unix format. Omit the dateformat=timestamp parameter and you can see the output in seconds after the Unix epoch.

How To Get A Live Option Quote from the API

To get a real-time option quote, use the endpoint without any optional parameters. So, to get a real-time quote for a January 2025 $150 AAPL Call, just add the AAPL250117C00150000 option symbol to the endpoint.

Example: https://api.marketdata.app/v1/options/quotes/AAPL250117C00150000/

The Option Data API will output a full level 1 quote including: bid, ask, bid size, ask size, mid price, last price, open interest, volume, implied volatility, full greeks, plus intrinsic/extrinsic value calculations, and whether the option is in the money.

How To Get Historical Option Data from the API

To get historical option data, add the parameter date to the query and the date in YYYY-MM-DD format. So, if you needed the quote for January 18, 2023 the query would be date=2023-01-18.

Option quotes 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 since split or paid dividends, make sure to keep this in mind and adjust accordingly.

Example: https://api.marketdata.app/v1/options/quotes/AAPL250117C00150000/?date=2023-01-18

How To Get A Series of Historical Option Quotes from the API

There’s no need to query the historical data day by day. Use the to and from parameters to return a series of historical data points over multiple days. The to and from parameters are an alternative to the date parameter. Use one or the other, but not both.

Example: https://api.marketdata.app/v1/options/quotes/AAPL250117C00150000/?from=2023-01-01&to=2023-01-31

Get The Options Quote API To Output Data as a Spreadsheet

Add the optional parameter format=csv and the API will output a CSV file that can be downloaded into your favorite spreadsheet application. Add dateformat=spreadsheet and the API will output all dates in spreadsheet format as well, allowing you to easily convert that column to a date in Excel or any other spreadsheet software with a single click.

Example: https://api.marketdata.app/v1/options/quotes/AAPL250117C00150000/?from=2023-01-01&to=2023-01-31&format=csv&dateformat=spreadsheet

How To Filter The Option Quote API and Remove Unwanted Data Points

Using the columns parameter you can filter out unwanted data and request only the data points you need. Let’s suppose you’re building a mobile app with very limited screen space and you’d like to keep bandwidth to a minimum. You only want to display the midpoint price for an option and nothing else. You can request this using columns=mid and all other data will be filtered out and excluded from the response.

Example: https://api.marketdata.app/v1/options/quotes/AAPL250117C00150000/?columns=mid

On this page
    Add a header to begin generating the table of contents
    Share this article
    Comments & Questions
    Shopping Basket
    //