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

Commission-free Crypto Trading API is here!

Market Data API

Alpaca Market Data Subscription is a Game-changer

Alpaca Team
Alpaca Team

Please note that this article is for educational and informational purposes only. All screenshots are for illustrative purposes only. The views and opinions expressed are those of the author and do not reflect or represent the views and opinions of Alpaca. Alpaca does not recommend any specific securities or investment strategies.

This article first appeared on Medium and is written by Jordan Shadowens

I have been searching for APIs for the past few years that are powerful enough to handle high-frequency trading. In the last year, Nasdaq came out with an API where individuals and businesses can signup and get stock data directly. I reached out to Nasdaq earlier this year and talk to a sales guy to begin pricing out how much it would cost to build out a couple of servers to make it easy for users to get free market data to feed their algorithmic trading system. When I was figuring out how to pay for everything, I came across Alpaca API market subscription, which users can subscribe to Nasdaq through them for $9 a month. Most people don’t know this, but this is a game-changer for self-made trading applications.

I will make a couple of videos and post them to my YouTube account to teach individuals to focus on high-frequency trading. In the first video, I show you how to set up a WebSocket to connect to Alpaca API.


To get started, you will have to create an account with ALPACA here

Next, purchase the Market Data subscription for $9

Technically, you do not have to buy the $9 subscription to gather Market Data from Alpaca. You can get free data from IEX, but you can only make 200 requests per minute. You will have to update my code here.

CHANGE sip to iex

Alpaca premium subscription talks about how it provides unlimited data, which holds, but it is restricted. I tested how many symbols I can subscribe to Alpaca with one request. I gathered all Nasdaq symbols using the Nasdaq Screener tool. You can find the tool here.

After gathering the stock symbols, I converted all of them into a Tuple. In the end, my Tuple consisted of over 4000 stock symbols, and if you were to convert it to bytes, it equaled over 32,000 bytes. The message ended up being more significant than the 16,000 max bytes Alpaca allows. I had to cut the stock symbols I was sending up in half. If you wanted to scan the whole Nasdaq, you would have to create two micro python services, which is still better than the other APIs like Etrade.

The problem with being limited when trading off of speed is each time you have to make a request, and you have to count how long it takes to request data from the server and how long it takes to get the requested data back to you. For example, if it takes 100ms to the server and 100ms back, each time will cost 200 ms. There are 4389 stocks listed on the Nasdaq, and if I were to build my scanner with Etrade, I am limited to 25 symbols each time, which means the minimum amount of requests I will have to make to scan the whole market is 175, which comes out to be 35 seconds spent on making a requests. The number will go up or down depending on how long it takes to complete the request. The other significant thing also to consider is it also 175 times, you have to write a function to handle the data, which adds more time, which is why one request to Alpaca Nasdaq Market has a significant advantage. I will show how much of an advantage in another video.

Download the code from my GitHub here.

GitHub - jordanshadowens/YouTubeScanner
Contribute to jordanshadowens/YouTubeScanner development by creating an account on GitHub.

Alpaca does not prepare, edit, or endorse Third Party Content. Alpaca does not guarantee the accuracy, timeliness, completeness or usefulness of Third Party Content, and is not responsible or liable for any content, advertising, products, or other materials on or available from third party sites.

Brokerage services are provided by Alpaca Securities LLC ("Alpaca"), member FINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc. This is not an offer, solicitation of an offer, or advice to buy or sell securities, or open a brokerage account in any jurisdiction where Alpaca is not registered (Alpaca is registered only in the United States).

Market Data APICommunity Examples

Alpaca Team

API-first stock brokerage. *Securities are offered through Alpaca Securities LLC*