views:

433

answers:

1

Hi All,

I wanted to know how does behind the scene technology works when we see stocks streaming on websites like CNN or CNBC.

I believe its an applet but would highly appreciate some detail explanations.

Thanks.

+3  A: 

There's no need for an applet. Those quotes are the time-delayed quotes (15-20minutes old) A simple AJAX query is all that is necessary to grab a whole bunch of quotes every minute or so.

Your browser makes an Asynchronous http request to the CNN webserver, and some javascript on your PC implements a scrolling div or similar to show the data. Before the data runs out, the browser makes another query to get more data.

No need for an applet. You could use Flash to do the same thing, but it's not necessary.

Chris Kaminski
@darthcoder: how can one get real time quotes w/o delay ?
Rachel
For real time no delay quotes you need a direct line to the stock market trading floor, those cost real money.
Karl
There isn't a free API for quotes without a delay. And even if you found a website that you could screen-scrape, this would probably be a violation of their Terms of Service, not to mention whatever laws happen to protect financial data. IANAL, though.
David Brown
@Rachel: sign up for a real-time quote service, like from TDAmeritrade or Fidelity or Etrade. Those are almost always a Java applet. Those will have open socket connections sucking down realtime data for the symbols you are interested in. And the applet also, in theory, makes it harder to steal the real-time data for uses or sharing with people who don't pay the entry fee. Last I checked, you could get a real-time feed from TDAmeritrade for $50/m or so.
Chris Kaminski
You don't need a direct line to the exchange floor, but price climbs dramatically the closer to real time you get. If you are building a website it is almost definitely not worth the investment in real time streaming data.
John MacIntyre
@David Brown-do you know of a free API for delayed quotes? Thx
John MacIntyre
I wrote a bit of code that queries Google finanace and extracts the quote. It's a simple bit of URL retrieval and text parsing. I do this only for my own testing purposes. Anything I'd do for business I'd make sure I had a reliable feed source.
Chris Kaminski
Thank you all for the useful information. It really helped :)
Rachel