Created
May 3, 2020 09:20
-
-
Save mikaelz/73e1b4f00256720e00d4f22fa92e1807 to your computer and use it in GitHub Desktop.
Google Spreadsheet script to fetch Dividend Yield from https://fmpcloud.io/plans
This file contains 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 DivYieldTtm(ticker) { | |
var ticker = ticker || "GOOG"; | |
ticker = encodeURI(ticker); | |
var response = UrlFetchApp.fetch("https://fmpcloud.io/api/v3/ratios-ttm/" + ticker + "?apikey=YOUR_API_KEY"); | |
var result = JSON.parse(response.getContentText()); | |
return parseFloat(result[0].dividendYielTTM); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment