Functions like GOOGLEFINANCE are only updated when the spreadsheet is open by a user, there isn't a Google Apps Script method that is able to do this. The closest is SpreadsheetApp.flush() but this only makes that the changes made by the script be pushed to the spreadsheet.
One alternative is to rethink your model and take advantage that ...
A workaround that solves the above is getting the Close price for the stock for a range of days before and after the date in question, and then querying the result for the most recent price on or before that date, like this:
=QUERY(GOOGLEFINANCE("GOOG","Close",DATEVALUE("1/1/15")-5,6),"select Col2 where Col1 < date '2015-01-02' order by Col1 desc limit 1"...
To further help with this answer. I tried tb11's answer and did not work for me June 2019. It was the URL that was the issue. I picked another site with a simpler URL and it worked for me. Sample below.
Google, if you ...
Whenever it refreshes, the data is copied as opposed to new data being
added. It seems like it is adding the formula itself to the
spreadsheet as opposed to putting in the value itself.
If I understand correctly, you want the columns to keep a "snapshot" of the prices at the time the column was added, rather than have the values continue updating.
to get the whole set of Open | High | Low | Close | Volume you need to use one currency per the formula:
=GOOGLEFINANCE("USD", "ALL", TODAY()-1)
=GOOGLEFINANCE("EUR", "ALL", TODAY()-1)
another drawback is historical data limitation:
for USD it's 2/1/2007 16:00:00
for EUR it's 2/4/2014 16:00:00
that can be checked with these formulas:
I had the same problem. Sometime during the day, yesterday's data suddenly appeared. What I did was adding the current price to the bottom like this:
Where A1 is the ticker, and A3 is a start date.
The key word in your formula is not Query but GOOGLEFINANCE.
Your query is correct. But please take into account the following.
As mentioned under GOOGLEFINANCE documentation page:
attribute is one of the following for historical data:
"open" - The opening price for the specified date(s).
"close" - The closing price for the specified ...
I think this will help you
=INDEX( IF(ISNA(GOOGLEFINANCE("NSE:"&A2,"high",TODAY()-1))=TRUE, IF(ISNA(GOOGLEFINANCE("NSE:"&A2,"high",TODAY()-2))=TRUE, GOOGLEFINANCE("NSE:"&A2,"high",TODAY()-3),GOOGLEFINANCE("NSE:"&A2,"high",TODAY()-2)),GOOGLEFINANCE("NSE:"&...
This actually kind of makes sense. If the 2nd parameter of GOOGLEFINANCE is "priceopen" it tries to fetch the open price but by adding a historical date to it DATE(2019,4,12) the 2nd parameter is confused because on that date there is no open price. On that date is only closed price at this moment. In other words: "the historical open price" is called "open"....
Welcome, Eric! Google Finance tracks exchange rates. The syntax is:
where BRLCAD is the two currencies, in this case Brazilian Real to Canadian Dollar, in ISO 4217 format.
Use that as your multiplier to convert from source shares to their value in the new currency. For example, if your price is in A2,
= A2 * GOOGLEFINANCE("...
Other option is using the CurrencyConverter function from this Google Sheets add-on.
It is fast and and has simple syntax. For example,
=CurrencyConverter(100, "USD", "EUR", "2/28/2020")
Disclaimer: I am author of this add-on.
Here is a formula for computing historical stock volatility using log price changes (returns) over the last 50 days (B is the ticker column):
query(GoogleFinance($B2,"close",WORKDAY(TODAY(),-50),TODAY()),"select Col2 label Col2 ''")/
As the yahoo and google finance API's to use them from google apps script are deprecated, I think the only way to work around it is to generate googlefinance queries from the script as strings and write them in the sheet. Then, once we enter in the sheet those queries are sent.
I don't think this is the most elegant way of do this, and it's also pretty ...
I used to be able to pull it from google finance, but that stopped working for me a little while back. I found another one. It's not quite as clean, but it is working for me as of March 2019.
In column B, put your ticker symbol
In column C: =IF(NOT(ISBLANK(B12)),GoogleFinance(B12,"Price"),"")
This will populate the current price, which is used in the next ...