Live stock ticker data in RDF

Well, on a 20-minute delay.

I’ve played with’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,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,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 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.


By Daniel O’Connor on January 12, 2010 9:51 PM

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

By Bob on January 13, 2010 12:43 AM

Thanks Daniel! I followed through a little there and found , which is the first good example I’ve found of RDF from Freebase. I’m guessing that there’s a lot more…

By Melvin Carvalho on January 15, 2010 8:52 AM

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

By Erwin on June 7, 2010 11:38 AM

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.

By Bob on June 7, 2010 1:32 PM


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!)

By stock trading newsletter on July 14, 2010 9:36 AM

This looks good. Can you insert more criteria?

By Bob on July 18, 2010 9:19 AM

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