Market Data
Alpaca Data API
Alpaca Data API provides the market data available to the client user through the REST and websocket streaming interfaces. Alpaca Data API consolidates data sources from five different exchanges.
- IEX (Investors Exchange LLC)
- NYSE National, Inc.
- Nasdaq BX, Inc.
- Nasdaq PSX
- NYSE Chicago, Inc.
Authentication
The authentication is done the same way as Trading API, and make sure you set the following fields in the HTTP header:
APCA-API-KEY-ID
APCA-API-SECRET-KEY
Endpoint
Please note the Data API endpoint is different from the Trading API endpoint. Although the Trading API documented herein references v2, the Data API endpoint should still point to v1 as follows:
https://data.alpaca.markets/v1
This URL is the same between paper trading and live trading.
Streaming trades, quotes and bars
Alpaca Data API provides websocket streaming for trades, quotes and minute bars with the same API key. For the details about the streaming, plase see the reference page
Polygon Integration
Alpaca integrates with Polygon service, provided for the users who have funded live trading accounts. For details, please see another page
Which API should I use?
The biggest difference between Alpaca Data API and Polygon is the density of the data. While Polygon data is full volume consolidated from all exchanges in the U.S., Alpaca Data API consists of five exchanges listed above. That said, Alpaca Data API satisfies most of the daily uses with enough accuracy as to the real time price needs.
Due to the exchange requirements, it is necessary to have a live trading account and sign the agreement to start accessing Polygon data. Users without a live brokerage account must use Alpaca Data API.
For those who have Polygon access via Alpaca API key, Alpaca Data API still works with the same key, and applies separate constraint for the concurrent connection. You can also use Alpaca Data API streaming for the purpose of backup and redundancy.
Alpaca Data API provides more flexible query capability such as multi-symbol and precise time range parameters, in addition to the real time trade & quotes data. Alpaca’s intention is always to extend the API such that different use cases are easily met. If you find different needs for API design, please send us any feedbacks, too.
Can I get the full volume data from Alpaca Data API?
Currently, no. The plan is to eventually provide everything through Alpaca Data API at some point. This is to achieve the best user experience for all Alpaca users. But don’t worry! We will have enough time for everyone to smoothly migrate from Polygon API to Alpaca API. Through our community Slack and email notifications, we will announce updates to available services in advance of major changes.
The bars API provides time-aggregated price and volume data. [GET] Get a list of bars GET/v1/bars/{timeframe} Retrieves a list of bars for each requested symbol. It is guaranteed all bars are in ascending order by time. Currently, no “incomplete” bars are returned. For example, a 1 minute bar for 09:30 will not be returned until 09:31. Parameters Path Parameters timeframe string One of minute, 1Min, 5Min, 15Min, day or 1D.
The Last Trade API provides last trade details for a symbol. [GET] Get the last trade GET/v1/last/stocks/{symbol} Retrieves the last trade for the requested symbol. Parameters Path Parameters symbol string A stock ticker symbol to retrieve the last trade of Response A Last Trade object enclosed by a response object. See example Errors 401 The API key is not valid, or the feature is not enabled.
The Last Quote API provides last quote details for a symbol. [GET] Get the last quote GET/v1/last_quote/stocks/{symbol} Retrieves the last quote for the requested symbol. Parameters Path Parameters symbol string A stock ticker symbol to retrieve the last quote of Response A Last Quote object enclosed by a response object. See example Errors 401 The API key is not valid, or the feature is not enabled.
Alpaca Data API provides websocket streaming for trades, quotes and minute bars. This helps receive the most up to date market information that could help your trading strategy to act upon certain market movement. Specifications Each account can have up to one concurrent websocket connection. Trades, quotes and minute bars are supported. Subscription is limited to 30 channels at a time for trades and quotes (T. and Q.). This limit is temporary and we may support more channels in the future.