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

# Brokerages

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

> 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, you can use data from your brokerage.

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

To view the asset classes that are available for your brokerage, follow these steps:

1. Open the [Brokerages](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages.md) page.
2. Click the name of your brokerage.
3. In the table of contents, click **Asset Classes**.

The brokerage data providers serve 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). To get [continuous Futures](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/futures.md#12-Continous-Contracts) data in local deployments, [download the US Futures Security Master](https://www.quantconnect.com/datasets/quantconnect-us-futures-security-master/cli).

## Universe Selection

In local deployments, [universe selection](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/key-concepts.md) is available with the brokerage 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 Equity Coarse Universe](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/us-equity-coarse-fundamental.md)
- [US Equity Option Universe](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/equity-options.md#02-Prerequisites)
- [US ETF Constituents](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/us-etf-constituents.md)
- [US Index Option Universe](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quantconnect/index-options.md#02-Prerequisites)

In cloud deployments, QuantConnect Cloud provides the universe selection datasets.

## Alternative Data

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

## Download

To download brokerage 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 <brokerageName> --data-type <data-type> --resolution <resolution> --security-type <security-type> --ticker <tickers> --market <market> --start <YYYYMMDD> --end <YYYYMMDD> <requiredBrokerageOptions>.`

```
$ lean data download --data-provider-historical "Interactive Brokers" --data-type Trade --resolution Daily --security-type Equity --ticker NVDA,AMD --market USA --start 20240303 --end 20240404 --ib-user-name userName --ib-account account --ib-password password

$ lean data download --data-provider-historical Binance --data-type Trade --resolution Daily --security-type Crypto --ticker BTCUSDT,ETHUSDT --start 20240303 --end 20240404 --binance-exchange-name Binance binance-api-key apiKey --binance-api-secret apiSecret
```

To download Coinbase data, include the `--market Coinbase` option.

```
$ lean data download --data-provider-historical "Coinbase Advanced Trade" --data-type Trade --resolution hour --security-type Crypto --ticker BTCUSD --market Coinbase --start 20230101 --end 20240404 --coinbase-api-name apiName --coinbase-api-private-key apiPrivateKey
```

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 brokerage 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 <brokerageName> <requiredBrokerageOptions>`.

```
$ lean research "My Project" --data-provider-historical "Interactive Brokers" --ib-user-name userName --ib-account account --ib-password password
```

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 your brokerage, 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 <brokerageName> <requiredBrokerageOptions>`.

```
$ lean backtest "My Project" --data-provider-historical "Interactive Brokers" --ib-user-name userName --ib-account account --ib-password password
```

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 your brokerage 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 <brokerageName> <requiredBrokerageOptions>`.
   ```
   $ lean optimize "My Project" --data-provider-historical "Interactive Brokers" --ib-user-name userName --ib-account account --ib-password password
   ```
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 your brokerage 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 your brokerage 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 <dataBrokerageName> <requiredDataBrokerageOptions> --brokerage <brokerageName> <requiredBrokerageOptions>`.

```
$ lean live deploy "My Project" --data-provider-live "Interactive Brokers" --ib-user-name userName --ib-account account --ib-password password --brokerage "Paper Trading"
```

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.

## Pricing

To view the prices of your brokerage data, visit their website.

## Supported Brokerages

The following table shows the supported brokerages and the options required to configure each one. Most of these brokerages also provide live (`--data-provider-live`) and historical (`--data-provider-historical`) data for research, backtesting, and optimization. Webull and Clear Street provide brokerage connectivity only, so pair them with a separate data provider such as [Polygon](https://www.quantconnect.com/docs/v2/lean-cli/datasets/polygon.md). Public provides brokerage connectivity and historical data, but no live data feed:

| Brokerage Name | Required Options |
| --- | --- |
| `Alpaca` | `--alpaca-environment` |
| `Binance` | `--binance-exchange-name` |
| `Binance` | `--binance-api-key` or `--binanceus-api-key` |
| `Binance` | `--binance-api-secret` or `--binanceus-api-secret` |
| `Binance` | `--binance-use-testnet` |
| `Bitfinex` | `--bitfinex-api-key` |
| `Bitfinex` | `--bitfinex-api-secret` |
| `Bybit` | `--bybit-api-key` |
| `Bybit` | `--bybit-api-secret` |
| `Bybit` | `--bybit-vip-level` |
| `CharlesSchwab` | `--charles-schwab-account-number` |
| `Coinbase Advanced Trade` | `--coinbase-api-name` |
| `Coinbase Advanced Trade` | `--coinbase-api-private-key` |
| `Interactive Brokers` | `--ib-user-name` |
| `Interactive Brokers` | `--ib-account` |
| `Interactive Brokers` | `--ib-password` |
| `Kraken` | `--kraken-api-key` |
| `Kraken` | `--kraken-api-secret` |
| `Kraken` | `--kraken-verification-tier` |
| `Oanda` | `--oanda-account-id` |
| `Oanda` | `--oanda-access-token` |
| `Oanda` | `--oanda-environment` |
| `TradeStation` | `--trade-station-environment` |
| `TradeStation` | `--trade-station-account-id` |
| `Webull` | `--webull-app-key` |
| `Webull` | `--webull-app-secret` |
| `Webull` | `--webull-account-id` |
| `Public` | `--public-secret-key` |
| `Public` | `--public-account-number` |
| `ClearStreet` | `--clearstreet-access-token` |
| `ClearStreet` | `--clearstreet-account-id` |

For brokerages that exclusively provide a live data feed, see the [lean live deploy](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-live-deploy.md) reference.

If you have an ARM M1, M2, or M3 chip, [Interactive Brokers](https://qnt.co/interactive-brokers) is not supported, see the [Troubleshooting](https://www.quantconnect.com/docs/v2/lean-cli/key-concepts/troubleshooting.md).
