Last night I was “googling” for something, I don’t even remember what.
I started to type “How much” … I was a little surprised by the suggestion that Google made.
How much is a bitcoin worth? The first suggestion implies that this is being searched a lot. I checked Google Trends, to see what kind of interest there was.
Yep, the term has never been more popular, a lot more popular than any time before.
So what exactly are people getting when they search for this?
The first page of results is filled mostly with news articles about the then price of Bitcoin, a couple of links to some charts, and a conversion rate calculator.
I was surprised to not find a one page website that answered the exact question that was being asked, how much is a Bitcoin worth?
Although I typically stay away from long domain names, the recent success of willrobotstakemyjob.com got me thinking what is at howmuchisabitcoinworth.com turned out there was nothing there because the domain wasn’t even registered.
This morning I was sitting down to watch some English Premier League, my team Liverpool was playing Brighton and Hove Albion, and I thought how hard could it be to build a Single Page Application to display the current price of a bitcoin?
There are a number of API’s available for finding the current price of crypto currencies, not just bitcoin. I decided to use the CoinMarketCap API.
It is a very straightforward JSON API, which provides more than just the current price, which is all I’d need right now, but allows for future features.
I started a new Laravel project, pulled in the Bootstrap 4 front end framework, and about 2 minutes later I had a page that showed the current price of Bitcoin.
The game was just getting going, still tied 0–0, what else could we add to the page to make it more appealing? What if we could show some products you could buy for the price of a Bitcoin?
Amazon is one of the biggest online retailers and has a pretty extension API to search and display product details.
I knew we could get the current price of a Bitcoin, but the chances of products costing exactly the current price were slim. I could take the current price and expand it by some percentage, to get a range. A better range might be the low and high price for the last 24 hours. The range might be tight on some days, but the price has been quite volatile lately so the range has been large enough to find a good number of products.
I signed into my Amazon account and setup things to access the Products API. I hadn’t written any more code yet, but started testing the API. I knew the current price, and the range that I’d be working with. I tried to search the API with those parameters.
Given the current price of a Bitcoin (about $11,000) and the fact that the Products API requires certain criteria, such as category and keyword, I was getting some “interesting” results. Network switches and playground sets featured prominently.
It was half time, Liverpool leading 2–0, time to rethink things.
Searching Amazon for products at specific price with randomly selected keywords and categories, wasn’t going to produce interesting matches to show users.
What if we flipped things around. We pre-selected the products, based on what was currently selling well, or the in-demand product, and estimated how many of that product you could by with a Bitcoin?
For example, a 13" MacBook Pro, Retina Display, i5, 8GB RAM, 256GB SSD is listed at $1,499, a Bitcoin could be worth $11,050 or 7.37 MacBook Pros, or 36.95 Nintendo Switch (which retails for $299). Now that’s a pretty interesting.
By now Liverpool were leading 3–1, time to write some code.
I found a Laravel package that would make it easy to pull up-to-date prices for goods, used the price I already had for Bitcoin, and the calculation for how many of each product was pretty easy.
I searched Amazon for the some popular holiday gifts, and built up a list of about 15 products to start with.
I decided I would randomly select show 3 of those 15 products to show each time the page was loaded.
By the time the game ended, Liverpool won 5–1, I had a finished page.
Should I release this, make it available to other? I built it while watching a soccer match! It achieves it’s purpose, and would require no maintenance. I decided to asked Twitter.
Only a small fraction are saying no, so off I went. Decided to deploy the site on Heroku, and setup the DNS:
How Much is a Bitcoin Worth?
The value of a Bitcoin in USD and popular goods
You can now visit the website I built while watching my team win 5–1, that answers the burning question that show many are asking … how much is a Bitcoin worth?
If we are in a Bitcoin bubble that will soon burst this was a wasted 90 minutes, if not then the website might be getting visited for a long time to come!
Update: I wanted to some additional pricing information, and it turned out to be easier to get it from CryptoCompare, so I switched out the API.