SGX Stopped Supporting Google Finance
The first thing is that SGX have stopped allowing investors to use GoogleFinance() to get update to date last trading price information of their stocks.
This affected many folks including myself who rely on GoogleFinance to pull latest stock prices.
This means that you either have to rely on manually entering the prices on a frequent basis, or rely on Yahoo Finance.
This seems a little odd. It keep giving an error that there is an issue in this lineMaybe you guys can try out this simple google script for a more interval update of the prices. this method is a bit sloppy but it seem to be working fine. it update about 1min interval which is the smallest interval of the google script trigger.
The steps are:
1) Open the stock portfolio tracker -> go to Tools -> Script Editor
2) Paste the code below and save it.
3) Resource -> Current project's trigger -> Add new trigger -> chose the following:
- Run: intervalUpdate
- Events: Time-driven
- Minutes Timer
- Every Minute
4) Save again.
How it work?
It should be because the "Yahoo Data Ref" take reference from the column F of "Stock Summary", when u edit it, it will refresh the data inside the yahoo data which in turn pulled out new updated data for column G of "Stock Summary". The script change the data at every minute interval and thus it like getting new data every minute.
PHP:function intervalUpdate(){ SpreadsheetApp.getActiveSpreadsheet().toast("","1-Min Update"); refreshData(); SpreadsheetApp.getActiveSpreadsheet().toast("","1-Min Update Done!"); } function refreshData(){ var sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Stock Summary"); var range1 = sheet1.getRange('F2'); var data1 = range1.getValue(); range1.setValue("Temp"); //Utilities.sleep(200); var sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Stock Summary"); var range2 = sheet2.getRange('F2'); range2.setValue(data1); }
I dunno what codes he writing
I using just simple one liner and i get my prices fine
It's bad code like those that are abusing the free price feeds...
The trigger runs every minute regardless whether you have the sheet open or not. So every day, ONE COPY of the spreadsheet with the trigger script attached will fire 24 x 60 = 1440 requests to fetch price data, even when nobody is looking.
Hi, has anyone faced the issue of Google sheets crashing? My sheet is an adapted sheet from investment moats and after opening it for the first time in 2 weeks, it's crashing and causing Firefox browser to crash too. Even opening in the Android app causes the app to crash.
hi there, this is kyith from investment moats. perhaps you can try creating a copy of the same spreadsheet and see if it solves the issue. Mine crash like no tomorrow as well. Creating a new one solves that.
For those using google spreadsheet that who want almost real time quote. Here is the google apps script that will scrape quote from Yahoo ecn e.g. http://finance.yahoo.com/q/ecn;?s=YHOO.
Just go to Tool > Script Editor and cust & paste.
Code:function getYahooRTprice(symbol) { var rtPriceStr=UrlFetchApp.fetch('http://finance.yahoo.com/q/ecn?s=' + symbol).getContentText(); rtPriceStr=rtPriceStr.replace(/\n/g,""); var strlength=rtPriceStr.length; var loc = rtPriceStr.search("time_rtq_ticker"); loc=rtPriceStr.indexOf(">",loc); var loc2=rtPriceStr.indexOf("<",loc); while (loc2-loc<=1 && loc2 < strlength) { loc=rtPriceStr.indexOf(">",loc2); loc2=rtPriceStr.indexOf("<",loc); } return rtPriceStr.substr(loc+1,loc2-loc-1)*1; }
