Live stock ticker data in RDF

Well, on a 20-minute delay.

I've played with finance.yahoo.com's feed of CSV stock ticker data before and recently had an idea that was so simple that I'm surprised that no one's done it before: why not write a script that passes along a request for this data but converts the result to RDF before returning it? So I did.

I supposed it might count as a semantic web service.

A URL like http://www.rdfdata.org/cgi/stockquotes.cgi?symbols=BUD,IBM,SNE asks for recent ticker information about the stock symbols listed in the comma-separated value list. The stockquotes.cgi script adds the parameters to the appropriate stub to create a URL like http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1ohgv&e=.csv&s=BUD,IBM,SNE, uses this URL to retrieve the CSV results, converts them to RDF/XML, and sends that back to the original requester with a MIME type of application/rdf+xml. The whole script, with white space and comments, wasn't even 100 lines. You can click the first link in this paragraph to see an example of it in action.

I haven't done anything with the rdfdata.org domain name in a while, so I thought that would be a nice place for this. I've already used this little web service in a work-related demo that combines and cross-references RDF data from multiple sources, because after all, that's one of the things that RDF is so good at.

Is this a "semantic web service"? All it does is convert the data returned by a Yahoo feed into a different syntax and pass it along. I did throw together a little ontology to name the properties, but it doesn't add a lot of semantics. On the other hand, my script's output syntax is based on a semantic web standard, and it makes the data easier to use in semantic web applications, so I suppose it might count as a semantic web service.

I hope this is useful to others, and I hope that more people look for opportunities to convert live feeds of useful data in simple formats into live feeds of RDF.

7 Comments

http://www.freebase.com/view/user/doconnor/default_domain/views/nyse_companies

Down the bottom are some export CSV links.

Alternatively, you could view the "MQL" (like sparql if it were made of javascript/json), and an MQLread webservice to search for specific ids / matches


Thanks Daniel! I followed through a little there and found http://rdf.freebase.com/rdf/en.the_hershey_company , which is the first good example I've found of RDF from Freebase. I'm guessing that there's a lot more...


Nice service, I challenged myself to write a wrapper on this in 15 minutes, and here's my attempt:

http://marketdata.me/


Bob, any idea why your link makes me download a file named stockquotes.cgi? I wanted to see another example besides Melvin's so I can write something for my own purposes. Thanks.


Erwin,

For both mine and Melvin's, Firefox just displays it, while Chrome and IE want to store it as you described. They store the RDF/XML file that Firefox displays.

I played with the HTTP header returned with the data, but couldn't affect the behavior. The important thing to me is that it works with wget and curl, so that I know that it works as a RESTful web service. It isn't really aimed at browser use. (If it was, I would have had it return an HTML file!)


This looks good. Can you insert more criteria?


That was the best I could do with what I had available.