3

How do I retrieve the information about the price of a stock during the after hours, or the pre-market? For example, I can use the formula =googlefinance("TSLA","price") which will retrieve the price of the stock during regular hours. However, it will not show the price during after hours and premarket hours. Thank you

BigBen
  • 46,229
  • 7
  • 24
  • 40
doglover123
  • 103
  • 1
  • 1
  • 6

1 Answers1

1

I have derived the script and made it work using sole sheet formulas. The pre/after market values are fetched from this link:

Pre market:

=regexextract(importxml(A1&"TSLA", "/"), "Pre Market Last([^']+)'")

After market:

=regexextract(importxml(A1&"TSLA", "/"), "After Market Last([^']+)'")

Output:

output

Note:

  • I have separated the link from the ticker for it to be reused to other calls as well, but you can just use it directly like this:
=regexextract(importxml("https://app.quotemedia.com/quotetools/jsVarsQuotes.go?webmasterId=101264&symbol=TSLA", "/"), "Pre Market Last([^']+)'")

and

=regexextract(importxml("https://app.quotemedia.com/quotetools/jsVarsQuotes.go?webmasterId=101264&symbol=TSLA", "/"), "After Market Last([^']+)'")
NightEye
  • 10,634
  • 2
  • 5
  • 24
  • Thank you so much. How do I enter in that script? I have no experience with this unfortunately. Thank you again for your time. – doglover123 Mar 23 '22 at 14:36
  • 1
    Hi @doglover123, I have simplified my answer to a google sheets formula equivalent solution. If this answered your question, please click the accept button on the left (check icon). By doing so, other people in the community, who may have the same concern as you, will know that theirs can be resolved. If the accept button is unavailable to you, feel free to tell me. [how to accept answer](https://stackoverflow.com/help/accepted-answer) – NightEye Mar 23 '22 at 15:54
  • Hi @NightEye, your formula is so handy. Is there a way to get "price change percentage after market" directly from your formula and the web, instead of price or calculating it again from the last close price? Thank you so much for your great tip! – Newbie Nov 30 '22 at 02:57