Making a Crypto Trading Bot
If you’re not already aware of the world of cryptocurrency, it’s essentially a collection of digital currencies that each have their own price—kind of like stocks. The price of a cryptocurrency (also known as a crypto token) can fluctuate by going up and down and the degree to which this happens is called its volatility. You can make money with cryptocurrencies by buying a token a certain price and then later selling it at a higher price than what you paid for it. So if you paid $100 for Bitcoin, and then the price of Bitcoin rose 10%, then you can sell all of your Bitcoin for $110, leaving you with a profit of $10 (the opposite could also happen where you lose $10). Of course, you might be wondering where you would actually go out and buy crypto. You would do this by using what is known as a cryptocurrency exchange, which essentially like an eBay but for cryptocurrencies. This whole act of buying and selling cryptos is known as trading and is essentially one of the best ways that you can make money with crypto.
So now that we understand the very basics of trading
crypto, let’s see how we can automate the trading process so that we can theoretically
make money in our sleep. To do this, we will be programming our very own trading
bot in python to trade crypto on the Coinbase Pro exchange. Fortunately,
Coinbase Pro makes it easy for us to connect our bot to our trading account by
providing us with what is known as APIs, which is essentially code that allows
us to access our Coinbase account and do stuff like checking crypto prices and
trading cryptos.
I’m not going to go in depth as to how to do this in order to keep this short. Instead, I’ll just give a brief explanation of the main concepts behind it, but keep in mind that there are many ways that trading bots can be made and different strategies that they can implement. The strategy that we will be using is extremely simple (and also unreliable). The main concept behind our program is actually very simple: we calculate the 24-hour price change and we buy Bitcoin is it is below a certain percentage and sell it if it is above a certain percentage.
Here’s a preview of Coinbase Pro Sandbox:
And here’s the trading bot actually running:
This Just as a disclaimer, I do not recommend replicating anything like this with your real money. In fact, I used a simulated account with fake money myself because cryptocurrency is still a speculative investment—not to mention that our bot is really dumb. Anyway, I hope you found this brief overview of trading bots and automated trading cool, interesting, and informative.
You can look at the code for this project here: github.com/jcelaya775/Trading-Bot
Thanks for reading!
Comments
Post a Comment