Bitcoin Trading Bot

This Blog Post was originally published on the platform "writelier" (formerly "co-writers" and "200wordsaday"). Sadly the blogging platform was discontinued. I downloaded all my blog posts and prepared them to be republish them here.

I started working on a simple Bitcoin Trading Bot again. I was experimenting with different exchanges in the past and got some money left over from previous trades that I could use to experiment.

The base idea goes as follows:

  • every our buy Ethereum with Bitcoin until no Bitcoin is left (Market Order)
  • as soon as no more Bitcoin is left, calculate the average buying price of all previous orders
  • use the average and the maximum price to calculate a suitable sell order (for now this step will be manual)
  • set the sell order with the desired price and start over again.

The important thing is that I should never sell under the average price. As long as I'm above that one, I will always gain money.

For now, I'm only experimenting with about 2 € per buy order. Because of that, I'm only gaining a few cents on every round but it also has a very small risk.

For example, I had 4 buy orders with an average price of 0.0252375 BTC/ETH, a max price of 0.02530 BTC/ETH. I placed the limit order at 0,02570 BTC/ETH. As soon as the final trade goes through I will have gained 0.00003531 BTC or at current rates 0.24€ with an invention of about 13.85€

Which concludes to a 1.73% gain. The only question is when the limit order will go through and realize my gains. The highest price of BTC/ETH today was at 0.02574 so the order could be filled today. If not I can still move the price down until I'm reaching the average price. Selling at the average price would mean I don't lose anything.

It's a simple algorithm and as long as the market doesn't go crazy it should work out. Many pennies make a dollar.

Subscribe to Philipp Haidenbauer | Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe