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#?
Asked
Active
Viewed 1,620 times
0
-
1perhaps you could have done a google search for example [C# and Quandl API examples](https://www.quandl.com/blog/getting-started-with-the-quandl-api) this came up as one of the first choices – MethodMan Jan 25 '16 at 22:11
-
Do you know anything about parsing? – JB King Jan 25 '16 at 22:38
-
I know nothing about parsing. @JBKing – Michael Lemmer Jan 25 '16 at 22:40
-
http://stackoverflow.com/questions/8975961/parsing-xml-data-using-c-sharp could be useful in how to use the XML classes of C# to read the data so that it could be useful for you. – JB King Jan 25 '16 at 22:42
-
But how do I get the data in the 1st place? @JBKing – Michael Lemmer Jan 25 '16 at 22:47
-
Make an account. Understand which data sources may charge you and be prepared for that. – JB King Jan 25 '16 at 22:58
-
https://www.quandl.com/docs/api#introduction would be my suggested starting point for understanding the API configuration. – JB King Jan 25 '16 at 23:00
-
But how do I code it? Like if I wanted to store a stock price into a variable or something. I've been looking at their API documentation and I'm not getting anywhere. @JBKing – Michael Lemmer Jan 25 '16 at 23:03
-
How are you wanting this to work: Console Application, Windows Application, Mobile Application, Web Application or something else? I did write some code once to get data from Quandl on a web application a year ago now though first you need to have a key, know what data set you want to use and then built the URL to get that data using your key so Quandl knows who is accessing which dataset. Do you at least understand that much? – JB King Jan 25 '16 at 23:06
-
Yeah, I understand that, I signed up and have a key and I get that you have to pick a data set. I want to make a console app that prints a stock price. I have no clue on how to implement that functionality though. @JBKing – Michael Lemmer Jan 25 '16 at 23:16
-
Ever look at how to write a "Hello World" console app? That does tend to be the first program written for developers in a new language or platform. – JB King Jan 25 '16 at 23:45
1 Answers
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();

allez l'OM
- 547
- 4
- 13