Ad
News
How to Build a Simple Bitcoin Trading Bot, Part 1 How to Build a Simple Bitcoin Trading Bot, Part 1
🚨 This article is 6 years old...

How to Build a Simple Bitcoin Trading Bot, Part 1

How to Build a Simple Bitcoin Trading Bot, Part 1

Photo by TheDigitalArtist on Pixabay

Algorithmic trading is the process of applying the same set of rules to make buy and sell orders in a market – it involves applying the scientific method to trading in order to develop an effective strategy. This means doing research on an asset and coming up with a hypothesis on how to trade it.


Izak FritzThis is a guest post by Izak Fritz, a software contractor for Stably Blockchain Labs. Izak is a computer science student at the University of Michigan and interested in how cryptography can be used to make the internet more robust and secure. He enjoys trading cryptocurrencies and also writing algorithms that trade for him.


When building an automated trading strategy, it’s important to note that although the algorithm may have performed well in the past, it may not be indicative of future performance. It can, however, provide a good benchmark.

Once you have developed a trading strategy that works, you can begin testing it in a real market. Developing such a strategy may seem complicated, but in reality, it just requires patience and constant improvement.

In this article, I will go over an easy way to develop an algorithmic trading strategy in thirty minutes or less.

The difference between trading and investing

Investing is the process of buying and holding an investment over long periods of time, while trading is the process of buying at a low price and selling at a higher price in a short amount of time. Investment decisions are more heavily focused on the fundamentals of an asset, while trading is more focused on the price action and volume of an asset.

Why trade cryptocurrencies?

  • Huge upside: There is potential for a large ROI. Bitcoin alone went from ~$1000 to ~$20000 in 2017, that’s a 2000% ROI.
  • Low starting capital requirements: Unlike stocks, where you can only buy atomic amounts, in crypto, you can generally buy small divisible amounts of each currency. Additionally, the fees for trading are lower for smaller amounts of capital.
Bitcoin volatility (blue) vs. Gold volatility (red)
  • Market inefficiency: Since digit asset class is in a nascent stage, there are many inefficiencies in the market. The market is mainly hype-driven and therefore has a lot of volatility. Low liquidity helps retail traders because smaller amounts of capital are easier to trade within illiquid markets.

A good analogy for trading is fishing. When you are fishing, what is more important, the fishing rod or the fishing pond? The rod doesn’t matter if the pond is not full of fish. However, if you have a bad rod and the pond is full, you’re still apt to catch a few fish.

Trading is similar in this regard. You can have the most advanced algorithm in the world, but if the market is not good for trading, you won’t make any money. If the market is volatile or in a clear trend, there is plenty of opportunities for a trader to make money, even if they aren’t that good at it.

What is a market inefficiency?

A market inefficiency in a financial market is a price or rate of return that seems to contradict the efficient market hypothesis. Hypothetically, if the market is totally efficient, then it is impossible to beat the market, and doing so is only due to variance or random chance.

However, we can see that all markets have inefficiencies and therefore can be traded to some degree. The more inefficiencies there are in a market, the easier it is the predict the price in the future (and thus beat the market). In cryptocurrency markets, there are a lot of inefficiencies, and therefore opportunities to make high ROI trades.

There are two main types of market inefficiencies:

Momentum: There are few fundamentals for the price to revert towards. This means that when an asset has been continuously increasing in price, it will continue to do so.

Mean-Reversion: The opposite of momentum. When the price of an asset goes up for a few days, the price will tend to come back down.

How can we trade momentum and mean-reversion inefficiencies?

We can look at historical data of an asset price to see if it tends to revert back to the mean or if it tends to have momentum. Once we determine this, we can figure out how to trade that asset.

On their fiat pairs, it turns out that cryptocurrencies have a strong tendency to have momentum. This could be caused by large price explosions causing more and more buyers to get into the market and hype cycles driving the prices up further.

Tether Audit: FSS Report States All USDT Is Fully Backed, but Can’t Prove It
Related: Tether Audit: FSS Report States All USDT Is Fully Backed, but Can’t Prove It

Some exchanges offer direct fiat to crypto pairs, but most only allow Tether to crypto pairs. Due to the shroud surrounding Tether, I am wary to use it as a counter-currency, and will wait until more competitors such as StableUSD enter the market.

When trading the crypto to fiat pairs, it is important to effectively identify if an asset tends to mean-revert or if it follows price momentum. The ways in which you trade each work in the opposite way you trade the other.

For instance, when trading mean-reversion, you want to buy into weakness, and sell into strength. This is because if the price goes up for a little while it will probably come back down. However, if the asset tends to follow a path of momentum, then you want to do the opposite, buy into strength and sell into weakness.

In the next part of this article series, we will explore how we can use momentum strategies to trade cryptocurrency. This concludes part one of this two-part series, check back tomorrow to read about how we will develop the algorithm.

Disclaimer: The information and analysis in this article are provided for informational purposes only. Nothing herein should be interpreted as personalized investment advice. Under no circumstances does this information represent a recommendation to buy, sell, or hold any cryptocurrency. Past performance is not necessarily indicative of future results and all investments involve risk. My strategies may not be appropriate for all investors and all investors should carefully consider the potential risks of all investors should carefully consider before investing in any strategy.

None of the information in this presentation is guaranteed to be correct and anything written here should be subject to independent verification. You, and you alone are solely responsible for all investment and trading decisions that you make. I am invested in the cryptocurrencies mentioned in this article and gain monetarily from the market. Additionally, I am a software contractor for Stably Blockchain Labs, the company mentioned above.