Show HN: Google Sheets GOOGLEFINANCE() reliability enhancement https://ift.tt/Sjo7EQU
Show HN: Google Sheets GOOGLEFINANCE() reliability enhancement Anyone who uses GOOGLEFINANCE() for stock/ETF prices and then logs your total portfolio assets daily (by trigger), knows that it is not 100% reliable. What I wanted was something that would use the last good data point if GOOGLEFINANCE was failing. So I added caching to solve this problem. There is also another issue that GOOGLEFINANCE is particularly bad with Canadian stock symbols. It also does not find stock/etf dividend yields. For this I query a few finance websites to pull in the missing info. Now the problem looking up a couple hundred symbols using =CACHEFINANCE() (my custom function) was the dreaded 'Loading' error, which would also cause asset tracking to fail - so... I also added the capability to run as a trigger function, so it has now been 100% success for my logging. The app script will create a trigger for each job required (i.e. pricing is one, yieldpct is another, etc.). It will also automatically exit and re-start the trigger if it can't get through all requests before the 6 minute mark (a Google restriction). This is especially needed with the 'Yieldpct' because all data is found using URL fetch - which is much slower than a working GOOGLEFINANCE. I have made this an open source project if you want to use the Google Apps Script. Please let me know of any suggestions to help improve going forward. This version works for me, but of course the first person using other than me will probably find something wrong. I'm sure my README.md could use some further enhancements. https://ift.tt/UkFzBqQ November 25, 2022 at 04:12AM
Comments
Post a Comment