How to get Bittrex prices into Google Sheets

in #crypto7 years ago (edited)

If you are anything like me, you love to have a google sheet with all your coins listed with their value. - This can be a bit tricky as a non-programmer, as it requires reading API docs, and generally debugging things. So here are some simple instructions on how to get the value of a cryptocurrency into a google sheet.

Step 1: Create a google sheet:


As a non-programmer, it can suck trying to read the API docs. So here is something to copy and paste. It's terrible, but it works for me.

Step 2: Create the code that talks to Bittrex

2.1 Open the script view

## 2.2 insert script
script.PNG
and here it is for copy and pasting:

function Get_Bittrex_Last(market)
{
// Example inputs are BTC-LTC,BTC-ADA
var url = "https://bittrex.com/api/v1.1/public/getticker?market=" + market;
var response = UrlFetchApp.fetch(url);
var text = response.getContentText();
var myjson = JSON.parse(text);
var lastprice = myjson.result.Last;
return lastprice;
}

Don't forget to press the save button

Step 3: Add the market name and the coin amount

sheet.PNG

You can see the function being called using

=Get_Bittrex_Last(C3)*E3

Where cell C3 contains the exchange name in this case

BTC-ADA
and then multiply that by E3 that contains the number of coins - in this example: 100

Step 4: Profit!

And there you have it, you can now create a google sheet that automatically shows you your Bittrex wallet (as long as you keep it up to date)

End note: Updating

Updating in Google sheets sucks for these sorts of functions. The easiest way I have found today is to simply select the cells with the function in, delete it using the 'del' key, then press ctrl-z to undo. And when it undoes, it updates. - Awful, but it works.

Sort:  

Can you upvote back my posts ? :D itll be appreciated if you do

Well why not. Im trying to figure out what Steemit is all about.