BlogShares Developer API
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":http://www.blogshares.com/ have released an "XML(eXtensible Markup Language)-based API":http://blogshares.com/api/. What's exciting is that this morning trading functionality "was added":http://blogshares.com/news.php?id=249. This means that by passing the appropriate querystring you can "execute a buy order(Example of a successful buy order)":http://blogshares.com/api/successful_buy.xml 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(Example query that returns the first 500 blogs that have public shares between 1000 and 5000)":http://www.blogshares.com/api/query.php?publicshares_min=1000&publicshares_max=5000 that I use to accumulate money outside of major actions like "hostile takeovers(My takeover of /.)":http://feralboy.com/log/archives/000346/. 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:
# Pull the results of the query into a "DataSet(DataSet class on MSDN)":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataDataSetClassTopic.asp. 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. # 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(MSDN - Creating an Online RSS News Aggregator with ASP.NET)":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp on creating an RSS(Rich Site Summary) news aggregator. # 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. # 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. ;-)