book
Checkout our new book! Hands on AI Trading with Python, QuantConnect, and AWS Learn More arrow

Download in Bulk

US Equity Options

Introduction

Download the US Equity Options dataset in bulk to get the full dataset without any selection bias. The bulk dataset packages contain trade, quote, and open interest data for every ticker and trading day.

The US Equity Options dataset depends on the following datasets:

To use the CLI, you must be a member in an organization on a paid tier.

Download History

To unlock local access to the US Equity Options dataset, open the Pricing page of your organization and subscribe to at least one of the following data packages:

  • US Equity Options Daily History by AlgoSeek
  • US Equity Options Hour History by AlgoSeek
  • US Equity Options Minute History by AlgoSeek

If you don't already subscribe to the US Equity Security Master by QuantConnect and US Equity Option Universe History by QuantConnect data packages, subscribe to them too. You need billing permissions to change the organization's subscriptions.

After you subscribe to local access, to download the US Equity Options data, follow these steps:

  1. Log in to the Algorithm Lab.
  2. On the CLI tab of the dataset listing, use the CLI Command Generator to generate your download command and then copy it.
  3. Open a terminal in your organization workspace and then run the command from the CLI Command Generator.

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 Equities data, see Download History.

Download Daily Updates

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. For example, the minute resolution data for Monday is available on Wednesday at 8 PM UTC. To unlock local access to the data updates, open the Pricing page of your organization and subscribe to at least one of the following data packages:

  • US Equity Options Daily Updates by AlgoSeek
  • US Equity Options Minute Updates by AlgoSeek
  • US Equity Options Hour Updates by AlgoSeek

You need billing permissions to change the organization's subscriptions.

After you subscribe to dataset updates, to update your local copy of the US Equity Options dataset, use the CLI Command Generator to generate your download command and then run it in a terminal in your organization workspace. Alternatively, 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 other dependency datasets, see the Download Daily Updates documentation for the US Equity Option Universe and US Equities datasets.

Size and Format

The following table shows the size and format of the US Equity Options dataset for each resolution:

ResolutionSizeFormat
Daily200 GB3 files per ticker
Hour500 GB3 files per ticker
Minute6 TB3 files per ticker per day

For more information about the file format, see the Data / option directory in the LEAN repository.

Price

To view the prices of the datasets, see the Pricing tab of the following dataset listings:

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: