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

Datasets

Polygon

Introduction

Polygon was founded by Quinton Pike in 2017 with the goal to "break down the barriers that have traditionally limited access to high-quality financial data for all". Polygon provides institutional-grade Equity, Option, Index, Forex, and Crypto data for business and educational purposes.

The Polygon data provider serves asset prices from Polygon. This page explains our integration with their API and its functionality.

To view the implementation of the Polygon integration, see the Lean.DataSource.Polygon repository.

Supported Datasets

The Polygon data provider sources data directly from Polygon. Our integration supports securities from the following asset classes:

This data provider provides the raw price data, so download the US Equity Security Master with the CLI to get adjusted Equity prices. For more information about the data source, see the Polygon API documentation.

Universe Selection

In local deployments, universe selection is available with the Polygon 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:

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 Polygon data provider for research, backtesting, and live trading.

Research

To use Polygon data in the Research Environment on Local Platform, first start the Research Environment with the CLI and request the data you need. All the data you request will be cached in your hard drive, so you can then open the Research Environment with the Local Platform UX and access it.

Backtesting

To run an on-premise backtest on Local Platform with Polygon data, first backtest the algorithm on your local machine with the CLI. All the data your backtest requests will be cached in your hard drive, so you can then run the backtest on-premise with the Local Platform UX and access it.

Optimization

To run an on-premise optimization on Local Platform with Polygon data, first backtest the algorithm on your local machine with the CLI. All the data your backtest requests will be cached in your hard drive, so you can then run the optimization on-premise with the Local Platform UX and access it.

Live Trading

The following sections explain live trading deployment and data updates when using the Polygon data provider.

Deployment

Follow these steps to deploy a live trading algorithm that uses the Polygon data provider:

  1. Open the project that you want to deploy.
  2. Click the Local deploy live icon / Deploy live icon Deploy Live icon.
  3. If you deploy to QuantConnect Cloud, you must have an available live trading node for each live trading algorithm you deploy.

  4. On the Deploy Live page, click the Brokerage field and then click your brokerage from the drop-down menu.
  5. Enter the required brokerage authentication information.
  6. For more information about the required information for each brokerage, see the Deploy Live Algorithms section of your brokerage documentation.

  7. In the Data Provider section of the deployment wizard, click Show.
  8. Click the Data Provider 1 field and then click Polygon from the drop-down menu.
  9. Enter your Polygon API Key.
  10. Polygon selected as the data provider in the deployment wizard
  11. Click Save.
  12. (Optional) If your brokerage supports exisiting cash and position holdings, add them.
  13. (Optional) If you are deploying to QuantConnect Cloud, set up notifications.
  14. Configure the Automatically restart algorithm setting.
  15. By enabling automatic restarts, the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection.

  16. Click Deploy.

Data Updates

If you deploy local live algorithms that trade US Equities or US Equity Options, periodically update your US Equity Security Master. Weekly updates are sufficient in most cases.

If you deploy local live algorithms that rely on universe data, download the latest data files every trading day. For examples of downloading Equity, Equity Option, and Index Option universe files, see Universe Selection. To update alternative datasets that support universe selection, see the CLI commands in their respective dataset listing.

Historical Data

The historical data that's available from the Polygon data provider for history requests and warm-up periods depends on your Polygon data plan. For more information about each plan, see the Simple Pricing page on the Polygon website.

Pricing

To view the prices of the Polygon API packages, see the Simple Pricing page on the Polygon website.

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: