---
title: "Theta Data"
description: "Learn how to connect and feed data to a live algorithm from Theta Data in Lean CLI."
canonical: https://www.quantconnect.com/docs/v2/lean-cli/datasets/theta-data
markdown: https://www.quantconnect.com/docs/v2/lean-cli/datasets/theta-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/05%20Datasets/14%20Theta%20Data
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# Theta Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > Datasets > Theta Data

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Instead of using the data from QuantConnect or your brokerage, you can use Theta Data if you're deploying a local project. This page explains our integration with their API and its functionality. To use Theta Data, you need to [install and launch the Theta Terminal](https://http-docs.thetadata.us/Articles/Getting-Started/Getting-Started.html).

To view the implementation of the Theta Data integration, see the [Lean.DataSource.ThetaData repository](https://github.com/QuantConnect/Lean.DataSource.ThetaData).

To use the CLI, you must be a member in an [organization](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/tier-features.md) on a paid tier.

## Supported Datasets

Our Theta Data integration supports securities from the following asset classes:

- [Equity](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity.md)
- [Equity Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/equity-options.md)
- [Index](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/index.md)
- [Index Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/index-options.md)

The Theta Data data provider serves raw data. To get adjusted Equity data in local deployments, [download the US Equity Security Master](https://www.quantconnect.com/datasets/quantconnect-us-equity-security-master/cli).

## Alternative Data

If you have licensed alternative data with QuantConnect, it works as expected with the Theta Data data provider for research, backtesting, and live trading.

## Download

To download Theta Data data, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean data download --data-provider-historical ThetaData --data-type <data-type> --resolution <resolution> --security-type <security-type> --ticker <tickers> --start <YYYYMMDD> --end <YYYYMMDD> --thetadata-subscription-plan <plan>`.

```
$ lean data download --data-provider-historical ThetaData --data-type Trade --resolution Daily --security-type Option --ticker NVDA,AMD --start 20240303 --end 20240404 --thetadata-subscription-plan Standard
```

The `--thetadata-subscription-plan` option must be `Free`, `Value`, `Standard`, or `Pro`. If you provide your credentials, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them.

## Research

To access Theta Data data from the local Research Environment, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean research <projectName> --data-provider-historical ThetaData --thetadata-subscription-plan <plan>`.

```
$ lean research "My Project" --data-provider-historical ThetaData --thetadata-subscription-plan Standard
```

The `--thetadata-subscription-plan` option must be `Free`, `Value`, `Standard`, or `Pro`. If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean research <projectName>` to open the Research Environment with the same options.

## Backtesting

To run a local backtest with data from Theta Data, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean backtest <projectName> --data-provider-historical ThetaData --thetadata-subscription-plan <plan>`.

```
$ lean backtest "My Project" --data-provider-historical ThetaData --thetadata-subscription-plan Standard
```

The `--thetadata-subscription-plan` option must be `Free`, `Value`, `Standard`, or `Pro`. If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean backtest <projectName>` to run another backtest with the same options.

## Optimization

Follow these steps to run a local optimization job with data from Theta Data:

1. Add some [parameters](https://www.quantconnect.com/docs/v2/lean-cli/optimization/parameters.md) to your project.
2. Open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md).
3. Run `lean optimize <projectName> --data-provider-historical ThetaData --thetadata-subscription-plan <plan>`.
   ```
   $ lean optimize "My Project" --data-provider-historical ThetaData --thetadata-subscription-plan Standard
   ```
   The `--thetadata-subscription-plan` option must be `Free`, `Value`, `Standard`, or `Pro`.
4. Follow [the steps in the interactive wizard](https://www.quantconnect.com/docs/v2/lean-cli/optimization/deployment.md#02-Run-Local-Optimizations) to configure your optimization job settings.

The `lean optimize` command also accepts additional [options](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-backtest.md#04-Options) so that you can select Theta Data and run the command in non-interactive mode. If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean optimize <projectName>` to run another optimization job with the same options.

## Live Trading

To deploy a local live algorithm that uses Theta Data as the data provider, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean live deploy <projectName> --data-provider-live ThetaData --thetadata-subscription-plan <plan> --brokerage <brokerageName> <requiredBrokerageOptions>`.

```
$ lean live deploy "My Project" --data-provider-live ThetaData --thetadata-subscription-plan Standard --brokerage "Paper Trading"
```

The `--thetadata-subscription-plan` option must be `Free`, `Value`, `Standard`, or `Pro`. Depending on the brokerage you select, you may need to provide some [required brokerage options](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-live-deploy.md#02-Description). To use a different provider for historical data, include the `--data-provider-historical` option. If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean live deploy <projectName> --brokerage <brokerageName>` to deploy another live algorithm with the same options.

To deploy the live algorithm through the interactive mode of the CLI, see [ThetaData](https://www.quantconnect.com/docs/v2/lean-cli/live-trading/data-providers/theta-data.md).

The CLI doesn't currently support deploying cloud algorithms with the Theta Data data provider.

## Pricing

To view the prices of the Theta Data API packages, see the [Pricing](https://www.thetadata.net/subscribe) page on the Theta Data website.
