'How do I retrieve the information about the price of a stock during the after hours, or the pre-market?

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



Solution 1:[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([^']+)'")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1