0

I'm using Google Script and Google Financials to get information for a list of stocks I have in a text file. The problem is that the class FinanceApp just seems to be able to get one stock at a time and since I have to do this for more than 250 stocks I reach the maximum call limit.

Is there a better way to do this?

paddingtonMike
  • 1,441
  • 1
  • 21
  • 37
  • If you are hitting a short term limit, then use an `Utilities.sleep` between calls – Srik Jul 02 '13 at 10:15
  • It's more about the long term. The total number of stocks is around 350, so I can make my application call the script twice, but if I test this too much I reach the daily cap and I feel there must be a more efficient way to do this than to keep invoking the service per every stock when the only information I want is the name and price. – paddingtonMike Jul 02 '13 at 10:45

1 Answers1

0

Since there are limitations and you are making repeted tests, I suggest using a cache : You can then repeat the test without hitting the limit (assuming you request always the same data for the same date, i.e. using StockInfoSnapshot).

You do it by wrapping FinanceApp.getHistoricalStockInfo() so that it serves from the cache if possible, or add to it if info is not available.

The cache could conveniently resides in the "script-related storage" : https://developers.google.com/apps-script/script_user_properties

Good luck !

Offirmo
  • 18,962
  • 12
  • 76
  • 97