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:

https://coinflashapp.com/botanalysis.html

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:

You can hover over each point to see the title of the Reddit post and click on the point to see the actual Reddit post. I also have two other strategies on that site, one that buys on every dip detected (slope changes from negative to positive) and sells when the slope of the price goes from positive to negative. I used a simple linear regression javascript function to do this. Finally, I have a strategy that buys or sells based on investing.com. I built a web scraper that grabs whether the site gives a Summary ‘Buy’ or ‘Sell’ for that day under the ‘Daily’ heading.

I was inspired by Dimitry’s daily update on his site coinsheet for that investing.com strategy. Would any of you ever put any money into these bots if I connected the Coinbase API to it?

Follow me on twitter or email me if you wanna talk crypto at info@coinflashapp.com. And check out Coinflash which rounds up your spare change into cryptocurrency which I’m also building.