Loading stock quotes from TD Ameritrade developer app into Sheets with Google Script

落爺英雄遲暮 提交于 2020-04-30 06:39:10

问题


I'm trying to use an API from TD Ameritrade to load stock info into a Google Sheet.

I've tried the following code:

var ticker = "APPL"

    var headers = {"Authorization":" Bearer <access token>"}
    var options = {"headers":headers}

    var calltoAPI=urlFetchApp.fetch("https://api.tdameritrade.com/v1/marketdata/"+ticker+"/quotes?apikey=<myapikey>",options);

I get the error: ReferenceError: urlFetchApp is not defined (line 6, file "Code"). However, in my developer app, I do get a return on APPL. Worth mentioning I'm not sure what belongs as the authorization Bearer access token and if that is the problem or part of a problem. I really don't know what to do next. The code was copied from this thread. I added my question there but it was deleted for not being helpful, so I'm asking you all instead.

来源:https://stackoverflow.com/questions/61314712/loading-stock-quotes-from-td-ameritrade-developer-app-into-sheets-with-google-sc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!