How I Made Some Crypto Trading Bots
coinflashtrend.com will notify you when Google trends is trending up for your crypto of choice.
I made it after seeing this tweet from Chris Burniske:
It looked like Google trends is correlated with the price of Bitcoin. Cool. The first thing I needed was clean Google trend data. I figured Google Trends would have an API but they don’t, so it’s a little tricky grabbing information from them. If you want to grab a JSON-esque version of a trend up until close to today, use this URL replacing <> with your variables:
https://trends.google.com/trends/fetchComponent?hl=en-US&q=<YOUR QUERRY>&date=now%20<DAYS BACK>-d&cid=TIMESERIES_GRAPH_0&export=3
Here’s the url I used, you see it returns a JSON-esque version of this graph. One of the main problems I have is that the data is always 2 weeks old using this method, today is August 30th but the last date is for the 12th.
If you want the latest up to date trend data you’ll need to use this Google Trend URL and you can get a CSV but you have to click on the export CSV button. I have not figured a way to automate this yet. Tried Java’s HttpURLConnection and HTMLUnit but couldn’t figure it out. Any ideas?
The strategy I use in the ‘Backtest’ section will buy on the first upswing, then sell on the first downswing. Someone on Reddit actually suggested to never sell, just buy on any upswing and then compare this to a strategy where you just buy every week. So that’s on the horizon. But right now, you’ll get notified when an upswing starts in Google Trends through an email. I have a cron job that gets the updated Google trend data every day. Sign up for it!
I also made some other bot strategies, like one that is based on Reddit posts. You can find it here:
The Reddit bot gets the top post from the subreddits ethtrader, bitcoin and litcoinmarkets and runs the title of that post through Google’s sentiment analyzer. This sentiment analyzer API returns a score -1 to 1 depending on if the text you feed is determined to be emotionally positive or negative. You can actually test it out on the Google link above, it’s really cool. I was hoping positive articles about coins is correlated with rising price but that was not the case as you can see above. The sentiment analyzer kind of works but the reddit posts are sometimes about price and other times about more personnel stuff: