You are viewing a single comment's thread from:

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

in #cryptocurrency6 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;
}