PS:334 – Small Coding Project

While I’ve wrapped up a few things on the docket (foof) I took a little time tonight to write a small tweak for a project of my own related to crypto currency.

I replicated a Google Spreadsheet (link) from BiteSize Bitcoin (link) and while it was designed around my Litecoin investment, you can just as easily adapt it to handle Bitcoin or any other alt-coin you like, it simply helps log your transactions.

Now I have a much more complex version rolling now which is a single sheet for all my assets across alt-coins etc. and it contains things like the type of transaction (purchase, trade, mining) as well as some general profit statements across the board.

Now the one thing I wanted to have was a live updated current coin cost, and I used an importXML function someone posted on a video, however, it was slow & tended to time out with “too large” of a dataset to crunch so I wrote this small PHP app:

$url = file_get_contents("".$_REQUEST['coin']."&tsyms=".$_REQUEST['curr']."");
$json = json_decode($url,true);
print $json[$_REQUEST['curr']];

And that’s it. 3 lines to get exactly what I need, and I simply use the Google Sheets command: =IMPORTDATA(“”) – That’s it. With that in place and the coins.php made, when I load my sheet to record or review where I’m at – math is all done for me based upon the current rates in my currency! See the example? It’s a break down to BTC in USD currency, so the current USD for Bitcoin. Easy peasy.

Must say all and all, very happy with the code, of course back to the real world, as if I can wrap a few projects this week, I’ll survive back to school! (oi!)

1 thought on “PS:334 – Small Coding Project”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: