1
votes

I'm having issues getting my stock quote to work since Google did some changes at their end. I have read the information on this link google finance json stock quote stopped working but it didn't help.

The earlier URL to fetch information was this https://finance.google.com/finance/info?client=ig&q= and as we know it no longer works.

Below is my code. Can someone kindly help please!

var gstock = ["BOM:500209", "PPY:000001"];
for (var i = 0; i < gstock.length; i++) {
    $.getJSON("https://finance.google.com/finance?client=ig&q=" + gstock[i] + "&callback=?", function (response) {
        var stockInfo = response[0];
        var stockString = '<div class="stockWrapper"> ';
        stockString += '<span class="stockDirectionValue' + getGlyph(stockInfo.cp) + '"> ' + '</span>';
        stockString += '<span class="stockText">BSE:</span>';
        stockString += '<span class="stockPrice">' + stockInfo.l + '</span>';
        stockString += '<span class="stockChange">' + stockInfo.c + '</span>';
        stockString += '</div>';
        $('.stockBSE').prepend(stockString);
    });
}
1

1 Answers

-1
votes

google seems to have changed their interface url from:

http://www.google.com/finance...

to:

http://finance.google.com/finance...