## Risk Management: Kelly's Formula

Earlier, I mentioned that scaling is important.  It is important to avoid putting yourself in a position where you have a good chance of losing all of your capital in a short amount of time.  A standard method for dealing with this problem is to scale positions according to Kelly's formula.

To illustrate how it works, I'm describing the version of the formula for a single investment here, but the idea has been adapted to handle multiple correlated investments.  (An investment may be a stock, or an algorithmic trading strategy, or anything else that you can buy/sell and is reasonably modeled by geometric Brownian motion.)   I'll start with a brief bit of mathematics, and then move on to the practical implications.  If you don't understand stochastic calculus or can't be bothered reading the mathematics, just read the first paragraph and then skip to the formula at the bottom.

The key concept here is that if you want to maximize long-term growth, you need to avoid depleting all (or virtually all) of your capital.  If at any point, your capital drops to (near) zero, then unless you can raise new capital, you have to accept your losses and move on to doing something else in life.  Equation (6) in the proof above gives the long-term log-return per unit time, which implicitly takes into account the risk of substantial depletion of capital along the way.  Intuitively, you can see that as long as the growth rate (mu) is positive, increasing scale k helps with growth through the k times mu term, but as scale becomes large, the risk of a very large loss also increases, and the long term effect of this then comes into play through the k-squared sigma-squared term in the equation.

### Practical Application for Stock Investment

The optimal value k* tells you how much you should "amplify" the return (along with its standard deviation) for an investment.  In other words, it is the leverage that you should use.   The constant mu represents the expected log-return per unit time, and sigma represents the standard deviation of the log-return per unit time.

To apply this in practice, you simply estimate mu and sigma, then compute k*.  For example, suppose you want to invest in Intel shares (INTC).  To start, you need to estimate mu and sigma.

Based on log-returns of Intel price series from Jan. 1st, 2009 to Feb. 24th, 2010 (price shown below), you could estimate the daily log-return as mu=0.0013 (take the average observed daily log-return over this period) and the daily standard deviation of the log-return as sigma=0.0221.

Now based on these numbers, the optimal leverage would be k* = 0.0013/(0.0221^2) = 2.66 (approximately).  What does this mean in practice?  It means that if you have \$100000 to invest, you get the best long-term log-return by using this capital to buy \$266000 worth of shares.  To do this, you have to borrow \$166000 from someone; normally a broker provides this service, although you need to be concerned about margin calls if you do this.   Important: You need to be careful doing this!  See the warnings section below.  In particular, there is not necessarily good reason to believe that these values of mu and sigma will apply going into the future.  (I'm not saying they won't.  I'm just saying I'm not willing to predict whether they will or not.)  As an illustration of sensitivity of the results to your parameter estimates, note that if you estimate mu and sigma using data from the year 2008 as well, you will get an entirely different result.  (Try it - pull up the daily adjusted closing prices using Yahoo Finance or some other data source, and re-estimate mu and sigma.  You'll notice market behavior was quite different in 2008.)

### Practical Application for Algorithmic Trading Strategies

The idea can also be applied to algorithmic trading strategies.  The only important thing that is not obvious is that you must be able to determine how much capital the strategy uses, so that you can look at past profits and translate them into log-returns on capital.  Once you have these log-returns, you can estimate mu and sigma.

Then you apply exactly the same idea as in the stock example above, but this time instead of deciding how many shares to buy for a specified amount of capital, you are deciding how large a position to take within the strategy for a specified amount of capital.  So it requires the additional concept of "allocated capital" to be attached to an algorithmic strategy.

### Warnings

In practice, you should use lower leverage than k*.  Many people recommend using half of k*.  There are at least two important reasons for this.

• The formula is derived under the assumption that returns are Gaussian.  In fact almost all financial returns are heavy-tailed.  This increases the risk of significant losses that have long-lasting impact.  The true optimal leverage would be smaller than k* if you took this into account.
• In reality mu and sigma are not constant.  They may change in the future in a way that would hurt you.  By using leverage less than k* you protect yourself against this possibility.

Back to Index