Wednesday, January 17th, 2007

Stock Quote Charting in Real Time with Comet

Category: Comet, Dojo, Examples, JavaScript, Library

SitePen and Lightstreamer have been working together to create a project that integrates Dojo’s Charting and Filtering Table widgets with Lightstreamer’s Comet server.

The demo shows real-time stock lists that stream through and are charted below.

The full source code for the demo is also provided.

Some people think that Comet isn’t as easy as it should be, and examples like this are good to see.

Dojo Stock List

Posted by Dion Almaer at 12:01 am

3.9 rating from 65 votes


Comments feed TrackBack URI


I sort of expected it to be a CPU hog, but it’s not, that’s a relief.

Some ideas for additional features or improvements:
– A pause button to temporarily stop the updates, for more comfortable analysis
– Tooltips on the charted data points that show precise details
– Not only circles in the plotted lines but also squares, triangles, diamonds, etc to better distinguish the stocks. With 10 items in there, the colors are not distinct enough.

Comment by Michael van Ouwerkerk — January 17, 2007

Wow how nice demo :)

But anyway, I would like to use open source software … So is there any open source alternative to lightstreamer ?

Comment by Nicolas BUI — January 17, 2007

I feel that this is one big advertisement for the lightstreamer server software. It’s a nice demo but it basically shoves you to writing an email to get some pricing information.

Comment by Alex93053 — January 17, 2007

I have a mock stock charts example up and running here:

It uses DWR, and the code is available and simple. All described here:


Comment by Mats Henricson — January 17, 2007

Michael–I’m working on it :) Pause button is up to Lightstreamer, though.

Comment by Tom Trenka — January 17, 2007

I wish I could do real Comet with PHP, I’m so envious.

Comment by Sam "DaMule" Hennessy — January 17, 2007

That’s a very impressive demo.

Comment by Dean Edwards — January 17, 2007

@Michael: agreed, those are great ideas to make it more useful, and not spiking CPU is key to making this stuff usable.

@Nicolas, Alex: This demo should be fairly transportable to work with any of the Cometd implementations that are a work in progress. It would also not surprise me if companies such as Lightstreamer plan to release open source versions of their Comet platforms.

@Mats: very cool to see the DWR love! Perhaps you could plug DWR into the front end version of our demo? I’m sure Joe would like to see that.

@Sam: The single-threaded nature of PHP scares most of us away. At Renkoo, they use PHP for everything except the Comet layer, which is based on Twisted Python.

@Dean: Thanks so much!

Comment by Dylan Schiemann — January 17, 2007

@Dylan: They could package this demo up with a small guide and sell it
for a reasonable price. There are people out there willing to spend $50-200 for something like that (think aspiring students or tech-savy business folks). I can think of several people who need a table like that with the automatic updating for various business purposes but there is no “simple solution in a box”. Businesses usually already have their IT infrastructure in place and are looking for niche solutions that can be added piece for piece ;)

Comment by Alex — January 17, 2007

@Alex: actually, getting the table to update like that is very straightforward; all you need to do is tie a load handler to one of the updater methods on the table itself. The topic subscription on the demo shows how to do it pretty easily.

Comment by Tom Trenka — January 17, 2007

Oracle BAM supports dashboards like this, which are updated dynamically using Comet (actually 1 Comet channel is shared across multiple windows, patent pending). Furthermore, the dashboards are not just updated dynamically, the (40+) chart components actually animate the changes, and all of the tools to build the dashboards are Ajax based. Check out the screenshots (live demo coming soon) here:

Comment by Tal Broda — January 17, 2007

@Tal: “actually 1 Comet channel is shared across multiple windows, patent pending” … hmm, there were implementations of this by people like Know Now/mod_pubsub about 4 or 5 years ago… The UI on the BAM stuff does look infinitely better than it did a year ago though!

Comment by Dylan Schiemann — January 17, 2007

@Alex: We will release a completely free version of Lightstreamer very soon, that will be perfect for most non-mission-critical scenarios. Stay tuned.

Comment by Alessandro Alinone — January 18, 2007

The problem I see with products like BAM is that the graphical representation of data is limited to a few stock charts which are not very good. I have yet to find a product that does them well. The example images from the link are very junky looking. What should they look like? It is by no means perfect but one example would be

Comment by Doug — January 18, 2007

Dylan: last time I looked at KnowNow and mod_pubsub did not share the push channel across multiple windows. The patent for push was granted to another guy who works for Oracle, and I do believe that we have a good chance of getting the patent for “ActiveData multiplexing” granted to us.

Doug: I am not sure what you mean by “limited to a few stock charts” – BAM supports over 40 different data visualizations including inline charts (glyphs in lists). Also the comment “images from the link are very junky looking” is pretty useless.

Comment by Tal Broda — January 19, 2007

interseting blog

Comment by hale — June 21, 2007

Leave a comment

You must be logged in to post a comment.