You've successfully subscribed to Alpaca Resources
Great! Next, complete checkout for full access to Alpaca Resources
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.
  • Home
  • We're hiring
  • Support
  • Forum
  • Docs
  • Log in
  • Sign up
Market Data

An Introduction to Market Data APIs and their Usage

Alpaca Team
Alpaca Team

Data is a critical component of any trading or investing strategy, and that holds true for the casual, once-a-quarter investor to the professional day trader. The Internet affords anyone with a connection the capability to access such data, often in real-time, via visually-appealing GUIs on websites or as raw text data from APIs. This article will concern itself with the latter option, APIs.

I am going to use API offered by Alpaca to show you how we can obtain various types of market data.

Market Data - Documentation | Alpaca
Alpaca API lets you build and trade with real-time market data for free.

Part of Alpaca’s solution set for customers is data services through IEX’s or Polygon’s data platform, allowing one to retrieve all sorts of information on companies and the markets. The data types discussed here are available through Alpaca’s partnership with IEX or Polygon.

Types of Market Data Available

There are two ways to search for data.

The first is company-specific, in which the investor or trader already knows the specific company s/he wants to target. This kind of data can be price quotes, company financials, or the order book of extant buys and sells.

The other search method looks for specific events, like corporate actions or large price moves in the broad market without a particular company in mind.

(1) Company Specific

There are myriad data points one can obtain for any specific company.

Common data points

Common data points are the current price, the dividend and the dividend yield, earnings information, and key statistics, like the short percentage and the number of shares outstanding.

Fundamental analysts

Fundamental analysts will be particularly interested in the financials and earnings numbers.

Technical analysts

Conversely, technical analysts will want to retrieve bar chart information and momentum indicators, like order book information that reveals market sentiment and buying/selling depth.

Company peers

The Alpaca/IEX API also offers broader market insights, like company peers. One can query the API for peers and receive a list of companies that are commonly associated with the target company. A strategy here might be to target a single company, automatically grab the peers, and track their performance as a broader alert system.

News headlines

Another highly-useful dataset is news headlines. This is moving into the realm of natural language processing (NLP), but the Alpaca/IEX API will return some tagged information to make processing easier for people without expertise in NLP. There will be a headline, a short summary, a source, and related tickers in the returned data.

(2) Broad Market Approach

One can also access information like corporate actions, earnings releases, and upcoming dividends.

Finding new targets stocks

This kind of information lets one find new target stocks every day rather than always focusing on the same companies. Of course, aggregate market data, like the last orders filled, can also lend some insight into the most likely direction or focus of the markets in the next few hours or days.

Various types of screeners

A common usage of broad market-based data is filtering through lists of gainers, losers, and volume or momentum groups. A lot of strategies start here to screen potential candidates then do further processing later.

Why Use Financial Data APIs

Removing emotions from trading, being able to process large amounts of data in short timeframes, and getting away from the market to pursue other activities. Indeed, APIs are a critical component of any automated trading system, since the data feed for the system has to originate somewhere, and APIs make interfacing with that source much easier.

For daytraders who must retrieve, parse, review, and act on large amounts of information quickly, automation via APIs seems like a natural method to achieve the goals of the strategy. On the other hand, one might wonder what is the point of using APIs in place of graphics-based websites for the casual investor who rarely looks at the market.

A Possible Use Case of Data APIs

A possible scenario could be a casual value investor looking for opportunities in strong industries. How would one implement this strategy in an automated manner?

First, the investor could set up a daily query to check the 10 biggest daily losers out of a list of 500 stocks. Next, the system can retrieve the peers and industry tags for each of those losers and check their performance. Subsequently, part of the system can scan the news for the day and determine whether any major news occurred, potentially by keyword matching.

Finally, if peer performance is robust, there is seemingly no material news on the day, and the target stock meets a predetermined threshold of loss, the system can send an alert to the investor. In this use case, the investor doesn’t have to monitor any particular stock but perhaps read some news on the daily state of the market or industry. The system does most of the finding, matching, and determining before the investor even investigates a potential candidate.

Once the alert is determined to be sufficient for further investigation, another part of the investor’s system can retrieve charting data, financials, and whatever else the particular individual deems important to consider before making the decision to invest. All that information can be waiting for the investor to get home from work, or the kid’s baseball game, or a skydiving trip, preprocessed and beautifully organized already.


Technology and services are offered by AlpacaDB, Inc. Brokerage services are provided by Alpaca Securities LLC (alpaca.markets), member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.

You can find us @AlpacaHQ, if you use twitter.

Market Data

Alpaca Team

API-first stock brokerage. *Securities are offered through Alpaca Securities LLC* http://alpaca.markets/#disclosures