Google Sheets App Script code for CryptoCurrency price tracking #Javascript

I do a lot of crypto currency trading on and I made a Google Sheet to help me keep track of my return on investment on each of the currencies in my portfolio, as well as an overall ROI for my entire portfolio.

Both and provide free public API’s that will return current prices, market cap, volume, and other useful information.  Free to use and you do not need to provide authentication.

With Google Sheets you can add your own scripts to execute and return values you can use in a worksheet calculation. Just like how you would enter “=SUM(A1:A5)” in a cell to add the values of cells A1 – A5, you enter the name of your custom function.

To enable scripts for your Google Sheet, open a sheet then click Tools > Script Editor…

This will open a new window with a basic environment for you to write your custom functions. The language is Javascript and there are loads of fun things you can do.

Heres a code snippet for Google Sheets App Scripts you can use to get the last price of a cryptocurrency, convert to USD, and display the result in a cell.

function updateBittrex(crypto) {
var btc = UrlFetchApp.fetch("" + crypto);
var j1=JSON.parse(btc.getContentText());
var btctousd = this.btctousd();
var con = btctousd * j1.result.Last;
return con;

function btctousd() {
var converted = UrlFetchApp.fetch("");
var json1 = JSON.parse(converted.getContentText());
return json1[0].price_usd;

The API returns values in BTC, so if you use USD as your Fiat currency as I do, its helpful to convert it into USD for easier reference.

In order to use the custom functions you have to authorize your add-on to run in your Google Sheet. From within the Script Editor, click Run > Test as add-on. Next in the Configure New Test, choose – Test with Latest Code, and under Installation Config choose, “Installed and Enabled”. Then click the Select Doc button and choose your Worksheet. Click save and you should see this. Click the radio button for the doc and click Test.

Now when you’re in a cell and wish to retrieve the last price for Monero, for instance, simply enter “=updateBittrex(“XMR”)” and the script will get the last price for Monero, get the last price for a Bitcoin in USD, and return the last price for Monero in USD.

Heres an example using Ethereum. The column $ per coin has the value “=updateBittrex(“ETH”)” in it.

3 ways to program

There are three ways you can write code to output what you want given some input, and here are some characteristics of each.

1. The “Easy” Way – this is generally the fewest lines of code, the shortest execution time, uses the most native functions available and is easiest to read

2. The “Hard” Way – the code is lengthy, needs a lot of code comments, is difficult to test and feels like its forced to get the correct result.

3. The “Wrong” Way – characteristics of either #1 or #2, and it throws an error.

The challenge is then finding the way from #2 to #1.

Why I mine crypto currency

I started mining cryptocurrency on August 26th 2017. My first rig was a purchase from a friend of mine, looking to get out because the rig was noisy, generated a lot of heat and he wasn’t interested in having it running 24/7/365. Can’t say I blame him.

But then why would I buy it from him? It wasn’t for the used hardware discount, it wasn’t because I thought I could make millions in a month or a year (I knew better of course) it was because for me cryptomining was the perfect confluence of two things I love, working with computer hardware and a vision of a disruptive monetary system that may finally provide greater global economic equality.

It’s easy to get preachy about the (potential) benefits a medium of trade that is NOT based in any country, language, government, standing army, law, creed, or religion could provide. The distribution of crypto-currencies by their nature cannot be owned or dictated by any group or individual, and literally any person on planet Earth can gather up the necessary resources to essentially ‘print money’. Yes there is the initial investment of a few hundred USD(or 0.00001 BTC at the moment), yes there is the knowledge and expertise required, and yes mining requires a LOT of electricity. But you can do this anywhere. You don’t have to convince a land owner or park board they should let you roll your heavy equipment into the pristine wilderness so you can disrupt a beautiful stream turning over millions of tiny rocks looking for the shiny one. You don’t have to even own any land or property at all. You don’t have to be rich, violent, or elite. You, yes you anonymous person browsing internet, can print money.

A crypto transaction does not require any third party. No middlemen, no bank, no government just two people with their own wallet address and a high strength password to lock it. I can send you $10 in Bitcoin and literally no one else would know about it, unless they knew my and your wallet address. Oh, here’s one of my bitcoin wallet addresses if you want to send me some. 32TrweJNrYbSsMJPcjczxDRpEUPyz13Drb

Good luck guessing someones wallet address by the way. It has been estimated that the number of possible wallet addresses is equal to the total number of grains of sand on planet Earth if each grain of sand was another planet Earth with as many grains of sand. But each transaction on the Bitcoin blockchain is FULLY visible and public, so there is transparency built in. Right now you can see how much Bitcoin someone has in their wallet and the transactions that have used that wallet.
Continue reading Why I mine crypto currency

Burned 1000 calories in an hour yesterday, because there was no way I could do it.

6.2 flat treadmill miles took 64 minutes, didn’t stop running until 50 minutes and only because my sock had bunched up inside my shoe and I was worried about getting a blister. Around minute 30 my left leg started tingling like it was falling asleep. I’ll chalk that up to circulatory system fatigue.

I never thought I’d be able to finish. Well, I should say I anticipated forcing myself to finish, but somewhere in my mind was this voice saying “he probably won’t be able to do it, and that’s ok” But this voice only made me want to finish even more. I hate that condescending voice. I imagine its a nice looking gentle talking woman, and shes talking about me to someone else IN FRONT of me. That special kind of “don’t say it to his face, but he’s not really a star, he’s just what we have to work with for now”… voice.

I’ve got this panel of experts in my head that determine whether or not I should try and run another minute. “At minute 15, let’s go to 16 and then we’ll stop” they say before retreating back into their conference room full of monitoring equipment and charts. They are the board, the planners, the strategizers that come out every once in awhile and tell the bridge officers and engineers responsible for controlling all bodily functions to run at this speed for this long. These bridge officers and engineers trust them and do whatever they say. They in turn promise to report any and all abnormalities which is always just pain and suffering and yelling “we need to stop – soon!” They also place orders for inspirational music and to inject adrenaline to kick it into high gear, ignore knee and hip pain. They also keep watch on other runners at the Y who are so obviously competing with me (they aren’t). I just watch the whole thing unfold while I continue to make the same motions with my legs and arms. Sometimes I turn the whole thing off and just stop running and walk instead. Usually its because my stomach hurts or I don’t have the inspiration to keep beating my feet. I’ll never take for granted what it’s like to run while in pain, and I headshakingly think about all those endearing historical figures I’ve read about who have.

When you’re trying to get in shape you do crazy stupid insane things like running without stopping for 50+ minutes. Who does that? Not me. Which is precisely why I had to at least try it. If I failed, so what, try it again later I guess – or don’t, it doesn’t matter. Die and restart the mission from the last time you saved like a video game.  If you fail to run as fast or as far as you were trying to, you don’t really die and because you at least tried to make it, you’re that much further along when you try again. Amazingly this is how getting in shape works. You have to keep pushing yourself, but you get to keep what you accomplished. This concept was hardly established whenever I had thought about exercising to get in shape.  I figured each and every time I could force myself to exercise it would be just as painful, depressing and difficult as the first time. Boy was I wrong. It gets easier until you choose to make it harder, but it’s not hard just because you’re exercising. Of course, if you don’t exercise at least once every 2-3 days, your accomplishments turn to a fine powdery sand and simply disappear.

A lot of people get in shape after a mid life crisis or a big event in their lives like, ahem, getting divorced after being married for 13 years. For me, it was a lot of things. I can’t say for certain I had (am having?) a midlife crisis, because I don’t like to minimize or commonly categorize the effort and brutal hard work I’m voluntarily putting into getting in shape. Why couldn’t I be the one who wasn’t fat, and could run 5k and 10k marathons? Why not me? Is that a midlife crisis? I don’t care.

For many, getting divorced means changing their lives entirely. So while this upside down world is taking shape, why not lose 30 pounds? I in fact initially went the opposite direction. I took on some pretty self-destructive habits like smoking and drinking (more than normal) for the sole purpose of showing myself I can a) do whatever I want, whenever I want and b) am tough enough to do drink all that, and smoke all those and not die or get sick, and I didn’t but I was certainly very sad and depressed.

