2

Does anyone know if it is possible to get the price of a stock using =googlefinance from a time stamp? Dates are fairly easy but it does not seem possible to do times on days? for example if I wanted to look at GOOG for 10:00AM 21/12/2020

=index(GOOGLEFINANCE("GOOG","price","21/12/2020 10:00:00"),2,2)

That provides the stock for that date but not the time. I am not sure if it's possible but it would be very useful in a sheet I am making.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
B33T
  • 21
  • 1
  • 2

2 Answers2

1

Unfortunately, you can only retrieve the closing price of a particular day or days but not specific times.

When you pass a historical data as an argument, google assumes that you are looking for the closing price. Therefore, if you choose either "price" or "close" for a past data, you will get the same results.

The official documentation for the attribute "close":

"close" - The closing price for the specified date(s).

therefore getting the closing price of a particular time is not possible.

For example, this will return the price for each day, starting from 21st of December 2020 until 30 days later:

=GOOGLEFINANCE("GOOG","price","12/21/2020",30,1)

or this =GOOGLEFINANCE("GOOG","close","12/21/2020",30,1)

enter image description here

you see that the closing price time is fixed at 16:00:00.

If you want real time historical data you should look for other APIs that you may need to pay.

Marios
  • 26,333
  • 8
  • 32
  • 52
-1

You can filter once you get the values

As an example, you can retrieve the prices at 13:xx:xx hs or 16:xx:xx hs by using regular expressions and QUERY:

=ARRAYFORMULA(QUERY(GOOGLEFINANCE("GOOG","price","12/22/2020",30,1), "SELECT * WHERE Col1 matches '.* 13:.*|.* 16:.*'", 0))

Or you can filter just one specific hour:

=ARRAYFORMULA(QUERY(GOOGLEFINANCE("GOOG","price","12/22/2020",30,1), "SELECT * WHERE Col1 matches '.* 13:.*'", 0))

References

Jose Vasquez
  • 1,678
  • 1
  • 6
  • 14