In the past I used this ruby script to poll for the current stock data and put it into a database to create a little history.
Recently I saw a new feature on the yahoo finance homepage. Now it is possible to enable a streaming option and then you get a live update on certain values via AJAX. So I thought why not get this feature and let yahoo stream the content to the client instead of polling the server from time to time.
GET /streamer/1.0?s=^GDAXI,USD=X&o=^N225,LHS.F,JI4.F,EEX.F,HEI.F,CBK.F,PRE.F,NDX1.F&k=c10,g00,h00,l10,p20,t10&j=c10,l10,p20,t10&r=0&marketid=us_market&callback=parent.yfs_u1f&mktmcb=parent.yfs_mktmcb&gencallback=parent.yfs_gencb HTTP/1.1
Here is what I got on this request so far:
parameter ‘s’ -> symbol on the main site (what you currently looking at)
parameter ‘o’ -> that is the ticker on the top
parameter ‘k’ and ‘j’ -> that are the values that are transferred
c10 -> unknown
g00 -> day low
h00 -> day high
l10 -> current price
p20 -> unknown
t10 -> timestamp
a00 -> ask
b00 -> bid
With that data you can build a Push-Client with your own custom data. Here is a sample Request for what I needed.
(Streaming the current ‘ask’, ‘bid’ and ‘price’ values for the stocks ‘BEI.F’,’SIE.F’ and ‘PRA.F’.)
The response for that looks like that:
No you can parse that document for the requested Data. But be careful because the html structure is never closing (at least not as lang as the streaming goes on).