Building a pseudo real time Second Life Stock Exchange Ticker
Today, I received an email letting me know that the Virtual Stock Exchange on Second Life (VSTEX) had added a data feed, http://www.vstex.net/export/ticker/. They join the Second Life Capital Exchange (SlCapEx) and ancapex.net in providing this sort of data.
For sometime, I’ve been taking advantage of the SlCapex and Ancapex feeds, so the new feed from VSTEX was a welcome addition. Initially, I took my script for parsing the Ancapex feed and modified it to handle the Vstex feed. However, that left me with three different scripts running at the same time; three different windows showing what was going on in the Second Life markets.
So, I’ve now combined these scripts into a single script, and added a little additional information. The script checks each feed every three seconds. If any of the values have changed, it saves the information in a database and displays the information on the screen. It also displays an asterisk after each polling. This gives a good visual indication of whether the feeds are still being parsed as well as how long it has been since there has been an update.
I’ve been running the new script for about half an hour now, and so far it looks very promising. Here is an example of recent output:
11-15-07 20:38:31 LAST: ANCAPEX:ESN 1.47 (1.05 1.45 1.47 0.275862068966) 11-15-07 20:38:31 LAST: ANCAPEX:RIS 1.95 (1.61 1.95 1.95 0.174358974359) ******************************************** 11-15-07 20:42:12 ASK : VSTEX:AVC 0.22 (0.20 0.22 0.23 0.0909090909091) ***** 11-15-07 20:42:36 ASK : VSTEX:AVC 0.23 (0.20 0.23 0.23 0.130434782609) ************************** 11-15-07 20:44:47 BID : ANCAPEX:ESN 1.06 (1.06 1.45 1.47 0.268965517241) ******************************************** 11-15-07 20:48:27 BID : VSTEX:AVC 0.19 (0.19 0.23 0.23 0.173913043478) ******************************************************** 11-15-07 20:53:13 BID : SLCAPEX:LNL 0.60 (0.60 0.72 0.71 0.166666666667) **************************************** 11-15-07 20:56:33 ASK : ANCAPEX:ESN 1.44 (1.06 1.44 1.47 0.263888888889) ******* 11-15-07 20:57:08 BID : ANCAPEX:BNT 0.23 (0.23 0.25 0.26 0.08) ******************************************************************************** ************* 11-15-07 21:04:53 BID : SLCAPEX:SLR 0.50 (0.50 0.54 0.50 0.0740740740741) 11-15-07 21:04:53 LAST: SLCAPEX:SLR 0.50 (0.50 0.54 0.50 0.0740740740741) ******************************************************************************** **
The Second Life capital markets are starting to take sufficient shape such that building more interesting tools, such as to track real time Profit and Loss, give buy and sell signals, calculate indices, and so on will make sense. One of these days, I’ll start feeding it all through a complex event processing system.