A weight loss competition inspired me to just at least try and get in shape and lose weight. I wanted to beat my co-workers who were all 10 years younger than me. Screw them and their higher basal metabolic rate. I’m gonna hit this ball so far out of the park it’s gonna smash through windsheilds in the parking lot. So far I’m winning that competition. I went from 219 to 198 in 3 months and looking to have lost even more at the final weigh in on May 9th.

I’m gonna run for an hour every other day until May 10th. Dammit.

This –

5 things I enjoyed about Rogue One: A Star Wars Story


Rogue One. It’s the movie that outlines what happens between Episode 3 and Episode 4. It’s the movie that explains why, why was that Correlian freighter being boarded in the opening scenes of A New Hope. It’s the movie that gracefully moves from the unknown (introducing an entirely new set of characters and back stories) into the known – the beginning of A New Hope and where we find out just what it took to get those Death Star plans. Here’s a short list of 5 things I enjoyed about this moving epic war movie. Continue reading 5 things I enjoyed about Rogue One: A Star Wars Story

Herodotus and Thucydides, the odd couple of Greek history

The following is a fictional, anachronistic conversation between Herodotus (regarded as the “Father of History”) and Thucydides (regarded as the “Father of Scientific History) on how history should be recorded and it’s importance to society.


Herodotus: I’m writing this down. There was a great number of battles, a lot of people died or were injured, many more were displaced and moved far from home. Since it was a war with Persia, I’ll call it the Persian wars.


