Automated Market Maker for certain Intrade contracts

[Update on 2008-11-05 11am PST: I've artificially moved the market maker's prices for DEM.PRES-TROOPS.IRAQ upward by a significant amount in order to increase the funds available to the market maker. The response time if Intrade's API has deteriorated badly this morning, and sometime between 9:20am and 9:40am PST my software became unable to do anything useful.]

[Update on 2008-11-01: see this and this report of changes.]

I have implemented subsidies to encourage trading of some conditional prediction market contracts that may provide useful information about the consequences of the 2008 presidential election, via a simple automated market maker (using an algorithm described near the end of http://hanson.gmu.edu/ifextropy.html). The subsidized market maker ought to provide incentives for traders to devote more thought to these contracts than they would if the liquidity was less predictable.

Intrade has agreed not to charge any trading or expiry fees on these contracts.

Some places to look for extensive description of the motivations behind these subsidies are here and here.

The contracts are:

Please read the detailed specifications at Intrade before trading them, as one-line descriptions are not sufficient for you to fully understand them.

For the first two of those contracts, the market maker will enter bids and asks of 38 contracts, and can lose a maximum of $5193.84 on each contract. For the other four contracts, the market maker will enter bids and asks of 115 contracts, and can lose a maximum of $7906.25 on each contract. The orders may not always show as many contracts as the market maker enters because it doesn't update orders in response to partial executions. The market maker is designed to maintain a spread of about 2.5 points or less between the bid and ask (unless the price would drop below 0.1 or rise above 99.9, in which case it only maintains an ask or a bid, not both), and it should place new orders within a second or two after one of its orders is completely executed.

Here is a list of the prices at which the market maker might place orders for the 4 contracts where its order size is 115. It will start at a bid of 48.80 and an ask of 51.20. If a bid is completely executed, it will change its orders to a pair of prices one line lower on this list, and if an ask is completely executed it will change its orders to a pair of prices one line higher on this list. For the two contracts where the order size is 38, the possible prices (listed here) are much closer together when trading is near 50 and farther apart when the prices are far from 50.

If it appears not to be working this way, please notify me at pcm@rahul.net.

The market maker will remain active for the first two contracts until the evening before election night. It will remain active for the others until at least June of 2010.

Log of trades (updated 4 times a day, times are GMT)

source code (in Python).