NEW+--
Min 75% OFF | Pay Day Sale Extended till 3rd June
Move Left Complete list

Automated Trading on Alpaca: Step-by-Step Guide

You can do paper/ live trading in Alpaca using Blueshift. Blueshift is a backtesting and live trading platform with institutional class infrastructure wherein you can code your strategy in Python and deploy it in live markets with a few clicks. Paper/ Live trading in Alpaca using Blueshift can be done in a few simple steps:

1. Create an Alpaca account: To paper/ live trade with Alpaca, you will need to create an Alpaca account. Go to this website to create an account using your email address and a few basic details. After successfully creating the account, log in to your account.

2. Generate API keys: Once logged in, click on “Home” to access the Dashboard of Alpaca. Scroll down to find the API Keys section. Then click on the "Generate New Keys" button to create a new API key.

Alpaca - Generate API Keys

 

3. Sign up for Blueshift: Here is the link to Blueshift’s main page where you can sign up for an account. Once there, navigate to “SIGN UP” on the top right of the page. You can create an account via this page or you can Oauth with Google or QuantInsti. Once logged in you will be taken to the Dashboard page that looks like this.

Blueshift homepage

 

4. Create Strategy: By clicking on the “Research Lab” button on the top, you can get started with your own algorithm. After clicking on the “Create” button in Research Lab, it will prompt you to name your strategy and select a Strategy Template. The template that you select will have some starter code, but you are not required to keep the starter code.

Blueshift - Create Strategy

5. Write and Optimize Strategy: Upon filling in the details in the “Add New Strategy” window and clicking on “Submit”, you will be taken to a new screen where you can write your algorithm on the left and perform a variety of different actions on the right. This is where you spend the majority of your time as you tweak your Alpaca Python algorithm to optimize returns and other metrics. To know more about the functionalities of Blueshift you can go through this documentation. 

Blueshift - Write and optimise strategy


6. Run Quick Backtest/Full Backtest: On the right panel, you can enter in the dataset you would like to use for the backtest, the "Start Date" and "End Date", and the "Capital" amount for the algorithm. To run the quick backtest, select “Run”. Blueshift offers a more in-depth backtest by clicking on the “Full Backtest” button. The full backtest provides quite a bit more information than the quick backtest. It produces Key Metrics, a basic tear sheet, transactions, error logs, output logs and the code of the algo. 

Blueshift - Quick Backtest

7. Go Live: This is the best part about Blueshift. Typically, you would spend a lot of time transitioning your code from where you were backtesting it to where you are able to actually trade with it. However, with Blueshift, you can do this by just clicking a few buttons. Start by clicking the “Go Live” button on the page where you can edit your strategy and run the quick backtest. Once you select this button, you are required to select the broker and enter the capital to be deployed. 

Blueshift - Go Live

You are able to select either a live trading account or a paper trading account for deploying your strategy. 

Blueshift - Select Broker

Once you select either of the accounts you will be redirected to the login screen of Alpaca. You need to login with your credentials. 

 

Alpaca - Login

This is Alpaca’s disclaimer for integrating with Blueshift.

Blueshift - Authorize

You need to enter the API Key and API secret that we generated after creating the account on Alpaca.

API Keys

Next, you need to select the broker and click on the “Trade Button”.

Select Broker

Double-check the details in the “Order Summary” window and click on “Submit”.

Blueshift - Order Summary

Once your algorithm is running you can check its details about the trades and other logs in the “Actions” tab. 

Blueshift - Trades

Conclusion

 

Blueshift provides a streamlined process for paper and live trading in Alpaca, allowing users to create, optimize, backtest, and deploy trading strategies effortlessly. By following a few simple steps—creating an Alpaca account, generating API keys, signing up for Blueshift, writing and optimizing Alpaca Algorithmic Trading strategies, and going live—you can begin trading efficiently and effectively in no time.

 


 

IMPORTANT DISCLAIMER: This post is for educational purposes only and is not a solicitation or recommendation to buy or sell any securities. Investing in financial markets involves risks and you should seek the advice of a licensed financial advisor before making any investment decisions. Your investment decisions are solely your responsibility. The information provided is based on publicly available data and our own analysis, and we do not guarantee its accuracy or completeness. By no means is this communication sent as the licensed equity analysts or financial advisors and it should not be construed as professional advice or a recommendation to buy or sell any securities or any other kind of asset.