Using the Kelly Criterion for Trading Algorithms

Blankly Finance
4 min readApr 6, 2022

--

So a little background…

If you’ve ever played blackjack, you know that bet size is key. In blackjack, if you know both the current Running count and the True count, your odds for winning the hand are 52%. Theoretically, this should always result in profit in the long run provided you make the optimal call to hit or stand. But in reality, the size of your bet, while oftentimes overlooked, plays a pivotal role in maximizing long-term wealth.

That’s where the Kelly Criterion comes in. Proposed in 1956 by John Kelly, the Kelly Criterion calculates the optimal proportion of one’s net worth to risk in any given wager or bet to maximize wealth growth over time. Mathematically, the Kelly bet fsize maximizes the expected value of the logarithm of wealth, or maximizing the expected geometric growth rate. The formula itself simple:

Implications

But the implications are huge. With blackjack card counting, wagering 4% of your net worth each round results in the greatest long run profits, whereas wagering 8% performs markedly worse and wagering 25% results in losses. This blog post by Nicholas Yoder, senior portfolio manager at Virgil Quantitative Research, provides a great visualization, and explains a simple rationale: winning and then losing the same percentage of your net worth, or vice versa, will always result in a net loss.

Algotrading & Kelly Criterion

So why should I care as an algorithmic trader? Recent research has demonstrated that utilizing the Kelly criterion to optimize portfolio allocations yields the maximum expected growth rate and the median of the terminal wealth. With a normal distribution of returns, the Kelly criterion has the best performance in the long run, even when measured against identical portfolios optimized by Markowitz’s Modern Portfolio Theory. Compared with these portfolios lying on the mean-variance efficient frontier as outlined by the Modern Portfolio Theory, portfolios following the Kelly criterion had higher expected return, but as a result, higher variance. While the Modern Portfolio Theory still remains the gold standard for many portfolio managers, the Kelly Criterion is still a very viable strategy for managing a portfolio.

Putting Kelly Criterion into Practice

How can you utilize the Kelly Criterion in your own trading algorithm or portfolio of algorithms? There are two main ways you can add this new concept to your toolkit for generating alpha.

Option 1: Allocate Per Trade

Firstly, you can calculate the optimal portfolio allocation for each trade.

Regardless of the metric or strategy your model is based on, once your model identifies a trade, you can implement the Kelly Criterion to reach the optimal portfolio allocation. By calculating a win percentage and win/loss ratio, you can calculate the proportion of your portfolio to allocate to the trade.

If you choose to implement the Kelly Criterion into your model in this way, you should always keep in mind the risk-return tradeoff that the criterion assumes. As you approach the Kelly estimate optimal max bet, the additional return from additional risk diminishes significantly. The region of optimal risk/reward trade off is oftentimes half or less of the Kelly optimal allocation. As we mentioned before, the Kelly Criterion identifies the maximal expected geometric growth rate. Winning then losing the same proportion results in a net loss, and this loss grows quadratically in respect to the bet size. As a result, allocating 50% of the proposed optimal proportion yields 75% of the Kelly-optimal profit with only 1/4th of the variance. With that being said, it oftentimes is worth experimenting with what percentage of the Kelly-optimal proportion you allocate for each trade. In the end, it ultimately comes down to your personal tolerance of risk.

Option 2: Calculate Total Cash Allocation

Secondly, you can calculate the amount of total capital allocation for each deployed trading algorithm, essentially treating each algorithm as a fund.

Many algorithmic traders deploy multiple algorithms at the same, grouped together in a project or portfolio of models. The second way algorithmic traders can utilize the Kelly Criterion uses backtesting to calculate actionable metrics that can then be plugged into the allocation formula.

By backtesting for Win %, or the # of positive returns over the # of total returns, as well as the Win Loss Ratio, or the average positive return over the average negative return, you have the necessary information to find the Kelly-optimal proportion of your capital to allocate to each algorithm.

QuantFiction outlines the basic formulas for calculating the trading metrics necessary for the Kelly Criterion. With this way of creating a portfolio of portfolios, there are many novel, creative ways in algorithmic trading to diversify and generate alpha. Here’s our backtest result from creating this model.

Well, there you have it: 2 ways to add the Kelly Criterion into your own trading algorithm portfolios. Interested in building out a model with the Kelly Criterion in less than 100 lines of code?

If you’re interested in learning more, talk to us here @ Blankly and check out our open source package. We’d love to chat! We’re constantly in our Discord too!

--

--