Friday, September 25, 2020

Alpaca Paper Trading Bot Test

Alpaca is a cool little site that allows you to test various stock trading strategies using their free fake money account (paper account) with a powerful free API. 

Head on over to the site and sign up for a free account. You will see a link on the left side menu that takes you to the paper trading account


On the right side of the paper account you should see a link to View your API keys. You will need these keys to plug into your Python Script. They have tons of documentation on the API but I will list out a few samples below. You will see a Buy, Sell, Lookup Order, and a very basic Trade Bot.

Buy Sample

Sell Sample

Lookup order Sample

Basic Trade Bot


This is a very very very basic Trading bot for a paper money account (fake money). Please don't use this and expect big GAINS. The bot will buy shares and then hold them until a specified profit threshold or loss threshold has been hit. You can tweak the thresholds to see how the strategy works. At the bottom of the script you'll see the startBot('WDC') command. This is where you insert the stock you want to work with.

Of course this can be improved upon, this is just a sample to get the bot up and rolling quickly. The bot can be configured to work with multiple stocks, etc.

So there you have it. Run wild, make a fancy new trading strategy and reap all the GAINS.



0 comments:

Post a Comment