我正在使用Yahoo YQL来获取资产负债表,现金流量和损益表。我已经使用API密钥和secret成功访问了Yahoo私有数据。我的环境是nodejs并使用yql-node包。 (仅粘贴损益表的代码)
var yqlXML = require('yql-node');
var yql = require('yql-node').formatAsJSON();
var yqlWithOAuth = require('yql-node').formatAsJSON().withOAuth('MY CONSUMER KEY','MY CONSUMER SECRET');
var query = "select * from yahoo.finance.incomestatement where symbol='GOOGL';";
yqlWithOAuth.execute(query, function(error,response){
console.log("yqlOAuth:");
console.log(response);
res.send(200, response)
});
输出:
{
"query":{
"count":1,
"created":"2018-07-02T08:25:26Z",
"lang":"en-US",
"diagnostics":{
"redirect":[
{
"from":"/ec?url=http%3a%2f%2fwww.datatables.org%2fyahoo%2ffinance%2fyahoo.finance.incomestatement.xml&t=1530519925&ttl=60&sig=30LaeEg9C76HXrrgGCBZyQ--~D",
"status":"307",
"content":"http://www.datatables.org/yahoo/finance/yahoo.finance.incomestatement.xml"
},
{
"from":"/ec?url=http%3a%2f%2ffinance.yahoo.com%2fq%2fis%3fs%3dGOOGL%26quarterly&t=1530519925&ttl=60&sig=UyfrUX.GkUohZ1AAEXRAvQ--~D",
"status":"307",
"content":"http://finance.yahoo.com/q/is?s=GOOGL&quarterly"
},
{
"from":"/q/is?s=GOOGL&quarterly",
"status":"301",
"content":"https://finance.yahoo.com/q/is?s=GOOGL&quarterly"
},
{
"from":"/q/is?s=GOOGL&quarterly",
"status":"302",
"content":"https://finance.yahoo.com/quote/GOOGL/financials?ltr=1"
}
],
"url":[
{
"execution-start-time":"0",
"execution-stop-time":"19",
"execution-time":"19",
"content":"http://www.datatables.org/yahoo/finance/yahoo.finance.incomestatement.xml"
},
{
"execution-start-time":"21",
"execution-stop-time":"639",
"execution-time":"618",
"content":"http://finance.yahoo.com/q/is?s=GOOGL&quarterly"
}
],
"publiclyCallable":"true",
"javascript":{
"execution-start-time":"20",
"execution-stop-time":"640",
"execution-time":"620",
"instructions-used":"5058",
"table-name":"yahoo.finance.incomestatement"
},
"user-time":"641",
"service-time":"571",
"build-version":"2.0.287"
},
"results":{
"incomestatement":{
"symbol":"GOOGL",
"timeframe":"quarterly"
}
}
}
}