As someone commented yesterday, my blog recently has mostly been movies reviews. There are three reasons for this:
  • We've suddenly had a glut of good movies to go and see (well movies we wanted to go and see, even if some disappointed).
  • I've been ill. Not severely most of the time, but enough that I've been working slowly and taking it gently to make sure I get well
  • I've been involved in a project that has taken a fair amount of time to polish off.

That project is pictured above. Melanie Swan commissioned a "solid histogram in Second Life to show stock market prices" and I (finally) delivered. There will be a fuller write up of the technical details on my main website soon - I'm going to be developing this, with her continued support, into a more generally usable tool for plotting histograms, and once that's ready, the main website as well as the blog will gain some new pages.

There are some nice bits to point out here though. The script in SL pings a web-server every minute. That server scrapes both the google stock market data for current prices, and the yahoo pages for historical prices, does some fancy footwork and returns the values to be plotted. The script takes that return and converts into these bars. In case, like me, you don't follow stock-markets, the top of each bar is the highest trading price each day, the bottom the lowest trading price. The colour indicates if the overall value rose or fell. The final column (on the right in the image) is a little different - that is today's values, and you can see a little red blip on the edge of it. That is actually a "sleeve" which shows the variation from the opening price to the current price on the same basis, giving you some real time data.

In addition, if you want to see different stocks displayed, you can touch the histogram, say the name of the stock and it will display that stock price for 5 minutes before reverting to the default stocks. (This will only work correctly if the yahoo and google ticker symbols are the same.)

The twiddles? Well the sleeve changed what was displayed part way through, and required some reworking. Displaying data for "today" when the markets were closed was interesting. Displaying nothing before the markets opened proved relatively easy. However, at some point after the markets close, yahoo updates its page to include "earlier today" into the historical data. Working that out to have the google pages input suppressed and the yahoo pages historical data shown hit a couple of bugs and has a relatively ugly, but working, hack in there.

I describe this histogram as 2.5D (a mathematician I spoke to described it as 5D). The height of the bars, and their left-right position are signficant, as are their colours, giving you two spatial dimensions and a 0.5 for colour. One obvious, and hopefully soon to be implemented addition will be to add a third dimension to the bars... their depth, to display additional data (open and close values in the stock-market for example).

Following that, the whole lot will be adapted to make it relatively easy to read data from a notecard, or from a scraper that you write (so there will be a "plotter script" and a "data provider script" that can be changed to suit your needs. Melanie has already made the stock-market histogram freely available as open source from her offices in Second Life. As these additional tools come along, they will also be open sourced and available from Melanie.



  • Melanie Swan  
    Hi Eloise, thanks for the comprehensive project description, and for the great project.

    You definitely did some creative footwork to manage the difference data sources and times at which they do things!

    It would be nice to have a next version of the stock bars include Open, High, Low, Close and other dimensions of data.

    I am excited about more people streaming data into virtual worlds for display and interaction, starting a data visualization group and offering more open source tools.
  • Graham Mills  
    Nice project, El, and many thanks to Melanie for making them open source.
  • Jean-Claude Bradley  
    Very nice Eloise - I look forward to playing with this for scientific applications. Do you have a way of zooming in interactively to different time frames?
    • Eloise  
      Not at the moment no - it's not relevant to the current system.

      That said, the current system supports changing the display, it should be relatively easy in the add on to write something as a plug-in to scrape the data for a different time-frame and display it.
  • Jean-Claude Bradley  
    If there is ever a display tool that reads JCAMP-DX format that would solve the general problem of displaying any scientific spectrum. But you would need that zoom functionality to make it usable.
    See here for how JSpecView does it.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
BBCode format allowed

Submitted comments will be subject to moderation before being displayed.