What started off as a fun and interesting time-waster looks like it might turn into a fun little side programming project now. The fine folks at BlogShares have released an XML-based API. What’s exciting is that this morning trading functionality was added. This means that by passing the appropriate querystring you can execute a buy order without logging into the site.

So, since I’m feeling a little stagnant these days, programming-wise, I’m going to work on building a C# Windows Form application to act as a trading proxy… a “bot”, if you will. The idea is that I already have a few set queries that I use to accumulate money outside of major actions like hostile takeovers. It’s fairly repetitive; run query, buy 1250 shares of all blogs in that query. Wait 20 minutes. Buy another 1250 shares in the same blogs. Lather/rinse/repeat until I’ve purchased all available shares, raising the price a few hundred percent in the process. Wait 6 hours, and dump all shares. The way I figure, I can automate the whole thing. Here’s my rough idea of how this will work:

  1. Pull the results of the query into a DataSet. Initially since I’ll only be using this application myself, I’ll have my queries hardcoded in, but I’ll work on either a) having an interface in the application to be able to dynamically create queries or b) being able to pull stored queries from my BS(BlogShares) account.
  2. Step through dataset and fire off a buy transaction for each record. I’ll want this to be threaded (but nicely, so I don’t pound the BS(BlogShares) server… maybe only 5 threads at a time), so I’m guessing I can borrow some code from this article on creating an RSS news aggregator.
  3. Have another process which looks at stocks in my portfolio for blogs that still have public shares available, and I haven’t bought in the last 20 minutes (the limit for consecutive purchases of the same blog), and buy available shares of those.
  4. A third process which will sell off any stocks that haven’t been bought in the last 6 hours (again, a game limitation) and remove the stocks from my portfolio.

I’m getting excited about the prospect; I think it will be a cool/interesting thing to do, and I’ll be posting sourcecode/files along the way, if I think that anything is worth sharing with people. ;-)