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

Datasets

Alpaca

Introduction

Alpaca was founded by Yoshi Yokokawa and Hitoshi Harada in 2015 as a database and machine learning company. In 2018, Alpaca Securities LLC (Alpaca Securities) became a registered US broker-dealer with the Financial Industry Regulatory Authority (FINRA) with the mission to "open financial services to everyone on the planet". In 2022, Alpaca Crypto LLC (Alpaca Crypto) became a registered Money Services Business (MSB) with the Financial Crimes Enforcement Network (FinCEN). Alpaca provides access to trading Equities, Options, and Crypto for clients in over 30 countries. Alpaca also delivers custody, clearing, execution, and billing on behalf of registered advisors.

The Alpaca data provider serves Equity, Equity Option, and Crypto prices directly from Alpaca's Market Data API. This page explains our integration with their API and its functionality.

Sourcing

The Alpaca data provider sources data directly from Alpaca's Market Data API. If you use this data provider, Alpaca only provides the security price data. QuantConnect Cloud provides the following auxiliary datasets:

Universe Selection

Universe selection is available with the Alpaca data provider.

Select Language:
self.universe_settings.asynchronous = True
self.add_universe(self.fundamental_universe_selection)

The Alpaca data provider can stream data for up to 30 assets on the Basic plan. If your algorithm adds more than the quota, LEAN logs an error message from Alpaca. To increase the quota, purchase the Algo Trader Plus plan from Alpaca.

Bar Building

The data feed is a stream of asset prices collected by WebSockets and distributed to algorithms on the platform.

Alternative Data

Third-party data providers support most alternative datasets, except data that streams real-time intraday data. Streaming datasets, like the Tiingo News Feed and Benzinga News Feed, require the QuantConnect data provider.

Hybrid Data Provider

When you deploy a live algorithm with the Alpaca brokerage, you can use a third-party data provider, the Alpaca data provider, or both. If you use multiple data providers, the order you select them in defines their order of precedence in Lean. For example, if you set QC as the first provider and Alpaca as the second provider, Lean only uses the Alpaca data provider for securities that aren't available from the QC data provider. This configuration makes it possible to use our data provider for Equity universe selection and then place Options trades on the securities in the universe.

Historical Data

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

Pricing

The Alpaca data feed is free for Alpaca subscription accounts. The Basic plan has a quota of 30 assets and 200 API calls per minute. The Algo Trader Plus plan has higher quotas. To view the latest prices of the plans, see the Data page on the Alpaca 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: