Created
April 20, 2020 06:34
-
-
Save mikaelz/11b956c3d2e078105a19dd9df70dbf27 to your computer and use it in GitHub Desktop.
Google script to fetch stock quote data from Yahoo Finance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function YahooFinance(ticker) { | |
var ticker = ticker || "GOOG"; | |
ticker = encodeURI(ticker); | |
var response = UrlFetchApp.fetch("https://query2.finance.yahoo.com/v7/finance/options/" + ticker); | |
var chain = JSON.parse(response.getContentText()); | |
return parseFloat(chain.optionChain.result[0].quote.regularMarketPrice); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment