Just to add to the links above, one of the important things to implement would be <a href="http://en.wikipedia.org/wiki/Kelly_criterion">http://en.wikipedia.org/wiki/Kelly_criterion</a> which will help figure out the optimal size of bets given the expected odds in a series of bets.