An AI-powered Twitter bot predicts Bitcoin’s price

k4rim
5 min readMar 29, 2022

--

I’d like to share my story about how I made an AI-powered Twitter bot that predicts Bitcoin’s price. There’s a summary at the bottom for those who don’t have time.

The bot’s Twitter profile link: @predictBTC

Introduction

First of all, I’d like to introduce myself. I’m a student who loves cryptocurrency, artificial intelligence, and coding. I’ve been coding since I was 15-years old. I made several AI projects like face mask detector, image captcha solver, etc.

Where did I get the idea?

Every time Bitcoin goes into a correction, I get crushed. I was so frustrated because every time I long, the price dumps. Every time I short, the price pumps. It was mainly because of my fear and greed emotions.

I tried to look up ways to control them, and I stumbled upon an article that mentioned that I should use trading bots. “How I didn’t think of this?” I said to myself, “Lemme try making one”.

My First Try

I spent the next week trying to make a trading bot. My goal was to make one that scores at least a 51% win rate. I decided to make it use MACD and RSI indicators to predict the color of the next candle. Around 600 lines of code later, it was the time for back-testing.

“Back-testing is the general method for seeing how well a strategy or model would have done ex-post. Back-testing assesses the viability of a trading strategy by discovering how it would play out using historical data. If back-testing works, traders and analysts may have the confidence to employ it going forward.” — Investopedia.

A Horrible Fail

How did the back-testing go? Let’s say it didn’t end up very well. After testing the bot on all of the top ten cryptocurrencies’ historical data, it scored 50.72%. It’s not bad, you might think. But wait until you see what I discovered.

I ran the back-testing simulation with a $1,000 demo balance. After running the bot through Bitcoin’s historical data, it ended up being around $100,000. I was so happy until I discovered that if the bot had bought and HODLed, it would have ended up being $300M. So technically, it’s worse than just buying and HODLing.

I tried changing the indicators the bot uses, changing the trading timeframes, I even tried to train the bot on chart patterns, but it just wouldn’t pass that $300M mark. I give up.

My second try

Around two months later, I learned how to code artificial intelligence programs. I decided to try again. This time, the bot will use artificial intelligence. I have to give it Bitcoin’s last candlesticks, and it should generate predictions for me.

I successfully trained the AI model with around 80 years of candlesticks data. It was time for back-testing. I still remember how I was sweating as I had just done a chole ting workout. I ran the simulation, and the $1000 demo balance ended up being $1M.

Hope at the end of the tunnel

I was going to punch my computer, but I noticed something weird with the bot’s trend accuracy. I ran a more detailed test and found that the bot’s predictions direction accuracy is around 60%. It means that the bot is not bad at predicting what direction will Bitcoin’s price go. But still, it’s not accurate at predicting the exact price of Bitcoin.

I knew that it was impossible to make such a bot that passes that $300M mark, so I decided to use my current one with 60% trend accuracy to help me do technical analysis. I also had the idea to make a Twitter bot out of it to share its forecasts with the globe.

Nothing great comes that easy.

I thought it would be easy to create an accurate predictions bot as those blogs said. It was a tough journey. It took me at least a month of late nights to make it. The lesson I learned is to never ever give up. I know you hear that a lot, but nobody takes it seriously. If I had given up after failing on my first try, I wouldn’t be writing this now to inspire others.

Summary

Before I learned about artificial intelligence, I made a price predictor bot for Bitcoin that burned weeks of my time in exchange for inaccurate predictions. It was a horrible fail.

Months later, after taking AI courses, I decided to try again. This time, it worked. But it wasn’t as accurate as I expected. I accepted that no such thing predicts a cryptocurrency’s price with 100% accuracy.

I left my dream of letting that bot trade for me, and I used it to create a Twitter bot that helps others expect the unexpected.

Takeaways

  • Never ever give up. I know you hear that a lot, but nobody takes it seriously. If I had given up after failing on my first try, I wouldn’t be writing this now.
  • Nothing great comes that easy. The best things take work.
  • It all starts with a tiny, stupid idea, then one thing leads to another, and suddenly, you find something amazing.

--

--

k4rim

A human who loves cryptocurrency, entrepreneurship, and programming.