A Full Crypto Trading Bot in Python

Use it as a starting point for a bot of your own!

Jason Bowling
The Startup

--

Photo by Ann H on Pexels, because you already know what a candlestick chart looks like.

I present here the full code of my first crypto trading bot, in the hopes that it might be useful to others. The bot uses robin_stock, pandas, and ta-lib to make automated trades on RobinHood.

First, let’s make sure we’re clear on something. Cryptocurrency investing is risky. Doing it using a computer program is even riskier. Doing it with code you didn’t write, or don’t fully understand, is a _terrible_ idea. What you do with this code is entirely up to you, and any risks you take are your own. It’s intended to be educational and comes with absolutely no guarantee of anything at all. You could lose all your money. Seriously.

Overall approach

The trading strategy doesn’t try to be optimal — that’s hard. It simply tries to buy at a low point, hold for a day or two until the price rises a bit, and then sell. It then repeats. The profit from a single trade is small, but it compounds.

The code strives to be extremely polite to the Robinhood servers, but makes no effort to hide what it’s doing. It checks prices every ten minutes on the dot, with no randomization. It’s not clear to me how tolerant of this sort of use of the RobinHood API they are. I have seen anecdotes of people trying to trade at very…

--

--

Responses (9)