How Do I Use the Quandl API?

岁酱吖の 提交于 2019-12-13 07:27:22

问题


I'm using C# and I want to know how to use the Quandl API to get data via xml, like a stock price. I've never used an API before so I'm really lost. I was looking at their quick start guide, but I don't understand how something like "https://www.quandl.com/api/v3/datasets/WIKI/FB.xml" gets you anything. How do I make the API work? Can I even do it with C#?


回答1:


With javascript you'd rather use the json format of your chosen dataset: https://www.quandl.com/api/v3/datasets/WIKI/FB.json, instead of https://www.quandl.com/api/v3/datasets/WIKI/FB.xml. Then write a classical XMLHttpRequest:

var url = "https://www.quandl.com/api/v3/datasets/WIKI/FB.json";
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = function() {
    var data = JSON.parse(this.responseText).dataset.data;
    // {}.dataset.data is the data matrix in Quandl
    // then process your own way
}
xhr.send();


来源:https://stackoverflow.com/questions/35003290/how-do-i-use-the-quandl-api

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