This tutorial will be a step by step demonstration of how to get market data using the Alpaca API. We will move forward assuming that you’ve registered on Alpaca. If you have not, please check out the tutorial guides on “How to register for an account on Alpaca ?” or “How to open a live trading account as a US/ non-US resident?”
Alpaca provides market data from various sources. To learn more about data options and which one is right for you, please see this page.
Let’s create a class called “pythonBuyBot” and paste our code for the endpoints in the class.
Similarly let’s create a function to get market data for Apple(AAPL). Within this function we print out how much AAPL has moved in the specific timeframe.
Commission-Free trading means that there are no commission charges for Alpaca self-directed individual cash brokerage accounts that trade U.S. listed securities through an API. Relevant SEC and FINRA fees may apply.
Brokerage services are provided by Alpaca Securities LLC ("Alpaca"), memberFINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc.