RE: Portfolio Rebalancing Tool Using Google Sheets - Quadruple Your Earnings!

You are viewing a single comment's thread from:

Portfolio Rebalancing Tool Using Google Sheets - Quadruple Your Earnings!

in cryptocurrency •  7 years ago 

Thanks for sharing the Google Sheet.

I've added these functions to get data from Bitstamp and Bitfinex. Call them from the cells as you would ccprice (including the last parameter which references the cell I5 that gets updated with the timestamp upon refresh)

function bitfinexPrice(name, datetime)
{
var url = "https://api.bitfinex.com/v1/pubticker/" + name;
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);
var price = data["last_price"];
SpreadsheetApp.flush();
return price;
}

function bitstampPrice(name, datetime)
{
var url = "https://www.bitstamp.net/api/v2/ticker/" + name + "/";
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);
var price = data["last"];
SpreadsheetApp.flush();
return price;
}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!