Thursday, April 11, 2013

How I Made ~2,340% Profit With Bitcoin And Trivial Code

The other day, right before the latest Bitcoin price spike crashed, I sold half a Bitcoin for about $117.89. I had bought this Bitcoin for about $10, so I think my math is very approximately correct when I call that a 2,340% profit. A 100% profit on a $5 investment would have been another $5.

In other words, I sold at the height of a bubble. Lucky me. But the answer is not just luck. The answer is shell-scripting the web.

Two years ago, I wrote a simple Ruby script to screen-scrape Bitcoin prices (in USD) and create a simple web page with the latest price. Then I plugged that into an hourly cron job and wired up the DNS for btcusd.gilesb.com. I didn't do it because I actually cared very much about Bitcoin prices. What I did care very much about was not looking at the hideous price-tracking web sites which existed at the time. I was too used to plugging my currency conversions into Google searches, but you couldn't do that for Bitcoin yet at the time (and maybe you still can't).



However, after I built this little mini-app, because of a very useful side effect, I saw its one tiny web page every single day, several times a day, and in the process developed a very detailed intuitive feel for the volatility of Bitcoin prices. And then, when I sold my Bitcoin, I just happened to do it very close to the peak of the latest bubble. Coincidence?

Here's how the side effect happened. At the time I wrote btcusd.gilesb.com, Safari was my only web browser on my iOS devices, and iOS Safari has a number of very poorly-conceived quirks, the worst being that any time you open it on an iPhone, it will idiotically jump to your Bookmarks, as if bookmarks were a feature which normal people ever even use. I began developing muscle memory for the task of closing the bookmarks and switching to the search field, but it struck me what a terrible maladaptation that was, so I decided to do something else instead.

I developed a simple habit for my iPhone of always keeping a web page open which had a simple DOM and a very fast page-loading time. (DOM simplicity can be more important than actual network loading speed when it comes to perceived performance.) I chose Hacker Newspaper for this purpose.

Hacker Newspaper is a miniapp like btcusd.gilesb.com, but for Hacker News, which I had written a few years earlier. I wrote it because Hacker News makes (in my opinion) terrible and obvious mistakes in typography, color theory, and web application performance, as well as terrible but subtle mistakes in application design. Anyway, Hacker Newspaper loads very quickly and renders very quickly, because it features a simple DOM, and very few external assets, so it got me around the usability fail in iPhone Safari. But btcusd.gilesb.com loads and renders even more quickly, with an extremely simple DOM, zero external assets, and also zero distracting links, so I made that my default launch page for Safari on the iPhone instead.

That was in 2011. It's 2013. I've seen the Bitcoin price fluctuating nearly every day since then, sometimes very many times per day. I've never given it a lot of attention, but I didn't have to. I've developed an enormous amount of context for Bitcoin prices as a side effect. (This is why I firmly believe you have to be judicious about what information you consume, both actively and passively.)

Anyway, my massive profit percentage is in fact just a tiny sliver of actual dollars. However, what I plan to do is continue using btcusd.gilesb.com this way, and buy BTC again when I feel they've hit a low. I'm willing to trust my intuition in this regard because I've developed it against a lot of data. Although this is just intuition, I expect the price to dip quite a bit at some point in the future, and I have very logical reasons to expect that I'll be among the first to know if/when that happens. Having tested this system with a small amount of money, I'm willing to experiment with a larger amount next time.

Of course this is not financial advice, and although I think some sane solution for Bitcoin and taxes will emerge, this is not legal advice either. But it is programming advice. You should shell-script the web. Hacker News annoyed me, so I fixed it with a tiny mini-app, really not much more than a shell script. Google didn't extend its automatic currency conversion to BTC, so I fixed that with a tiny mini-app too, again not much more than a shell script. And then I used that shell script mini-app to avoid Apple UX fail, and made an absurd profit percentage as a side effect.

Shell script all the things. The web is full of broken. Fixing even the little problems can accidentally net you huge profits.