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

# Alpha Vantage

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

> 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 Alpha Vantage for historical data if you're deploying a local project. This page explains our integration with their API and its functionality. To use Alpha Vantage, you need to [get a free](https://www.alphavantage.co/support/#api-key) or [premium API key](https://www.alphavantage.co/premium/).

To view the implementation of the Alpha Vantage integration, see the [Lean.DataSource.AlphaVantage repository](https://github.com/QuantConnect/Lean.DataSource.AlphaVantage).

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

The Alpha Vantage data provider serves asset price data directly from [Alpha Vantage's Time Series Stock Data APIs](https://www.alphavantage.co/documentation/#time-series-data). Our integration supports [US Equity](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity.md) securities. It only provides the security price data, so you need to [download the US Equity Security Master](https://www.quantconnect.com/datasets/quantconnect-us-equity-security-master/cli).

## Universe Selection

[Universe selection](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/equity.md) is available with the Alpha Vantage data provider if you download the data from the [Dataset Market](https://www.quantconnect.com/datasets). The dataset listings show how to download the universe selection data with the CLI. For live trading, you'll need to periodically download the new data from QuantConnect Cloud, which you can automate with Python scripts. For example, the following tutorials explain how to download historical data and download daily updates:

- [US ETF Constituents](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/us-etf-constituents.md)
- [US Equity Coarse Universe](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/us-equity-coarse-fundamental.md)

## Alternative Data

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

## Download

To download Alpha Vantage 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 AlphaVantage --data-type Trade --resolution <resolution> --security-type EQUITY --ticker <tickers> --start <YYYYMMDD> --end <YYYYMMDD> --alpha-vantage-api-key <apiKey> --alpha-vantage-price-plan <pricePlan>`.

```
$ lean data download --data-provider-historical AlphaVantage --data-type Trade --resolution Daily --security-type Equity --ticker NVDA,AMD --start 20240303 --end 20240404 --alpha-vantage-api-key apiKey --alpha-vantage-price-plan Free
```

The `--alpha-vantage-price-plan` option must be one of the following values: `Free`, `Plan30`, `Plan75`, `Plan150`, `Plan300`, `Plan600`, or `Plan1200`. 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 Alpha Vantage 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 AlphaVantage --alpha-vantage-api-key <apiKey> --alpha-vantage-price-plan <pricePlan>`.

```
$ lean research "My Project" --data-provider-historical AlphaVantage --alpha-vantage-api-key apiKey --alpha-vantage-price-plan Free
```

The `--alpha-vantage-price-plan` option must be one of the following values: `Free`, `Plan30`, `Plan75`, `Plan150`, `Plan300`, `Plan600`, or `Plan1200`. 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 Alpha Vantage 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 AlphaVantage --alpha-vantage-api-key <apiKey> --alpha-vantage-price-plan <pricePlan>`.

```
$ lean backtest "My Project" --data-provider-historical AlphaVantage --alpha-vantage-api-key apiKey --alpha-vantage-price-plan Free
```

The `--alpha-vantage-price-plan` option must be one of the following values: `Free`, `Plan30`, `Plan75`, `Plan150`, `Plan300`, `Plan600`, or `Plan1200`. 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 Alpha Vantage 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 AlphaVantage --alpha-vantage-api-key <apiKey> --alpha-vantage-price-plan <pricePlan>`.
   ```
   $ lean optimize "My Project" --data-provider-historical AlphaVantage --alpha-vantage-api-key apiKey --alpha-vantage-price-plan Free
   ```
   The `--alpha-vantage-price-plan` option must be one of the following values: `Free`, `Plan30`, `Plan75`, `Plan150`, `Plan300`, `Plan600`, or `Plan1200`.
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 Alpha Vantage 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 Alpha Vantage as the historical 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-historical AlphaVantage --alpha-vantage-api-key <apiKey> --alpha-vantage-price-plan <pricePlan> --brokerage <brokerageName> <requiredBrokerageOptions>`. Alpha Vantage doesn't support streaming live data. The paper trading brokerage also doesn't provide live data, so if you select it, you need to include `--data-provider-live <liveDataProviderName> <requiredLivedataProviderOptions>`.

```
$ lean live deploy "My Project" --data-provider-historical AlphaVantage --alpha-vantage-api-key apiKey --alpha-vantage-price-plan Free --brokerage "Paper Trading" --data-provider-live "Custom data only"
```

The `--alpha-vantage-price-plan` option must be one of the following values: `Free`, `Plan30`, `Plan75`, `Plan150`, `Plan300`, `Plan600`, or `Plan1200`. Depending on the brokerage you select, you may need to provide some [additional required options](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-live-deploy.md#02-Description). 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.

## Pricing

To view the prices of the Alpha Vantage API packages, see the [Premium API Key](https://www.alphavantage.co/premium/) page on the Alpha Vantage website.
