You've successfully subscribed to Alpaca Learn - Developer API Trading Tutorials, Code Samples
Great! Next, complete checkout for full access to Alpaca Learn - Developer API Trading Tutorials, Code Samples
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.
Trading API

How to Connect to the Alpaca API?

Alpaca Team
Alpaca Team

This tutorial is a step by step demonstration on how to place a Bracket order and is part of the Alpaca 101 Tutorial Series. We will move forward assuming that you’ve registered on the Alpaca website. If you haven’t please visit Alpaca and sign up. Feel free to check out the other tutorials in this series at Alpaca Resources.

Alpaca - Commission-Free API First Stock Brokerage
Alpaca is a modern platform for trading. Alpaca’s API is the interface for your trading algorithms, bots, or applications to communicate with Alpaca’s brokerage and other services.

Step 1:

The Alpaca API can be used through various languages. This tutorial will be conducted using Visual Studio Code as the IDE and python as the programming language.

Step 2:

Sign into your account at Alpaca and go to your trading account. In order to connect your algorithm to the Alpaca trading account, you will need API keys. Each account is issued its own API keys and these can be viewed in your overview page, as shown in the gif below.

API Keys
API Keys

Step 3:

The code below (exclusively for python) can be used to connect your algorithm to your trading account. Remember to input your “API key” and the “secret API key” in the algorithm.

One can find similar code  at Alpaca Docs.

About Trading API
Trade stocks & crypto with Alpaca’s easy to use Trading API. Up to 4X intraday & 2X overnight buying power. Short selling. Advanced order types. All packaged and delivered through our API.
Code for API Keys
Code for API Keys

Commission Free Algorithmic Trading...Alpaca API

Thank you for using Alpaca. Here are a couple more links that  you might be interested in.

Alpaca GitHub repository

Alpaca builds an API for free stock trading. Alpaca has 39 repositories available. Follow their code on GitHub.

Alpaca Blog

Alpaca Blog | API for Stock Trading
Alpaca Blog for product updates, new integration, and more. Alpaca’s commission-free trading API is built for algorithmic trading and building apps

Alpaca Forum

Alpaca Community Forum
Alpaca user forum for FAQ, feature requests, many discussions around Alpaca stock trading API

Alpaca API documentation

This page will help you get started with Alpaca Docs. You’ll be up and running in a jiffy!

You can also follow Alpaca and our weekly updates on our LinkedIn, Alpaca Community Slack and @AlpacaHQ on Twitter!

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.

Trading API

Alpaca Team

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