Path: blob/master/05_strategy_evaluation/05_kelly_rule.ipynb
2923 views
How to size your bets - The Kelly Rule
he Kelly rule has a long history in gambling because it provides guidance on how much to stake on each of an (infinite) sequence of bets with varying (but favorable) odds to maximize terminal wealth. It was published as A New Interpretation of the Information Rate in 1956 by John Kelly who was a colleague of Claude Shannon's at Bell Labs. He was intrigued by bets placed on candidates at the new quiz show The $64,000 Question, where a viewer on the west coast used the three-hour delay to obtain insider information about the winners.
Kelly drew a connection to Shannon's information theory to solve for the bet that is optimal for long-term capital growth when the odds are favorable, but uncertainty remains. His rule maximizes logarithmic wealth as a function of the odds of success of each game, and includes implicit bankruptcy protection since log(0) is negative infinity so that a Kelly gambler would naturally avoid losing everything.
Imports
The optimal size of a bet
Kelly began by analyzing games with a binary win-lose outcome. The key variables are:
b: The odds define the amount won for a $1 bet. Odds = 5/1 implies a $5 gain if the bet wins, plus recovery of the $1 capital.
p: The probability defines the likelihood of a favorable outcome.
f: The share of the current capital to bet.
V: The value of the capital as a result of betting.
The Kelly rule aims to maximize the value's growth rate, G, of infinitely-repeated bets (see Chapter 5 for background).
We can maximize the rate of growth G by maximizing G with respect to f, as illustrated using sympy as follows:
Get S&P 500 Data
Compute Returns & Standard Deviation
Kelly Rule for a Single Asset - Index Returns
In a financial market context, both outcomes and alternatives are more complex, but the Kelly rule logic does still apply. It was made popular by Ed Thorp, who first applied it profitably to gambling (described in Beat the Dealer) and later started the successful hedge fund Princeton/Newport Partners.
With continuous outcomes, the growth rate of capital is defined by an integrate over the probability distribution of the different returns that can be optimized numerically. We can solve this expression (see book) for the optimal f* using the scipy.optimize
module:
Performance Evaluation
Compute Kelly Fraction
Kelly Rule for Multiple Assets
We will use an example with various equities. E. Chan (2008) illustrates how to arrive at a multi-asset application of the Kelly Rule, and that the result is equivalent to the (potentially levered) maximum Sharpe ratio portfolio from the mean-variance optimization.
The computation involves the dot product of the precision matrix, which is the inverse of the covariance matrix, and the return matrix:
Compute Precision Matrix
Largest Portfolio Allocation
The plot shows the tickers that receive an allocation weight > 5x their value:
Performance vs SP500
The Kelly rule does really well. But it has also been computed from historical data..