Thucydides: Ok ok, but let’s not talk about all the help the gods gave them or how it was just a silly random group of events that all happened one after another without any semblance of causality. Seriously, that’s not history.

Herodotus: You would say that, although I don’t disagree. Mostly though, I think its good to celebrate the heros and talk about the Persian people as a thoughtful and morally centered civilization. There’s no need to be completely dry and boring about something that truly was not.

Thucydides: The only reason I require facts and dismiss romance is as a means to show how it really doesn’t matter who is fighting. Man is going to conquer, man is going to take things from others, and the demagogue will only work to limit the reach of the statesman. You for some reason, have to find something interesting or entertaining in order for it to be historical.

Herodotus: If history was only the dimensions of the oars on the ships in the harbor, no one would care. I know this may seem weird to you, but 99% of our audience can’t read.  The only way for this information to be passed from one to another is if they tell each other or hear it from an entertainer.

Thucydides: I get it. In fact I too value information about the past to be used in the present and future – with one caveat, that it be used to teach and inspire.  There’s no point in forwarding the story of a hero who slain dozens of enemies if the story doesn’t somehow provide value to the polis. Measurements, tactics, laws, things of intrinsic value are all useful pieces of the past that can help us move forward.  Otherwise, every year we would discover gold.

Herodotus: True, but you’re seriously limiting your audience to people who are able to use that information, and even within that group, to the people who care to look to the past whilst thinking of the future. Not everyone does that.  My point is, if you can tell stories of greatness and examples of high morals, they will be more useful to the polis because they will apply to more of it.  The future is a waste of effort if it is duplicated on the premise that the only things learned from the past is weights and measurements.

Thucydides: It’s not that simple, and we are both saying so. I only wish that my history be devoid of the romance and hyperbole that sacks truth and replaces it with nonsense. We’ve come a long way from Homer, but let’s not go backwards.

Herodotus: I think history will tell us we are both right.

Thucydides: Agreed.

MSP Airport Noise

Metropolitan Airports Commission noise staff monitored airplane noise Aug. 22 through Sept. 4 with temporary Remote Monitoring Towers, each with a noise monitoring radius of two miles. MAC staff worked with city representatives to choose the three sites.

This map shows the study area, the sites of the three temporary noise monitors, each monitor’s two-mile radius for measuring noise and typical departure operations at Minneapolis-St. Paul International Airport.

So if you hate plane noise, live in St Paul or Bloomington. Heck, even Richfield right west of the airport is quiet.Microsoft Word - NOC November 2014 Meeting Packet.docx