Kelly Criterion and Optimal Betting Strategy

Ziyi Zhu

Ziyi Zhu / November 24, 2022

6 min read––– views

Kelly is given credit for the idea of using log utility in gambling and repeated investment problems, as such it is known as the Kelly criterion. Kelly has shown not only that log is the utility function which maximizes the long-run growth rate, but that this utility function is myopic in the sense that period-by-period maximization based only on current capital is optimal. Therefore, a sizing scheme that uses the Kelly fraction generally finishes with more wealth than any other chosen proportional scheme.

Kelly criterion

Consider the scenario with Bernoulli trials, where one wins with probability pp and loses with probability q=1pq = 1 - p. Kelly's analyses showed that maximizing the long-run growth rate of the investor's fortune is equivalent to maximizing the expected value of the log of each period's wealth. If the payoff is BB for a win and 1-1 for a loss, then the edge is BpqBp - q, the odds are BB, and the expected capital growth is given by

ElogW=plog(1+Bf)+qlog(1f)\mathbb{E} \log W = p \log(1 + Bf) + q \log(1 - f)

where ff is the fraction of wealth wagered on each of the trials. The optimal wager for this is

f=BpqB=edgeoddsf^\star = \frac{Bp - q}{B} = \frac{edge}{odds}

In this case, we are not maximizing expected wealth but typical wealth as the average values are heavily distorted by the unlikely scenarios where the trader wins every trade. By maximizing the logarithm of expected wealth we eliminate the possibility of bankruptcy.

The adoption of logarithmic utility follows from the general idea of declining marginal utility of wealth, where marginal utility should be proportional to current wealth. That is, rich and poor alike worry the same about a 10% shock to wealth. Equivalently, the utility of spending 10% of wealth on something is the same at all wealth levels. This idea is also called risk aversion and concavity which is crucial in modern decision theory.

Optimal betting strategy

Edward O. Thorp discusses the general theory of optimal betting over time on favourable games or investments in the book The Kelly Capital Growth Investment Criterion. Favourable games are those with a strategy such that

P(limNWN>0)=1P\left( \lim_{N \rightarrow \infty} W_N > 0 \right) = 1

where WNW_N is the investor's capital after NN trials. One feature of sports betting which is of interest to Kelly users is the prospect of betting on several games at once. This also arises in blackjack when (a) player bets on multiple hands or (b) two or more players share a common bankroll.

Suppose we bet simultaneously on two independent favourable coins with betting fractions f1f_1 and f2f_2 and with success probabilities p1p_1 and p2p_2, respectively. Then the expected growth rate is given by

g(f1,f2)=p1p2log(1+f1+f2)+p1q2log(1+f1f2)+q1p2log(1f1+f2)+q1q2log(1f1f2)\begin{aligned} g(f_1, f_2) =& p_1 p_2 \log(1 + f_1 + f_2)\\ &+ p_1 q_2 \log(1 + f_1 - f_2)\\ &+ q_1 p_2 \log(1 - f_1 + f_2)\\ &+ q_1 q_2 \log(1 - f_1 - f_2) \end{aligned}

To find the optimal f1f_1^* and f2f_2^* we solve the simultaneous equations g/f1=0\partial g / \partial f_1 = 0 and g/f2=0\partial g / \partial f_2 = 0. Simultaneous sports bets were generally on different games and typically not numerous so they were approximately independent and the appropriate fractions were only moderately less than the corresponding single bet fractions. However, in some cases where we bet on correlated markets within the same sports event, neglecting the correlation between different outcomes would result in significant deviations from the optimal betting fraction.

An extreme correlation often can be exploited to great advantage through the techniques of hedging. The risk-averse investor may be able to acquire combinations of securities where the expectations add and the risks tend to cancel. Note that the optimal betting fraction may be very large when the estimated edge is high or odds are low.

Numerical approximation

Consider the general case where x\mathbf{x} is the vector that represents the outcomes of nn events with joint probability distribution P(x)P(\mathbf{x}). Then the expected growth rate is given by

g(x)=log(1+fx)P(x)g(\mathbf{x}) = \sum \log(1 + \mathbf{f} \cdot \mathbf{x}) P(\mathbf{x})

It is important to note that for an exact solution or an arbitrarily accurate numerical approximation to the simultaneous bet problem, covariance or correlation information is not enough. We need to use the entire joint distribution to construct the gg function. Here we consider two simple cases where the outcomes are either mutually exclusive (joint probability of events is always zero) or independent (joint probability is the product of marginal probabilities):

def expected_growth_rate_coeff(f, probs, odds, mode="exclusive"):
    if mode == "independent":
        outcomes = np.stack(list(itertools.product([0, 1], repeat=np.size(f))))
        p = np.prod(np.where(outcomes, probs, 1 - probs), axis=-1)
    elif mode == "exclusive":
        outcomes = np.identity(np.size(f))
        p = np.copy(probs)
    return np.sum(p * np.log(1 + np.sum(f * (outcomes * odds - 1), axis=-1)))

We can use numerical methods to maximize the expected growth rate and obtain the optimal betting fractions.

def kelly_criterion(probs, odds, mode="exclusive", allow_short=False):
    tol = 1e-6
    bound = (-1 + tol, 1 - tol) if allow_short else (0, 1 - tol)
    con = {'type': 'ineq', 'fun': lambda f:  1 - tol - np.sum(np.abs(f))}
    
    res = minimize(
        lambda f: -expected_growth_rate_coeff(f, probs, odds, mode),
        np.zeros(np.size(probs)),
        bounds=[bound] * np.size(probs),
        constraints=con,
        tol=1e-12
    )
    return np.array(res.x)

One interesting observation is that this method automatically takes advantage of the arbitrage betting opportunities in mutually exclusive events by placing the maximum fraction in a bet for a guaranteed profit. However, in practice, there are certain risks involved with arbitrage betting such as bet cancellation and odds slippage. These uncertainties can result in unmatched bets which would require many successful bets to make up for the loss.

Strategy comparison

We can use Monte Carlo simulation to compare the performance of different betting strategies by repeatedly sampling from the same probability distribution of outcomes and plotting the profit over time in a logarithmic scale. The result shows that sequentially betting on every single event gives a much worse performance than the optimal Kelly strategy that considers the joint probability distribution.

image

As we saw in the simulations, Kelly's sizing is exceedingly volatile. To deal with these extreme drawdowns as well as errors in edge estimates, it is common for practitioners to trade at a fraction of the Kelly ratio. This allows us to easily tune our desired level of risk at the expense of lower expected returns.