The script below makes use of Coinbase API, bash arrays, and gnuplot to generate a basic short-term analysis of bitcoin prices. I will also show you how to run this script in background mode using tmux and send the output to a Web page using seashells.

The bitcoin is difficult to analyze. Is it a currency, a commodity, a speculative asset? It’s all of those things but not entirely. I choose to look at cryptocurrencies as a massively multiplayer online game.

Calling bitcoin value a “bubble” or a “pyramid scheme” is misleading. Cryptocurrencies just don’t fit into our usual financial toolbox and our definitions need some work. In the meantime, it’s every man for himself.

I can’t tell when bitcoin price will change or by how much. Having said that, because there are people involved, every change carries kinetic energy, if you will. A sudden drop in price, for example, causes a panic-driven sell-off that will eventually exhaust its momentum. This second derivative – acceleration and deceleration – is what we can analyze reasonably well.

Here’s a sample script output:

The graph shows the past three hours of bitcoin spot price just to help you visualize the trend. Consider the following line from this example:

60 95.97 .64% 95.02 .64% 97.90 .65

The fields are:

  1. Summary of changes for the past 60 minutes
  2. Change in BTC spot price in USD
  3. Change in BTC spot price in %
  4. Change in BTC sell price in USD
  5. Change in BTC sell price in %
  6. Change in BTC buy price in USD
  7. Change in BTC buy price in %

The last line of the output:

δ .70 . -149.63 -1.00 150.33 .99

The fields are:

  1. n/a
  2. Difference between fields 4 and 6
  3. n/a
  4. Difference between sell and spot prices in USD
  5. Difference between sell and spot prices in %
  6. Difference between buy and spot prices in USD
  7. Difference between buy and spot prices in %

The second field on the last line gives you an idea of where the price is heading and how fast. A positive double-digit number, for example, shows that Coinbase is raising the buy price that is indicative of high demand. That number a time-trend analysis of its own, if I have time…

Now, to run this script in background mode I suggest using tmux. Here are some useful shortcuts. To send the output to a Web page, I recommend seashells. Some info here. Here’s an example of installing and running everything on a CentOS system:

Now you can start a new tmux session, run the btcticker script in background mode, redirecting to seashells.io, and detach from the session:

Obviously, since the maximum time interval in the script is one hour, it will take that long for the data array to become fully populated.

If you forgot to grab the serving at https://seashells.io/v/* line, just re-attach to the tmux session (tmux a -t btcticker), activate the scrolling mode (CTRL-b [), use the page-up key to get to the point where you started the btcticket script and copy the URL. Then exit the scroll mode (q) and detach from the session (tmux detach).

The script is below and you can also download it here.

 

Leave A Reply

Please enter your comment!
Please enter your name here