Skip to content

Instantly share code, notes, and snippets.

function getYahooPrice(symbol, datetime) {
symbol = symbol || "NSE:PANACEABIO";
// symbol = symbol.replace("NSE:", "") + ".NS";
Utilities.sleep(Math.floor(Math.random() * 5000))
var url = 'https://query1.finance.yahoo.com/v7/finance/download/'+ symbol + '?interval=1d&events=history'; // last one day history
Logger.log(url);
var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
if (response.getResponseCode()) {
var textFile = response.getContentText();
if (textFile.indexOf("Date") != -1) {