Search code examples
google-sheetsgoogle-sheets-formulagoogle-financegoogle-finance-api

How to fetch price for a specific date from GoogleFinance?


I tried below syntax to fetch the close price of specific date:

=GOOGLEFINANCE(<Symbol_Name>,"price","07/09/2020")

While it works perfectly for US stocks, the result for Indian stocks are incorrect. For example: if you query for July 9th, the stock quote is fetched from July 10th. See below screenshots:

US Stock

Screenshot 1 - US Stock

Indian Stock

Screenshot 2 - Indian Stock

How to make this work for all stock symbols irrespective of date or timezone?


Solution

  • From the GOOGLEFINANCE docs:

    Dates passed into GOOGLEFINANCE are treated as noon UTC time. Exchanges that close before that time may be shifted by a day.

    Considering that the NSE closing time is 3:30 PM at India timezone (UTC +5:30), that's before noon UTC time (10:00 AM). Therefore, it gets shifted by a day, as expected.

    Modifying the spreadsheet timezone won't produce any change. The best option I see here is to keep track of which tickers will get shifted and ask for the previous day instead.

    Reference: