I'm trying to call this API response using a custom function where I can change the parameters. This is my code:
function callCandles(pair, start, end) {
var response = UrlFetchApp.fetch("https://api-pub.bitfinex.com/v2/candles/trade:1D:" + "pair" + "/hist?limit=1000&start=" + "start" +"&end=" +"end" +"&sort=-1");
var fact = JSON.parse(response.getContentText()); //parse the data from the API and store it in the variable data and convert response to text format//
return fact;
}
This is what I'm typing in the spreadsheet:
=callCandles(tBTCUSD,"1577841154000","1606785154000")
But when I do it I get a "reference does not exist" error.
Thank you.