Datasets

Brokerages

Introduction

Instead of using the data from QuantConnect, you can use data from your brokerage.

Supported Datasets

Refer to the Asset Classes section of each brokerage page.

Universe Selection

Universe Selection is available with the brokerage data provider if you download the data from the Dataset Market. 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:

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.

Research

To access brokerage data from the local Research Environment, open a terminal in your organization workspace 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 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 your brokerage data, open a terminal in your organization workspace 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 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 to your project.
  2. Open a terminal in your organization workspace.
  3. Run lean optimize <projectName> --data-provider-historical <brokerageName> <requiredBrokerageOptions>.
  4. $ lean optimize "My Project" --data-provider-historical "Interactive Brokers" --ib-user-name=userName --ib-account=account --ib-password=password
  5. Follow the steps in the interactive wizard to configure your optimization job settings.

The lean optimize command also accepts additional 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 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 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. 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 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 brokerages provide live data feed (--data-provider-live) and historical data (--data-provider-historical) for research, backtest, and optimization.

Brokerage NameRequired Options
Interactive Brokers--ib-user-name
--ib-account
--ib-password
Oanda--oanda-account-id
--oanda-access-token
--oanda-environment
Bitfinex--bitfinex-api-key
--bitfinex-api-secret
Coinbase Advanced Trade--coinbase-api-key
--coinbase-api-secret
Binance--binance-exchange-name
--binance-api-key or --binanceus-api-key
--binance-api-secret or --binanceus-api-secret
--binance-use-testnet
Kraken--kraken-api-key
--kraken-api-secret
--kraken-verification-tier
Bybit--bybit-api-key
--bybit-api-secret
--bybit-vip-level

For brokerages that exclusively provide a live data feed, refer to lean live deploy.

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: