Kelly Portfolio Optimization: a Disciplined
Convex Programming Framework
Dany Cajas∗
[First version: April 2021] [Latest version: April 2021]
Abstract
This work presents a disciplined convex programming framework for
Kelly criterion in portfolio optimization based on exponential cone pro-
gramming. This framework allows us to incorporate mean logarithmic re-
turn in problems like maximize mean logarithmic return subject to a risk
constraint, maximize risk adjusted logarithmic return and constraints on
mean logarithmic return. The advantage of this framework is that gives us
an exact solution that considers all moments instead of approximate solu-
tion that only considers first and second moments. Finally, we run some nu-
merical examples using Python, Riskfolio-Lib package and MOSEK solver,
comparing asset allocations obtained using arithmetic return, approximate
and exact logarithmic return.
Keywords: risk analysis; kelly criterion; portfolio optimization; convex
optimization; exponential cone programming.
JEL Codes: C61, G11
∗
E-mail: dcajasn@[Link]
Electronic copy available at: [Link]
1 Introduction
Convex programming is a subclass of nonlinear programming that unifies and general-
izes least squares, linear programming, convex quadratic programming and cone pro-
gramming. Disciplined convex programming, defined in Liberti (2006), is a modeling
methodology that imposes a set of conventions that one must follow when construct-
ing convex programs. The advantage of this methodology is that the transformations
necessary to convert disciplined convex programs into solvable form can be fully au-
tomated. There are several optimization packages that supports disciplined convex
programs, for example CVXPY, CVX, MOSEK, among other packages.
The Kelly criterion is a scientific gambling criterion proposed by Kelly (1956) that
helps us to find the optimal fraction that we need to invest to maximize our wealth
using as an objective function the expected value of logarithm of our wealth. Thorp
(2008) extended this criterion to investments in a multiple assets context using an ap-
proximation of the expected value of logarithm of our wealth based on first and second
moments, that is accurate when the contribution of higher moments are insignificant.
This work proposes a disciplined convex programming framework for Kelly criterion
in portfolio optimization based on exponential cone programming. The advantage of
this framework is that gives us an exact solution that considers all moments instead of
approximate solution that only considers first and second moments. First, we posed
four logarithmic mean-risk portfolio problems. Then, we show how to express the
natural logarithm and its perspective function as a disciplined convex programming
expression using exponential cone programming. Then, we replace these expressions
in the logarithmic mean risk problems we posed. Finally, we make some numerical
examples using Python, Riskfolio-Lib package and MOSEK solver.
2 Portfolio Optimization Frameworks
2.1 Logarithmic Mean-Risk Portfolio Optimization
The logarithmic mean-risk optimization is an extension of the model proposed by
Markowitz (1952) using logarithmic returns instead of arithmetic returns, that can
be applied to any convex risk measure. Logarithmic mean-risk optimization begins
selecting N ∈ N assets, a series of historical returns r ∈ RT ×N where T ∈ N is the
Electronic copy available at: [Link]
number of observations, x ∈ RN is the vector of weights or portfolio, rj xτ 1 is the return
of portfolio x in period j and φ(x) is the expected risk of portfolio x. The logarithmic
mean-risk optimization can be resumed as four optimization problems:
• Maximization of the expected logarithmic return given a level of risk φ̄.
T
1X
max ln (1 + rj xτ )
x T j=1
s.t. φ(x) ≤ φ̄
(1)
N
X
xi = 1
i=1
xi ≥ 0 ; ∀ i = 1, . . . , N
• Minimization of the expected risk given a level of expected logarithmic return µ̄.
min φ(x)
x
T
1X
s.t. ln (1 + rj xτ ) ≥ µ̄
T j=1
(2)
N
X
xi = 1
i=1
xi ≥ 0 ; ∀ i = 1, . . . , N
• Maximization of a risk averse utility function given a risk aversion parameter
λ ∈ [0, ∞).
T
1X
max ln (1 + rj xτ ) − λφ(x)
x T j=1
N
X (3)
s.t. xi = 1
i=1
xi ≥ 0 ; ∀ i = 1, . . . , N
• Maximization of the risk adjusted return using logarithmic returns, based on the
idea of Sharpe (1964), assuming that the return of the risk free asset is rf . This
problem can be posed as the following form:
1
The operator ∗τ is the operator transpose of a matrix.
Electronic copy available at: [Link]
1
PT
T j=1 ln (1 + rj xτ ) − rf
max
x φ(x)
N
X (4)
s.t. xi = 1
i=1
xi ≥ 0 ; ∀ i = 1, . . . , N
This problem is quasi concave, so it cannot be solved with a convex programming
software. To solve this problem we need to use fractional programming.
2.2 Fractional Programming
A fractional program in which f is nonnegative and concave, g is positive and convex,
and S is a convex set is called a concave fractional program. Formally, a concave
fractional program is defined as:
f (x)
max
x g (x) (5)
s.t. x∈S
The problem above cannot be solved by a convex programming software due to is
quasiconcave. However, Schaible and Ibaraki (1983) shows that the problem above can
be transformed into the following concave program:
y
max kf
y, k k
y
s.t. kg ≤ 1,
k (6)
k≥0
y/k ∈ S
1 y y
where k = g(x)
, y = xk, kf k
is the perspective function of f and kg k
is the
perspective function of g.
If we apply the above formula to problem 4 and assuming that g(x) is a convex and
positive homogeneity risk measure23 φ(x), the problem becomes:
2
Examples of convex positive homogeneity risk measures based on returns distribution are standard
deviation, mean absolute deviation, semi deviation, lower partial moments, conditional value at risk
(CVaR), entropic value at risk (EVaR) and worst realization.
3
Examples of convex positive homogeneity risk measures based on drawdowns of uncompound cu-
Electronic copy available at: [Link]
T
k + rj y τ
1X
max k ln − rf k
x T j=1 k
s.t. φ(y) ≤ 1,
N
X (7)
yi = k
i=1
k≥0
yi ≥ 0 ; ∀ i = 1, . . . , N
where the optimal portfolio is obtained making the transformation x = y/k.
3 Kelly Optimization
3.1 Kelly Criterion
Thorp (2008) extended the Kelly criterion to portfolio optimization in a multiple asset
context as the maximization of mean logarithmic return. In the sample case, this
problem can be posed as:
T
1X
max E [ln (1 + rxτ )] = max ln (1 + rj xτ ) (8)
x x T j=1
However, due to the difficulty to use logarithm as an objective function until the
development of exponential cone programming by Chares (2009), Thorp (2008) uses
the following approximation:
1
E [ln (1 + rxτ )] ≈ µxτ − xΣxτ (9)
2
where µ is the mean vector and Σ is the covariance matrix. For accuracy, the above
formula requires an insignificant amount of skewness and higher moments as shown in
Young and Trent (1969). In appendix A we show how to include this approximation
in problem 4.
mulative returns are maximum drawdown, average drawdown, conditional drawdown at risk (CDaR),
entropic drawdown at risk (EDaR) and ulcer index.
Electronic copy available at: [Link]
3.2 Disciplined Convex Programming Framework of Logarithm
First, we can express the natural logarithm as follow:
qj ≤ ln (Xj )
(10)
exp (qj ) ≤ Xj
where q is a variable of size T × 1. So, we can express the maximization of the mean
logarithm as follows:
PT
max 1
1
PT q T j=1 qj
max T j=1 ln (Xj )
= (11)
s.t. (qj , 1, Xj ) ∈ Kexp ∀ j = 1, . . . , T
where Kexp is an exponential cone defined by Chares (2009) as:
n a o
Kexp = (a, b, c) | b > 0, c ≥ b exp ∪ {(a, b, c) | a ≤ 0, b = 0, c ≥ 0} (12)
b
This framework will be helpful to model maximization of mean logarithmic return
subject to a risk constraint, minimization of risk subject to a mean logarithmic re-
turn constraint and maximization of a risk averse utility function. For the case of
maximization of risk adjusted return, we need the perspective of natural logarithm.
We can express the perspective of the natural logarithm as follow:
Xj
qj ≤ k ln
k
qj Xj
≤ ln
k k (13)
q X
j j
exp ≤
qk k
j
k exp ≤ Xj
k
where q is a variable of size T × 1. So, we can express the maximization of the mean
of the perspective of natural logarithm as follows:
Electronic copy available at: [Link]
PT
max 1
j=1 qj
1
PT Xj q, k T
max T j=1 k ln k = (14)
k s.t. (qj , k, Xj ) ∈ Kexp ∀ j = 1, . . . , T
3.3 Kelly Risk Models
If Xj = 1 + rj xτ and we replace the disciplined convex programming framework of
logarithm and perspective of logarithm, we obtain the following problems:
• Maximization of the expected logarithmic return given a level of risk φ.
T
1X
max qj
x, q, T j=1
s.t. φ(x) ≤ φ
N
X (15)
xi = 1
i=1
(qj , 1, 1 + rj xτ ) ∈ Kexp ∀ j = 1, . . . , T
xi ≥ 0 ; ∀ i = 1, . . . , N
• Minimization of the expected risk given a level of expected logarithmic return µ̄.
min φ(x)
x, q
T
1X
s.t. qj ≥ µ̄
T j=1
N
X (16)
xi = 1
i=1
(qj , 1, 1 + rj xτ ) ∈ Kexp ∀ j = 1, . . . , T
xi ≥ 0 ; ∀ i = 1, . . . , N
• Maximization of risk averse utility function given a risk aversion parameter λ ∈
Electronic copy available at: [Link]
[0, ∞):
T
1X
max qj − λφ(x)
x, q T j=1
N
X
s.t. xi = 1 (17)
i=1
(qj , 1, 1 + rj xτ ) ∈ Kexp ∀ j = 1, . . . , T
xi ≥ 0 ; ∀ i = 1, . . . , N
• Maximization of the risk adjusted return using logarithmic returns assuming that
the return of the risk free asset is rf .
T
1X
max qj − rf k
y, k, q T j=1
s.t. φ(y) ≤ 1
N
X
yi = k (18)
i=1
(qj , k, k + rj y τ ) ∈ Kexp ∀ j = 1, . . . , T
k≥0
yi ≥ 0 ; ∀ i = 1, . . . , N
where the optimal portfolio is obtained making the transformation x = y/k.
4 Numerical Examples
We select 30 assets from the S&P 500 (NYSE) divided in two samples: assets with
negative skewness (i.e., stocks ES, KO, CLX, SRE, WMT, ABT, PSA, ITW, ESS,
LMT, MRK, EMR, CMCSA, AME and MCO) and assets with positive skewness (i.e.,
stocks REGN, AIG, MGM, NKTR, AKAM, INCY, SBAC, BKNG, APA, NTAP, MAC,
ALXN, AMT, GLW and TTWO). We download daily adjusted closed prices from
Yahoo Finance for the period from December 30, 1999 to December 30, 2020. Then,
we calculated monthly returns building a returns matrix of size T = 252 and N = 15
for each sample. To calculate the portfolios we use Python 3.74 , Riskfolio-Lib5 and
MOSEK6 solver because it supports exponential cone programming.
4
[Link]
5
[Link]
6
[Link]
Electronic copy available at: [Link]
4.1 Assets with Negative Skewness
In this section, we are going to use the sample of assets with negative skewness to
calculate the portfolio that maximizes the risk adjusted return using arithmetic return,
approximate and exact logarithmic return using two risk measures: standard deviation,
entropic value at risk (EVaR) and entropic drawdown at risk (EDaR).
First, we show the results using standard deviation as risk measure.
Arithmetic Log Approx Log Exact
Assets
% % %
ES 2.83 3.44 3.51
KO 0.00 0.00 0.00
CLX 9.91 10.16 10.23
SRE 11.93 11.95 11.94
WMT 2.47 3.39 3.53
ABT 14.40 14.38 14.39
PSA 23.64 23.17 23.10
ITW 0.00 0.00 0.00
ESS 0.00 0.00 0.00
LMT 11.33 11.04 10.96
MRK 0.00 0.00 0.00
EMR 0.00 0.00 0.00
CMCSA 0.00 0.00 0.00
AME 18.45 17.62 17.51
MCO 5.05 4.85 4.83
*
Log Return/Std. Dev. 130.14 130.18 130.18
*
√
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 1: Risk (Std. Dev.) Adjusted Return Composition
Figure 1: Composition of Std. Dev. Portfolios Built with Three Approaches
Electronic copy available at: [Link]
In table 1 and figure 1 we can see that in standard deviation case, the composition
of risk adjusted return portfolios using arithmetic, approximate and exact logarithmic
return are very similar due to the contribution of higher moments in logarithmic return
are insignificant.
To show how a non parametric risk measure works with Kelly criterion, we use the
disciplined convex programming framework of EVaR proposed by Cajas (2021).
Arithmetic Log Approx Log Exact
Assets
% % %
ES 0.00 0.00 0.00
KO 0.00 0.00 0.00
CLX 30.33 28.81 28.85
SRE 4.09 5.15 5.17
WMT 10.62 10.85 10.87
ABT 23.74 23.91 23.86
PSA 15.99 16.51 16.47
ITW 0.00 0.00 0.00
ESS 0.00 0.00 0.00
LMT 0.00 0.00 0.00
MRK 0.00 0.00 0.00
EMR 0.00 0.00 0.00
CMCSA 0.00 0.00 0.00
AME 9.19 9.66 9.64
MCO 6.04 5.10 5.14
Log Return/EVaR ×100* 52.02 52.02 52.04
*
√
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 2: Risk (EVaR) Adjusted Return Portfolio Composition
Figure 2: Composition of EVaR Portfolios built with Three Approaches
In table 2 and figure 2 we can see that in EVaR case, the composition of risk
Electronic copy available at: [Link]
adjusted return portfolios using arithmetic return, approximate and exact logarithmic
mean return are very similar due to the contribution of higher moments in logarithmic
return are insignificant.
To show how a non parametric drawdown risk measure works with Kelly criterion,
we use the disciplined convex programming framework of EDaR proposed by Cajas
(2021).
Arithmetic Log Approx Log Exact
Assets
% % %
ES 0.00 2.73 2.51
KO 0.00 0.00 0.00
CLX 33.95 31.16 31.28
SRE 18.41 19.37 19.59
WMT 0.00 0.00 0.00
ABT 34.95 32.50 32.43
PSA 7.38 9.69 9.70
ITW 0.00 0.00 0.00
ESS 0.00 0.00 0.00
LMT 0.00 0.00 0.00
MRK 0.00 0.00 0.00
EMR 0.00 0.00 0.00
CMCSA 0.00 0.00 0.00
AME 5.33 4.55 4.49
MCO 0.00 0.00 0.00
Log Return/EDaR ×100* 72.97 73.13 73.13
*
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 3: Risk (EDaR) Adjusted Return Portfolio Composition
Figure 3: Composition of EDaR Portfolios built with Three Approaches
In table 3 and figure 3 we can see that in EDaR case, the composition of risk
10
Electronic copy available at: [Link]
adjusted return portfolios using arithmetic return, approximate and exact logarithmic
mean return are very similar due to the contribution of higher moments in logarithmic
return are insignificant.
In addition, we can see that for both risk measures the risk adjusted return are very
similar among the three methods.
4.2 Assets with Positive Skewness
In this section, we are going to make the same calculations than in section 4.1 using
the sample of assets with positive skewness.
Arithmetic Log Approx Log Exact
Assets
% % %
REGN 8.73 7.06 7.70
AIG 0.00 0.00 0.00
MGM 0.00 0.00 0.00
NKTR 0.00 0.15 0.38
AKAM 0.00 0.00 0.00
INCY 0.00 0.00 0.00
SBAC 16.75 13.31 13.25
BKNG 12.86 12.28 11.93
APA 4.99 5.66 5.70
NTAP 0.00 0.00 0.00
MAC 12.28 13.63 13.55
ALXN 12.48 13.20 13.09
AMT 0.00 4.01 4.34
GLW 0.00 0.00 0.00
TTWO 31.92 30.70 30.06
Log Return/Std. Dev.* 70.89 71.13 71.16
*
√
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 4: Risk (Std. Dev.) Adjusted Return Portfolio Composition
11
Electronic copy available at: [Link]
Figure 4: Composition of Std. Dev. Portfolios built with Three Approaches
In table 4 and figure 4 we see that in standard deviation case, the composition
of risk adjusted return portfolios using arithmetic, approximate and exact logarithmic
return are different. However, portfolios built using approximate and exact logarithmic
return have similar composition. In this case, the contribution of positive skewness in
logarithmic return is small.
Arithmetic Log Approx Log Exact
Assets
% % %
REGN 41.26 20.52 28.15
AIG 0.00 0.00 0.00
MGM 0.00 0.00 0.00
NKTR 0.00 4.08 2.38
AKAM 0.00 0.00 0.00
INCY 0.00 0.00 0.00
SBAC 7.98 14.54 12.20
BKNG 4.66 5.95 5.95
APA 20.14 12.42 14.57
NTAP 0.00 0.00 0.00
MAC 2.46 9.55 7.36
ALXN 16.99 19.13 19.47
AMT 0.00 1.09 0.00
GLW 0.00 0.00 0.00
TTWO 6.51 12.72 9.93
*
Log Return/EVaR 40.16 41.16 41.74
*
√
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 5: Risk (EVaR) Adjusted Return Portfolio Composition
12
Electronic copy available at: [Link]
Figure 5: Composition of EVaR Portfolios built with Three Approaches
In table 5 and figure 5 we see that in EVaR case, the composition of risk adjusted
return portfolios using arithmetic, approximate and exact logarithmic return are very
different due to the effect of positive skewness in logarithmic return is significant.
Arithmetic Log Approx Log Exact
Assets
% % %
REGN 47.23 26.68% 38.50%
AIG 0.00 0.00 0.00
MGM 0.00 0.00 0.00
NKTR 6.91 11.06 8.63
AKAM 0.00 0.00 0.00
INCY 0.00 0.00 0.00
SBAC 0.00 5.93 3.08
BKNG 5.01 9.71 7.74
APA 23.24 19.37 20.34
NTAP 0.00 0.00 0.00
MAC 0.00 0.00 0.00
ALXN 4.71 8.83 7.87
AMT 2.73 0.00 0.00
GLW 0.00 0.00 0.00
TTWO 10.17 18.43 13.84
*
Log Return/EDaR 58.13 57.94 59.77
*
Annualized ratio, calculated as monthly ratio multiplied by 12.
Table 6: Risk (EDaR) Adjusted Return Portfolio Composition
13
Electronic copy available at: [Link]
Figure 6: Composition of EDaR Portfolios built with Three Approaches
In table 6 and figure 6 we see that in EDaR case, the composition of risk adjusted
return portfolios using arithmetic, approximate and exact logarithmic return are very
different due to the effect of positive skewness in logarithmic return is significant.
Finally, we can see that for all risk measures, the risk adjusted return is higher
using the exact logarithmic return.
5 Conclusions
In portfolio optimization, the Kelly criterion give us the asset allocation that maximizes
expected logarithmic return or final wealth. Due to the complexity of this problem,
it is common that authors use an approximation of mean logarithmic return based on
first and second moments. However, this approach ignores higher moments and risk in
the optimization process.
This work presents a disciplined convex programming framework for Kelly criterion
in portfolio optimization based on exponential cone programming that allows us to
propose four portfolio optimization problems. The advantage of this framework is that
gives us an exact solution that considers all moments and can be combined with convex
risk measures in order to incorporate risk in the optimization process. We make some
numerical examples comparing arithmetic, approximate and exact logarithmic return
using Python, Riskfolio-Lib package and MOSEK solver. In our examples, we see that
arithmetic, approximate and exact logarithmic return have similar asset allocations
when assets have negative skewness. However, when assets have positive skewness, in
some cases there is a significant difference in asset allocation between exact logarithmic
14
Electronic copy available at: [Link]
return and the other approaches, specially when we use a non parametric risk measure.
The models proposed in this work allows users to use disciplined convex program-
ming softwares that supports exponential cone programming for Kelly criterion in
portfolio optimization and incorporate risk in the optimization process. This makes
portfolio optimization based on Kelly criterion accessible to most users.
15
Electronic copy available at: [Link]
A Risk Adjusted Approximate Logarithmic Return
To use the approximation used by Thorp (2008) in problem 4, we need the perspective
of approximate logarithmic return:
k + ry τ 1 yΣy τ
E k ln ≈ µy τ −
k 2 k
The maximization of this approximation can be modeled using second order cone
programing in the following way:
1 g2
max µy τ −
y, k, g 2k
s.t. kΣ1/2 yk2 ≤ g
g2
where kxk2 = (xτ x)1/2 , Σ1/2 is the square root matrix of Σ and k
is a function called
quadratic over linear that is convex when k > 0. As shown in Lobo et al. (1998) the
g2
minimization of k
can be modeled using second order cone programming as follows:
min z
k, g, z
" #
2g
s.t. ≤k+z
k−z 2
k≥0
Finally, the maximization of the risk adjusted return using approximate logarithmic
returns assuming that the return of the risk free asset is rf can be posed as:
16
Electronic copy available at: [Link]
1
max µy τ − z − rf k
y, k, g, z 2
s.t. φ(y) ≤ 1
N
X
yi = k
i=1
" #
2g
≤k+z
k−z 2
1/2 τ
kΣ y k2 ≤ g
k≥0
yi ≥ 0 ; ∀ i = 1, . . . , N
where the optimal portfolio is obtained making the transformation x = y/k.
B Approximate Logarithmic Return
For other problems like constraints on maximum logarithmic return or maximization of
logarithmic return, we can posed the maximization of approximate logarithmic return
using second order cone programing in the following way:
1
max µxτ − g 2
x, g 2
s.t. kΣ1/2 xτ k2 ≤ g
17
Electronic copy available at: [Link]
References
Cajas, D. (2021). Entropic portfolio optimization: A disciplined convex pro-
gramming framework. Available at SSRN: [Link] or
[Link]
Chares, R. (2009). Cones and interior-point algorithms for structured convex optimiza-
tion involving powers and exponentials.
Kelly, J. L. (1956). A new interpretation of information rate. The Bell System Technical
Journal 35 (4), 917–926.
Liberti, L. (2006). Global optimization : from theory to implementation. New York,
NY: Springer.
Lobo, M. S., L. Vandenberghe, S. Boyd, and H. Lebret (1998). Applications of second-
order cone programming. Linear Algebra and its Applications 284 (1), 193–228. Inter-
national Linear Algebra Society (ILAS) Symposium on Fast Algorithms for Control,
Signals and Image Processing.
Markowitz, H. (1952). Portfolio selection. The Journal of Finance 7 (1), 77–91.
Schaible, S. and T. Ibaraki (1983). Fractional programming. European Journal of
Operational Research 12 (4), 325–338.
Sharpe, W. F. (1964). Capital asset prices: A theory of market equilibrium under
conditions of risk. The Journal of Finance 19 (3), 425–442.
Thorp, E. (2008, 12). The kelly criterion in blackjack, sports betting, and the stock
market. Handbook of Asset and Liability Management 1.
Young, W. E. and R. H. Trent (1969). Geometric mean approximations of individ-
ual security and portfolio performance. The Journal of Financial and Quantitative
Analysis 4 (2), 179–199.
18
Electronic copy available at: [Link]