QuantConnect
Equity Options
Introduction
Download the US Equity Options dataset to your local machine. You can download the full dataset in bulk to avoid selection bias or download individual tickers to keep the cost low. The dataset contains trade, quote, and open interest data for every ticker and trading day.
To use the CLI, you must be a member in an organization on a paid tier.
Prerequisites
The US Equity Options dataset depends on the following datasets:
- US Equity Security Master - data on splits, dividends, and symbol changes.
- US Equity Option Universe - data on the available contracts and their daily Greeks and implied volatility values.
- US Equities - trade and quote data on the underlying Equities.
Before you download US Equity Options data, open the Pricing page of your organization and subscribe to the , , and data packages. You need billing permissions to change the organization's subscriptions.
Download in Bulk
After you subscribe to local access (see Prerequisites), open a terminal in your organization workspace and run the following commands to bulk download the data and its prerequisites.
To download the US Equity Security Master, run:
$ lean data download --dataset "US Equity Security Master"
To download the US Equity Option Universe data, run:
$ lean data download --dataset "US Equity Option Universe" --data-type "Bulk" --start "20250403" --end "20250403"
To download the US Equity Options data for a resolution, run the following command, replacing <resolution> with daily, hour, or minute and adjusting the date range:
$ lean data download --dataset "US Equity Options" --data-type "Bulk" --resolution "<resolution>" --start "20230101" --end "20230105"
The dataset also depends on the underlying US Equities data; to download it, see US Equity. You can also use the CLI Command Generator. For more information, see Using the CLI.
After you bulk download the US Equity Options dataset, new daily updates are available at 8 PM Coordinated Universal Time (UTC) two days after each trading day. Instead of directly calling the lean data download command, you can place a Python script in the data directory of your organization workspace and run it to update your data files. The following example script updates all data resolutions:
import os
import pandas as pd
from datetime import datetime, time, timedelta
from pytz import timezone
from os.path import abspath, dirname
os.chdir(dirname(abspath(__file__)))
OVERWRITE = False
# Define a method to download the data
def __download_data(resolution, start=None, end=None):
print(f"Updating {resolution} data...")
command = f'lean data download --dataset "US Equity Options" --data-type "Bulk" --option-style "American" --resolution "{resolution}"'
if start:
end = end if end else start
command += f" --start {start} --end {end}"
if OVERWRITE:
command += " --overwrite"
print(command)
os.system(command)
def __get_end_date() -> str:
now = datetime.now(timezone("US/Eastern"))
if now.time() > time(7,30):
return (now - timedelta(1)).strftime("%Y%m%d")
print('New data is available at 07:30 AM EST')
return (now - timedelta(2)).strftime("%Y%m%d")
def __download_high_frequency_data(latest_on_cloud):
for resolution in ["minute"]:
dir_name = f"option/usa/{resolution}/aapl".lower()
if not os.path.exists(dir_name):
__download_data(resolution, '19980101')
continue
latest_on_disk = sorted(os.listdir(dir_name))[-1].split('_')[0]
if latest_on_disk >= latest_on_cloud:
print(f"{resolution} data is already up to date.")
continue
__download_data(resolution, latest_on_disk, latest_on_cloud)
def __download_low_frequency_data(latest_on_cloud):
for resolution in ["daily", "hour"]:
file_name = f"option/usa/{resolution}/aapl.zip".lower()
if not os.path.exists(file_name):
__download_data(resolution)
continue
latest_on_disk = str(pd.read_csv(file_name, header=None)[0].iloc[-1])[:8]
if latest_on_disk >= latest_on_cloud:
print(f"{resolution} data is already up to date.")
continue
__download_data(resolution)
if __name__ == "__main__":
latest_on_cloud = __get_end_date()
__download_low_frequency_data(latest_on_cloud)
__download_high_frequency_data(latest_on_cloud)
The preceding script checks the date of the most recent minute resolution data you have for AAPL. If there is new minute data available, it downloads the new data files and overwrites your hourly and daily files. If you don't intend to download all resolutions, adjust this script to your needs.
To update your local copy of the US Equity Security Master, run:
$ lean data download --dataset "US Equity Security Master"
To update your local copy of the US Equity Option Universe data, run:
$ lean data download --dataset "US Equity Option Universe" --data-type "Bulk" --start "20250403" --end "20250403"
Download by Ticker
To download data for selected tickers instead of the full dataset, run a non-interactive lean data download command. First, download the prerequisite US Equity Security Master:
$ lean data download --dataset "US Equity Security Master"
Next, download the US Equity Option Universe data for the underlying ticker to get the available contracts and their daily Greeks and implied volatility:
$ lean data download --dataset "US Equity Option Universe" --data-type "Trade" --ticker "GOOG" --start "20250630" --end "20260630"
Then download the US Equity Options data for the tickers, resolution, and date range you need. The dataset provides trade, quote, and open interest data, so run a command for each data type you need. For example, to download minute-resolution data for GOOG:
$ lean data download --dataset "US Equity Options" --data-type "Trade" --ticker "GOOG" --resolution "Minute" --start "20230101" --end "20230105" $ lean data download --dataset "US Equity Options" --data-type "Quote" --ticker "GOOG" --resolution "Minute" --start "20230101" --end "20230105" $ lean data download --dataset "US Equity Options" --data-type "Open Interest" --ticker "GOOG" --resolution "Minute" --start "20230101" --end "20230105"
You also need data for the underlying Equity; see US Equity. To download data interactively or to use the CLI Command Generator, see Using the CLI.
Size and Format
The following table shows the size and format of the US Equity Options dataset for each resolution:
| Resolution | Size | Format |
|---|---|---|
| Daily | 200 GB | 3 files per ticker |
| Hour | 500 GB | 3 files per ticker |
| Minute | 6 TB | 3 files per ticker per day |
For more information about the file format, see the Data / option directory in the LEAN repository.
Price
Equity Options data depends on the underlying US Equities data and the US Equity Security Master, so review the US Equity prices too. The following prices are in addition to those.
Download in Bulk
To download the US Equity Options dataset in bulk, subscribe to it on the Pricing page of your organization. The price depends on your organization tier and the resolution you need. The bulk download also requires the US Equity Security Master, US Equity Option Universe, and underlying US Equities subscriptions. The following table shows the price ($/year) to download the historical data of each resolution for each organization tier:
| Resolution | Quant Researcher | Team | Trading Firm | Institution |
|---|---|---|---|---|
| Minute | 30,000 | 33,600 | 40,800 | 64,800 |
| Hour | 14,400 | 21,000 | 26,400 | 34,800 |
| Daily | 12,000 | 15,600 | 18,000 | 21,000 |
After the first bulk subscription ends, subscribe to the updates to keep your local data current. The following table shows the price ($/year) of the updates of each resolution for each organization tier:
| Resolution | Quant Researcher | Team | Trading Firm | Institution |
|---|---|---|---|---|
| Minute | 1,200 | 1,680 | 2,160 | 2,880 |
| Hour | 1,440 | 1,440 | 1,920 | 2,640 |
| Daily | 720 | 960 | 1,440 | 1,920 |
The following table shows the annual price ($/year) of the US Equity Option Universe historical and updates subscriptions for each organization tier:
| Tier | Historical | Updates |
|---|---|---|
| Quant Researcher | 3,960 | 1,200 |
| Team | 5,040 | 1,200 |
| Trading Firm | 7,500 | 1,200 |
| Institution | 12,000 | 1,200 |
The following table shows the total cost of downloading the required datasets in bulk at minute resolution on the Quant Researcher tier. Other organization tiers apply their own rates, shown in the preceding tables.
| Dataset | Package | Historical | Updates |
|---|---|---|---|
| US Equity Security Master | Subscription | $600 | $600/year |
| US Equity Option Universe | Subscription | $3,960 | $1,200/year |
| US Equities | Minute | $11,760 | $600/year |
| US Equity Options | Minute | $30,000 | $1,200/year |
| Total | $46,320 | $3,600/year |
Download by Ticker
The file format of the US Equity Option Universe data is one file per underlying Equity and each file costs 200 QCC = $2 USD.
The US Equity Options dataset is available is several resolutions. The resolution you need depends on the US Equity Option subscriptions you create in your algorithm and the resolution of data you get in history requests. The following table describes the file format and costs of each resolution:
| Resolution | File Format | Cost per file |
|---|---|---|
| Minute | One file per Option per trading day per data format. Quote, trade, and open interest data are separate files. | 15 QCC = $0.15 USD |
| Hour | One file per Option per year per data format. Trade and open interest data are separate files. | 900 QCC = $9 USD |
| Daily | One file per Option per year. Trade and open interest data are separate files. | 300 QCC = $3 USD |
For example, the following algorithm subscribes to minute resolution data for an Equity Option and its underlying asset:
public class USEquityOptionsDataAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2020, 1, 1);
SetEndDate(2021, 1, 1);
UniverseSettings.Asynchronous = true;
var underlying = AddEquity("GOOG").Symbol;
AddOption(underlying);
}
} class USEquityOptionsDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2020, 1, 1)
self.set_end_date(2021, 1, 1)
self.universe_settings.asynchronous = True
underlying = self.add_equity("GOOG").symbol
self.add_option(underlying)
The following table shows the data cost of the preceding algorithm on the Quant Researcher tier:
| Dataset | Package | Initial Cost | Ongoing Cost |
|---|---|---|---|
| US Equity Security Master | Download On Premise | $600 USD | $600 USD/year |
| US Equity Option Universe | Download On Premise |
1 underlying Equity over 252 trading days
=> 1 * 252 files = 252 files 252 files @ 200 QCC/file => 252 * 200 QCC = 50,400 QCC = $504 USD |
1 underlying Equity
=> 1 file/day 1 file/day @ 200 QCC/file = 200 QCC/day = $2 USD/day |
| US Equity | Minute Download |
1 security over 252 trading days with 2 data formats
=> 1 * 252 * 2 files = 504 files 504 files @ 5 QCC/file => 504 * 5 QCC = 2,520 QCC = $25.20 USD |
1 security with 2 data formats
=> 2 files/day 2 files/day @ 5 QCC/file => 2 * 5 QCC/day = 10 QCC/day = $0.10 USD/day |
| US Equity Options | Minute Download |
1 Option over 252 trading days with 3 data formats
=> 1 * 252 * 3 files = 756 files 756 files @ 15 QCC/file => 756 * 15 QCC = 11,340 QCC = $113.40 USD |
1 Option with 3 data formats
=> 3 files/day 3 files/day @ 15 QCC/file => 3 * 15 QCC/day = 45 QCC/day = $0.45 USD/day |
The preceding table assumes you download trade, quote, and open interest data. However, you can run backtests with only trade data.