# Kelly Betting in Prediction Markets

Kelly betting is another fun application in the Shannon entropy neighborhood. Kelly is all about getting rich quick — that is, when you have a favorable bet (positive expected value) that you can make repeatedly, Kelly tells you how much to bet each time so that you make as much money as possible, as quickly as possible. Kelly betting is optimal in this regard; no other strategy has a higher rate of return. In this post, we'll apply this idea to prediction markets like PredictIt.

## Background on Kelly Betting

First, though, let's see this in a simpler, classic example. Let's say you have a possibly-biased coin (heads with probability $p$), and you can bet at even odds as many times as you like. What fraction $f$ of your bankroll should you bet (on heads) each time? The Kelly strategy is as follows. First, look at things from a wealth-multiple point of view. When you win, your wealth gets multiplied by $(1+f)$ and when you lose, it gets multiplied by $(1-f)$. So, for example, if you started with \$100 and bet$f=10\%$of your bankroll three times, winning twice and losing once, then your ending wealth is $\100 \cdot (1+0.1)(1+0.1)(1-0.1) = \108.90.$ Let's say that you make this bet$n$times, winning$n_{\text{win}}$times and losing$n_{\text{lose}}$times. Then your final wealth the following multiple of your starting wealth: $(1+f)^{n_{\text{win}}}(1-f)^{n_{\text{lose}}}.$ We want to choose$f$to maximize this expression, which is the same as maximizing the$\log$of it: $n_{\text{win}} \log(1+f) + n_{\text{lose}} \log(1-f)$ As$n \to \infty$,$n_{\text{win}} \to n p$almost surely (just the law of large numbers) and so we really want to maximize: $p \log(1+f) + (1-p) \log(1-f).$ But this is easy enough, we just take derivatives and find that setting$f=2p-1$maximizes the expression. So, for example, if$p=0.6$, then you should bet$1.2-1 = 20\%$of your bankroll on each bet. We can generalize all of this. Suppose you have some state space$\Omega$and a random variable$X \in \Omega$. You can bet on each outcome$X=x$, and if you win (i.e., it turns out that$X=x$), then you marginally win$w(x)$times your wager; if you lose (i.e.$X \neq x$), then you lose 100% of your wager. Thus, if you bet$f(x)$of your bankroll on the outcome$X=x$, then your bankroll is multiplied by$(1+f(x)w(x))$if you win and is multiplied by$(1-f(x))$if you lose. Importantly, you can bet on multiple outcomes — for example, you might bet$f(x_1)$of your wealth on the outcome$X=x_1$, and$f(x_2)$on the outcome$X=x_2$. In the event that$X=x_1$happens, your new wealth will be multiplied by$1 + f(x_1)w(x_1) - f(x_2)$. Taking these multiple bets into account, you're left with some marginal wealth factor $\delta_f(x) = \int_{x \in \Omega} f(x)(\mathbb{I}(X=x)w(x) - \mathbb{I}(X \neq x))$ where $$\mathbb{I}(X=x)w(x) - \mathbb{I}(X \neq x)$$ is an expression that is equal to$w(x)$if$X=x$and is equal to$-1$otherwise. The important thing is that when the outcome$X=x$occurs, your wealth is, at the end of the day, multiplied by$1 + \delta_f(x)$. And then what Kelly tells us is that we should chose$f\$ so as to maximize

$\int_{\Omega} \mathbb{P}(X=x)\log(1 + \delta_f(x)).$

## Prediction Markets

Now let's apply this idea to a prediction market. Betting on Trump's weekly tweet count is one of the most popular recurring markets on PredictIt, so let's go with that. Here's a snapshot of what the market looks like right now (2018-08-19 22:22:00 UTC time):

If we have [1] this data, and [2] posterior distribution for Trump's tweet count, then we can use Kelly betting to figure out how much we should bet on each contract. As above, the punchline is to calculate $$\delta_f(x)$$ for each allocation decision $$f$$ and then choose $$f$$ to maximize the kelly factor $$\int_{\Omega} \mathbb{P}(X=x)\log(1 + \delta_f(x)).$$ Here's a spreadsheet that does this for us; it looks like this:

The goal here is to change the yellow cells (the $$f(x)$$) so that the $$\delta_f(x)$$ (the "Total" row in the "Contract Decisions" table) maximize the green cell (the Kelly factor). If you have a linear optimizer for this spreadsheet (e.g., using Excel), you can simply ask the solver to change the yellow cells to maximize the green cell.

Of course, this optimization is only as good as your posterior distribution for the tweet count, the orange cells. For that, you'll need to develop your own model! The point here is simply that once you have your model, Kelly tells you how to place your bests in a wealth-maximizing way.