0% found this document useful (0 votes)
29 views26 pages

Comparative Analysis of Portfolio

Uploaded by

Sushil Parajuli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views26 pages

Comparative Analysis of Portfolio

Uploaded by

Sushil Parajuli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Degree Project in Optimization & System Theory

First cycle, 15 hp

Comparative Analysis of Portfolio


Optimization Strategies

Adrian Eriksson
Erik Peterson

Stockholm, Sweden 2024


Acknowledgements
The authors would like to extend their heartfelt gratitude to Dr. Yehor Blokhin, Postdoctoral
Researcher at the Numerics, Optimization & Systems department at KTH Royal Institute
of Technology, for his guidance and mentorship throughout the duration of this project.

The authors would also like to express their sincere appreciation to Dr. Jan Kronqvist,
Associate Professor at the Numerics, Optimization & Systems department at KTH Royal
Institute of Technology, for his constructive feedback, and continuous encouragement.

Their collective expertise, guidance, and encouragement have been indispensable in the
completion of this report. We are deeply grateful for their support and mentorship.

KTH, Stockholm, Sweden 2024 1


Abstract
Portfolio optimization is a crucial practice in finance aimed at maximizing the return
while minimizing the risk through strategic asset allocation. This paper explores
two distinct approaches to modeling robust portfolio optimization, comparing their
efficacy in balancing the return and the risk. The first approach focuses on diversifying
the portfolio by varying the number of stocks and sector allocation, while the
second approach emphasizes minimizing risk by selecting stocks with low correlation.
Theoretical foundations and mathematical formulations underpinning these approaches
are discussed, incorporating concepts from Modern Portfolio Theory and Mixed
Integer Linear Programming. Practical implementation involves data collection from
Yahoo Finance API and computational analysis using Python and the optimization
tool Gurobi. The results of these methodologies are evaluated, considering factors
such as budget constraints, maximum and minimum investment limits, binary constraints,
and correlation thresholds. The study concludes by discussing the implications
of these findings and their relevance in contemporary financial decision-making
processes.

KTH, Stockholm, Sweden 2024 2


Contents
1 Introduction 4
1.1 Research question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Theoretical background 6
2.1 Efficient frontier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Clique theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Mixed-integer linear programming . . . . . . . . . . . . . . . . . . . . . . . 7

3 Numerical analysis 8
3.1 Approximations and data collection . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Models to risk approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.1 Approach 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.2 Approach 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Results 11
4.1 Numerical validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 Approach 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2.1 Efficient frontier approach 1 . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Approach 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.1 Efficient frontier approach 2 . . . . . . . . . . . . . . . . . . . . . . 16

5 Discussion 17
5.1 Approach 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2 Approach 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.3 Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

6 Conclusion 21

I Appendix A 23

II Appendix B 24

KTH, Stockholm, Sweden 2024 3


1 Introduction
Portfolio optimization is a fundamental concept in finance, aspiring to maximize the
return while minimizing the risk by using strategic asset allocation. In today’s intertwined
and dynamic financial markets, investors are continually searching for ways to optimize
their investment portfolios in order to achieve their financial objectives. When allocating
stocks for the portfolio various constraints are taken into account. Commonly used
constraints are risk tolerance, investment objectives and liquidity requirements. Portfolio
optimization, while a powerful tool for investors, comes with its own set of challenges and
limitations. A limitation in the precision and effectiveness of portfolio optimization is the
quality of the input data - inaccurate or unreliable data can lead to flawed optimization
outcomes. Likewise, most optimization models depend on specific assumptions about
market behavior, such as constant correlation between assets, which in turn could affect
the reliability of optimization results. Moreover, optimization models may not satisfactorily
take account of black swan events, more referred to as extreme or unexpected actions,
which can have significant impacts on portfolio performance. Regardless of if it is individuals
planning for retirement, financial analysts modelling investment strategies or institutional
investors handling large funds, portfolio optimization is of utmost central importance in
decision making processes.

The progress of portfolio optimization methods has been intricately linked with the
development of financial theory, computational approaches, and data analytics. The
concept of portfolio optimization is based on Modern Portfolio Theory (MPT), which was
developed 1952 by Harry Markowitz. MPT accentuates the importance of diversification
and balance between risk and return in investment portfolios. In short, Markowitz
demonstrated the core theorem of mean-variance portfolio theory, which asserts that
one either could maximize the expected return under constant risk or minimize the risk
for a given expected return [1]. An extension of Markowitz’s work, termed the Capital
Asset Pricing Model (CAPM), was produced by William Sharpe, John Lintner, and Jan
Mossin in the 1960s. CAPM provides a framework for determining the appropriate
expected return for an asset based on its systematic risk (beta). It is a cornerstone
in asset pricing theory and is used extensively in finance for tasks such as calculating
the cost of equity capital, estimating the required rate of return for investments, and
assessing the performance of investment portfolios [2]. Another frequently used method
in portfolio optimization is the Black-Litterman model, developed by Fischer Black and
Robert Litterman in the beginning of the 1990s. This model betters the evaluation of
expected returns and asset allocation decisions by combining the mean-variance framework
with investor views and market equilibrium[3]. Furthermore, recent advancements in
machine learning and artificial intelligence have led to the development of sophisticated
algorithms for portfolio optimization. Techniques such as genetic algorithms, neural
networks, and reinforcement learning are being applied to optimize portfolios in dynamic
and complex environments [4].

In a time of market volatility and uncertainty, the importance of portfolio optimization


cannot be overstated. With the assistance of diversification, asset allocation and risk
management, investors can navigate turbulent market conditions with greater resilience
and confidence.

KTH, Stockholm, Sweden 2024 4


1.1 Research question
In this thesis two different approaches to model portfolio optimization is considered and
compared. The comparison will be made with respect to how the return of the portfolios
balances the risk. Since the risks are assumed to not be present, two different approaches
to model the risks are constructed. In the first model we explore the interconnection
between the return and the risk by varying how many stocks that are used in total and
how many to invest in from different sectors. The second model is made by considering the
correlation factor between stocks and finding groups of stocks with mutual low correlation
and high return. In this report, the models will be compared with each other and the
efficient frontier. The validity of the models will also be examined.

1.2 Outline
⋄ Chapter 2, "Theoretical Background" establishes the concepts essential to the analysis.
This chapter provides a comprehensive overview of the theoretical framework guiding
our research.

⋄ Chapter 3, "Numerical Analysis" delves into two distinct approaches for managing
portfolio risk and maximizing returns. We offer a detailed examination of these
methodologies and their practical implications.

⋄ Chapter 4, "Results" presents empirical data and comparisons between the two
approaches discussed in Chapter 3.

⋄ Chapter 5, "Discussion" analyzes and compares the effectiveness of the methodologies,


providing insights into their strengths and weaknesses.

⋄ Chapter 6, "Conclusion" synthesizes our findings and offers a final assessment of


the methodologies.

1.3 Parameters
The following parameter clarifications will elucidate the key parameters utilized in this
thesis.

Symbol Description
(K) Number of stocks in the portfolio
(L) Number of stocks in sector Sj
(η) Correlation between stocks
(ε) Minimum investment per stock
(ξ) Maximum investment per stock
(µ2 ) Variance & risk

KTH, Stockholm, Sweden 2024 5


2 Theoretical background
The following part provides essential theoretical foundations, elucidating key concepts
and frameworks.

2.1 Efficient frontier


In modern portfolio theory, the collection of optimized portfolios that provides the highest
expected return for a given level of risk (variance) for the lowest risk for a specific level
of expected return, constitutes the efficient frontier. The efficient frontier is normally
depicted as a graph with the risk on the x-axis and the expected return on the y-axis. In
terms of risk-return trade off, portfolios lying on the efficient frontier are considered being
optimal since they cannot be improved. Portfolios that cluster to the right of or below
the efficient frontier are treated as sub-optimal [5].

Optimization model

max αrT x − (1 − α)xT Σx


x
s.t. 1T x = 1,
xi ≥ 0, ∀i.
r = return vector
x = weighted investment
α = weights risk-return
Σ = covariance matrix
Figure 1: Efficient frontier

This plot illustrates the concept of the efficient frontier for a set of stocks. The two
outlying blue dots denote the maximum return for a portfolio and the minimum return
for a portfolio. They are connected by the green curve, which represents the efficient
frontier. These outlying dots can denote the worst and the best theoretical portfolios,
but they can only be obtained if all the capital is invested in the best respective the
worst stock. The green dot to the left in the graph denotes the theoretical minimum-
risk portfolio. The green curve defines the feasible region, and all potential portfolio
combinations must be on or inside the green curve among the blue dots. All portfolios
along the green curve (the efficient frontier) represent the optimal portfolios. However,
it is then up to the investor to adjust the balance between risk and return according to
their preferences. The parameter (α) stated above is the weight factor balancing risk
and return. If α = 0 then the minimum risk portfolio will be obtained and if α = 1 the
outlying blue dot in the top will be selected.

KTH, Stockholm, Sweden 2024 6


2.2 Clique theory
Clique theory is a part of graph theory that handles the study of cliques, which are
subsets of nodes in a graph where every pair of nodes is connected by an edge. In other
words, a clique of a graph G forms a complete subgraph of G [6]. In the context of
analyzing relationships among stocks, clique theory provides a powerful framework for
understanding the interconnections and dependencies within a stock market network. By
representing stocks as vertices and correlations between them as edges, clique theory
enables the identification of groups of stocks that exhibit strong mutual relationships.

Figure 2: Graph G

In figure 2 nodes are detonated as {A, B, ..., F } and constitutes the graph G. A set of
nodes Ω = {A, B, C} forms a complete subgraph (clique) of G, which all have a mutual
relationship. In the graph G, for instance, (C&D) and (D&E) have mutual relationship
and (F ) have no relationship with any other node in the graph.

In financial markets, cliques can indicate sectors, industries, or thematic groupings where
stocks tend to move in tandem due to common underlying factors or market dynamics.
Analyzing cliques can help investors identify diversification opportunities, assess systemic
risks, and tailor portfolio strategies to mitigate concentration risk.

By leveraging clique theory in correlation analysis between stocks, investors can gain
insights into the structure and dynamics of the market, leading to more informed investment
decisions and improved portfolio management practices [7].

2.3 Mixed-integer linear programming


Mixed Integer Linear Programming, often referred to as MILP, is a mathematical technique
for optimization, which uses both continuous and discrete variables. The method is used
to solve problems including an objective function which you want to maximize/minimize
subject to given linear constraints. MILP is a MIP model without any quadratic constraint
and is usually solved using a linear-programming based branch-and-bound algorithm. This
technique (branch-and-bound) systematically explores the solution space by dividing it
into smaller subspaces, or branches, and bounding the feasible region of each branch. It
initiates with solving the relaxed linear programming (LP) problem, where the integer
restrictions are ignored, providing a lower bound on the optimal solution. Then, it
branches off from the LP solution by adding integer restrictions to one or more variables,
creating subproblems. These subproblems are solved recursively, and the process continues
until the optimal integer solution is found or proven to be infeasible [8].

KTH, Stockholm, Sweden 2024 7


3 Numerical analysis
In this section the robust data collection and filtering for the parameters we be explained
and calculated. The two approaches will also be presented.

3.1 Approximations and data collection


In this thesis the stock data was selected from the period of 2023-01-01 to 2023-12-31.
Here the stock data consists of 60 stocks from OMX Stockholm Large Cap, (see Appendix
(I)). The group of 60 stocks includes six sectors with the ten biggest stocks from each
sector.

The downloaded stock data was acquired by Yahoo Finance Python API, yfinance. The
adjusted closing price C, is considered because of corporate actions such as splits and
dividend distributions. If sudden stock price changes occur, due to changes within the
company, the correlation matrix and the return vector will be distorted, and the outcome
will be hard to analyze. The adjusted price compensates for this, and should consequently
give a more accurate measurement of a stocks value [9].

A filter was also constructed to ensure that the latest acquired adjusted closing price
would remain unchanged for a period of n days if the stock remained closed for n days.
This filter ensures that if there are missing values (NaN) in any column of the data matrix
containing the adjusted closing prices, those missing values are replaced with the values
from the corresponding column in the previous time step. This approach helps maintain
continuity in the data and ensures smoother processing.

The return, ri and the return vector r for all stocks over the time step t, can be calculated
using the following formulas:
Ct − Ct−1
ri = , (1)
Ct−1
r = [r1 , r2 , ..., rn ]T , (2)
where i ∈ {1, 2, ..., n} (n= stock amount) and t ∈ T.

Within a certain time period (T) (for example one year with m-days) the main parameters
can be calculated using python-functions from NumPy. The variable θi ∈ T contains the
periods amount of returns for a certain stock i such as the daily return for the time period
(T) gives:
θi = [r1 , r2 , ..., rm ]T .
θi is a vector containing the discrete daily time samples of return within the period (T)
for stock i.

The following mathematical factors can then be calculated in python using θi .


σi = [Link](θi ), Σ(ri , rj ) = [Link](θi , θj ), Ri,j = [Link](θi , θj ), (3)
where σi is the standard deviation of the daily adjusted closing prise, Σ(ri , rj ) is the
covariance matrix and Ri,j is a 60 x 60 correlation matrix.

KTH, Stockholm, Sweden 2024 8


3.2 Models to risk approach
This project aims to compare and analyze two distinct methodologies for minimizing the
risk while maximizing the return for a portfolio.
The classical portfolio optimization model, which is a convex optimization problem,
may be formulated in the following way:
max rT x (4a)
s.t. T
x Σx ≤ µ , 2
(4b)
T
1 x = 1, (4c)
xi ≥ 0, ∀i, (4d)
where xi is the investment in each stock and ri is the return of interest for each stock.
Here i ∈ {1, 2, ..., n}, where n is the number of considered stocks. Furthermore, Σ is
the covariance matrix and µ2 is the accepted risk [5]. The two modified approaches are
presented in the next section.

3.2.1 Approach 1
The models used in this thesis presume that the accepted risks µ2 are not present. Thus,
an alternative approach to regard risks is used by diversifying the portfolio. The risk
constraint (see equation (4b)) is modeled by the following two constraints:
n
X
yi ≥ K,
X
i=1 (5)
yi ≥ L,
i∈Sj

where K denotes the minimum amount of stocks used in the portfolio and L denotes
the minimum amount of stocks per sector, Sj , utilized within the portfolio. This approach
of the risk is constructed from balanced representation of different sectors by requiring a
certain number of assets from each sector to be included in the portfolio. In this context,
the variable yi is binary together with the constraint that ensures that yi = 1 for all
ξ ≥ xi ≥ ε, (ε and ξ) is a fix minimum and maximum investment per stock. For all
xi = 0, yi = 0. The limitations outlined above will manifest in the model for approach 1
in the following manner:

max rT x
Xn
s.t. yi ≥ K,
i=1
X
yi ≥ L, (6)
i∈Sj

1T x = 1,
xi = 0 ⇒ yi = 0,
ε ≤ xi ≤ ξ ⇒ yi = 1.

KTH, Stockholm, Sweden 2024 9


3.2.2 Approach 2
In case the portfolio consists of stocks with similar course development, the return could
in the most unfavorable outcome be low for all stocks. In the ideal case a correlation
value of -1 between two stocks would mean that, when one is high the other one is low
and vice versa. Therefore, another approach to minimize the risk is to exclusively regard
stocks with low correlation. This is implemented by calculating the correlation matrix
and setting a reference value for the maximum pairwise correlation value to filter out
the relevant stocks. In this symmetrical 60 x 60 matrix each row/column represents a
stock i (here i ∈ {1, 2, ..., 60}) and the elements in each row/column corresponds to the
correlation value between every stock (see equation (3)). For some stock i and j this
constraint is described as:
Corri,j ≤ η. (7)
In this case, the risk-constraint (see equation (4b)) is modelled by the ensuing:
n
X
yi ≥ K,
i=1 (8)
Corri,j ≤ η.
The group of stocks which fulfills the K-constraint and mutually have low correlation with
each other, constitutes the portfolio. The complete formulation for approach 2 is thereby
as follows:

max rT x
Xn
s.t. yi ≥ K,
i=1
Corri,j ≤ η, (9)
T
1 x = 1,
xi = 0 ⇒ yi = 0,
ε ≤ xi ≤ ξ ⇒ yi = 1.

For the purpose of this approach, a graph G = (Ω,E) was considered, where Ω is the set
of nodes and E is the set of edges between the nodes (see chapter 2.2). In the graph each
node represents a stock. For a pair of nodes (i, j) ∈ Ω the edge (i, j) exists if and only
if the correlation is lower than η (see equation (8)). The group of stocks which mutually
fulfills (8) will form a clique and represents the optimized portfolio.
An example for K = 4 stocks (see the green nodes, ) with correlation η ≤ 0:

Figure 3: Example of correlation graph

KTH, Stockholm, Sweden 2024 10


4 Results
The results obtained for the two models (see equation (6) and (9)) explained above will
be presented in this section. The gathered results, that consists of the returns for varying
risks, will first be showcased for the respective approach and finally a comparison between
the two approaches will be made.

4.1 Numerical validation

Figure 4: Simulation of random portfolios

This is a plot with (5 · 105 ) random weighted portfolios of 4 stocks and each portfolio is
plotted as a dot in the figure. The stocks are selected by Gurobi while optimizing for only
optimal return with no constraints (η, L) to make sure that the most optimal portfolio
is obtained in the banal case. The only active constrain is the (ε → ∞ 1
). In other words
the minimum investment constraint goes to zero. In the plot, the efficient frontier (set of
optimal portfolios) can be distinguished as the smooth left edge of the collection of points.
The Sharpe ratio quantifies how much excess return an investment or strategy generates
for each unit of risk taken. A higher Sharpe ratio indicates a better risk-adjusted return,
as it suggests that the investment is delivering more return for the amount of risk being
assumed. Conversely, a lower Sharpe ratio suggests that the investment is not generating
sufficient return relative to its risk. According to the plot, it does seem like the built
python-program is working as expected.

4.2 Approach 1

Table 1: Returns for varying L and K in percent [%].

K
6 9 12 15 18 21 24 27 30
L
1 101.2 94.4 86.8 78.9 70.7 62.5 54.1 45.2 36.3
2 - - 86.4 78.8 70.7 62.5 54.1 45.2 36.3
3 - - - - 70.2 62.2 53.9 45.1 36.2

KTH, Stockholm, Sweden 2024 11


The table above shows the return in percent for varying K- and L-values in approach 1.
The K-value is starting at 6 and is increasing in steps of 3 to 30 whereas the L-value is
starting at 1 and increasing in steps of 1 to 3. The strokes ("-") imply that the model is
infeasible for the corresponding combination of K- and L-values.

Table 2: Risks for varying L and K.

K
6 9 12 15 18 21 24 27 30
L
1 0.01932 0.01785 0.01612 0.01469 0.01365 0.01276 0.01182 0.01173 0.01226
2 - - 0.01633 0.01465 0.01359 0.01276 0.01182 0.01173 0.01226
3 - - - - 0.01394 0.01293 0.01200 0.01188 0.01226

In the preceding (Table 2) the risk is visualized for different K- and L-values. The step
increase is the same as for table 1. The strokes ("-") imply that the model is infeasible
for the corresponding combination of K- and L-values.

Figure 5: Returns for varying L and K in percent [%].

In the figure depicted above the return is plotted for varying K-values. The blue graph
shows the returns for varying K-values, ranging from 6 to 30 and with a fix L = 1.
Moreover, the red graph shows the returns for different K-values, in the spectrum from 12
to 30. Here L = 2. Lastly, the yellow graph shows the returns for K-values in the range
from 18 to 30 and in this case L = 3. The step size for K is 1 in all three cases. The
investment parameters was set to ε = 1/30 and ξ = 1.

KTH, Stockholm, Sweden 2024 12


4.2.1 Efficient frontier approach 1
In the following figures the efficient frontier (see chapter 2.1) is graphed with a green
line. The red dashed line connects the outcomes for varied K-values for the three different
L-cases. For all three cases ξ = 1 and ε = 301
.

Figure 6: L = 1

Figure 7: L = 2

Figure 8: L = 3

KTH, Stockholm, Sweden 2024 13


4.3 Approach 2

Table 3: Returns for varying η and K in percent [%].

K
1 2 3 4 5 6 7 8 9 10
η
0.2 111.0 105.1 98.6 91.9 83.5 75.2 65.8 56.0 45.0 32.3
0.3 111.0 107.5 101.6 95.3 88.8 82.0 74.8 66.7 58.3 49.7
0.4 111.0 107.5 102.3 95.9 88.8 82.0 75.3 68.4 61.2 53.0

The table shown above displays the return for 10 different K-values and 3 distinct η-values.
The K-values are ranging from 1 to 10 and the η-values from 0.2 to 0.4.

Table 4: Risks for varying η and K.

K
1 2 3 4 5 6 7 8 9 10
η
0.2 0.0225 0.0206 0.0183 0.0169 0.0150 0.0134 0.0118 0.0104 0.0093 0.0087
0.3 0.0225 0.0211 0.0192 0.0176 0.0155 0.0144 0.0130 0.0119 0.0109 0.0105
0.4 0.0225 0.0211 0.0193 0.0177 0.0155 0.0144 0.0135 0.0133 0.0126 0.0122

In the preceding table the risk for 10 different K-values and 3 distinct η-values. The
K-values are ranging from 1 to 10 and the η-values from 0.2 to 0.4.

Figure 9: Returns for varying η and K in percent [%].

In the left graph above (Connection Lines) the returns for 3 different η-values and
same K-value are connected with a black dashed line. The graph to the right (Datasets)
shows the returns for 3 different η-values and 10 K-values. Both graphs are done for ten
different K-values, ranging from 1 to 10 with a step size of 1. To clarify, K = 1 is in the
top right corner and K = 10 is in the bottom left corner for both graphs. The minimum
investment was set to ε = 1/10 and the maximum investment was fixed to ξ = 1.

KTH, Stockholm, Sweden 2024 14


Figure 10: Returns for varying η and K in percent [%].

This is the same "dataset"-graph as shown in Figure (9), but it includes more η-values
to see how the risk converges. The minimum investment was set to ε = 1/10 and the
maximum was set to ξ = 1.

(a) Node graphs for η = 0.4 (b) Node graphs for η = 0.3 (c) Node graphs for η = 0.2

Figure 11: Node graphs

The figure above shows the node graphs for three different η-values, all with K = 10.
The green nodes, ( ) represent the stocks chosen from the optimization and the red
nodes, ( ) represents the stocks which were not chosen from the optimization. All three
subgraphs are complete and are thereby considered as cliques.

KTH, Stockholm, Sweden 2024 15


4.3.1 Efficient frontier approach 2
In the following figures the efficient frontier (see chapter 2.1) is graphed with a green
line. The red dashed line connects the outcomes for varied K-values for the three different
η-cases. For all three cases ξ = 1 and ε = 301
.

Figure 12: η = 1

Figure 13: η = 0.7

Figure 14: η = 0.5

KTH, Stockholm, Sweden 2024 16


5 Discussion
In the following part the results for each model showcased previously will be discussed
with respect to how valid they are and how they relate.

5.1 Approach 1
As seen in Table (1) the highest return for approach 1 was obtained for the case of K =
6 and L = 1, in which the optimizer chooses to invest in the best stock from each sector.
This is a rather expected result since a lot of the investment budget can be placed in
the most lucrative stocks. For all L-cases the return is decreasing with greater K-values.
This is due to the fact that the greater the K-value is, the more of the investment budget
needs to be distributed over a larger amount of stocks. However, for the same K-value but
different L-values the return remains unchanged. This implies that the optimizer chooses
the same portfolio for the different L-cases when K is fixed.

As illustrated in Table (2) the risk is declining for greater K-values, which is according
to the principle of diversification. For varying L and a fixed K-value, the risk is fairly
unchanged. Furthermore, the risk is higher for L = 3 compared to L = 1 and L = 2
for 4 out of 5 K-values. This result contradicts the thesis of approach 1, which was that
the risk would be lowered by increasing the amount of stocks chosen per sector. In other
words, the model for approach 1 is not working for the selection of 60 stocks from OMX
Stockholm Large Cap. This outcome is ascertained and visualized in Figure (5), where the
graphs for different L-values coincide, entailing they give approximately the same return
for the same risk.

5.2 Approach 2
As shown in Table (3) the highest return for approach 2 is attained for K = 1, and is the
same for all η-values. The correlation constraint (see equation (7)) is inoperative when
considering K = 1 stocks for the optimization. Thus the result is reasonable because
all the capital allocation can be invested in the best stock. In all η-cases, the return
decreases as the K-value increases. This is, as in approach 2, an anticipated result since
the investment budget needs to be shared between a larger amount of stocks for greater
K-values. For fixed K-values, the return increases as the η-value rises. This result is owing
to the fact that a lower η-value corresponds to a more limited selection of stocks which
can be included in the portfolio, which in turn should result in a lower return.
Regarding the risks, visualized in Table (4), it is obtained that for all η-values the risk
is lowered for increasing K-values. In addition, the risk is decreasing as the correlation
value, η, is being lowered. This outcome harmonizes with the thesis of approach 2, which
stated that the risk would decrease with lowered η-values. Therefore, the model for
approach 2 is considered valid. The corresponding values from Table (3) and Table (4),
establishing points (x, y), are graphed in Figure (9) where the results mentioned above
are depicted.

5.3 Comparison
The parallel comparison is rather difficult to implement due to the different forms of
prerequisites the two methods are built upon. To make the parallel comparison, a

KTH, Stockholm, Sweden 2024 17


relatively large number of stocks needs to be considered since approach 1 requires 6
times the L-value stocks as minimum in the portfolio. Approach 2 is, for the selection
of stocks for this study, not possible to accomplish for large K-values and relevant η-
values. Relevant or low η-values, are in the region of -1 to 0.3 [10]. To make the
parallel comparison a larger pool of stocks (more than 60) would be needed, enabling the
correlation approach to perhaps contain more combinations with low mutual correlation.
However, it is relatively straightforward to compare and examine the credibility of the
two models. As declared in the result section, the model for approach 1 was not giving
satisfactory results with background to what was formulated in the thesis for approach
2. A higher L-value did not provide a lower risk in the return to risk trade-off. On the
contrary, the model for approach 2 was declared valid since a lower η-value did result
in a lower risk in the return to risk trade-off. A likely reason for this, is that the η-
value/correlation-value interplay with risk through covariance whereas the L-constraint is
a more hypothetically based thesis to obtain low risk. By distributing the allocation of
stocks in a portfolio to different sectors, the overall risk of a portfolio should be lowered
but it is not a foolproof method. Diversification is not a guarantee of low risk, but rather
a strategy aimed at reducing the risk.

In the coming section of the comparison, η-values in the range from 0.5 to 0.9 are
being used in order to more easily draw conclusions about the tendencies for approach 2
compared to approach 1.

Figure 15: Returns for approach 1 and approach 2 in percent [%].

In Figure (15) the two approaches are shown in two columns, with respective return plot
underneath. The lower return plot for approach 1 shows that the relationship between K

KTH, Stockholm, Sweden 2024 18


and return appears linear. The graphs for approach 2 shows that the return exponentially
decay with higher K-values and lower η. In this case ε = 1/30 and ξ = 1.
The black line in the graphs (Free) shows the optimization result without any (η, L)
constraints. The L-approach converges into the same values as the free optimization,
which indicates that approach 1 does not work or does not make a difference for large
K:s. Even worse with higher L-values since the risk increases. Meanwhile, the η-approach
seems to work. With lower η-values the risk gets lowered and the return decreases as well.
If a certain return percentage is wanted (if fixed), then the lower η-values indicates
that the amount of stocks in the portfolio (K-value) can be fewer for lower η-values and
still give better return than portfolios with higher η and more stocks. It appears that
model 2 also works for stocks within this region of relatively high correlation.

Figure 16: Comparing approach 1 and approach 2.

Figure (16) is comparing the two approaches in the same graph. The η- and L-values are
varied for K-values in the range K ∈ {6,7,...,30}. The minimum investment was set to
ε = 1/30, thus the comparison is easier to do in that case. One drawback with that ε
is when K = 30 all stocks in the portfolio will have the same investment weights. Since
ε only is a scaling factor the same result with smaller difference will be present if we
decrease ε.
The η ∈ {0.5,0.6,0.7} are showing that they give a lower risk compared with η = 0.9 and
all L-values. This indicate that the η-approach seems to work . According to approach 2
lower η-values should give lower risk, but the graph shows that η-values {0.5,0.6} fluctuate
and here the 0.6-value gives lower risk than the 0.5-value. This fluctuation may occur
when the η-values are relatively high to be included in the epithet (low correlation), [-1
to 0.3] ([10]). This is confirmed in Figure (10) above, were the η-values are low and give
lower risk for lower η. Another explanation can be that in this case 50 % of all stocks
is considered (30 out of 60) which could affect the risk. The fluctuation region occurs
when K is extremely high (K ∈ {22,23,...,30}), which probably is not a practical portfolio
scenario in reality.

KTH, Stockholm, Sweden 2024 19


Figure 17: Comparison of models with boundary.

Zooming in on Figure (16), gives Figure (17). If a certain level of a lower-boundary of


return is wanted, then the Boundary-line above shows the portfolios which fulfills that
condition. An interesting observation is that lower η-values tend to give lower risk and
also contain fewer stocks in them (see Figure (17)).
Nevertheless, the K-values are lower for lower η in almost every case. An exception of
this is when η is within the region {0.5,0.6} and K ≥ 23.

Figure 18: Model 1 and 2 Compared with Efficient frontier.

In the figure shown above, a comparison between the two models and the efficient frontier
is graphed. The two models tends to follow the same form as the efficient frontier but
they are not as effective in the return-to-risk trade off. This is due to the obvious fact
that the models uses constraints which limits the selection of stocks and the distribution
of investment shares for the chosen stocks.

KTH, Stockholm, Sweden 2024 20


6 Conclusion
With background of what was presented in the results and discussion sections, it can
be concluded that approach 2 tends to give more satisfying results in terms of risk to
return trade-off compared to approach 1 for the selection of stocks used in this study. It
is likely that is due to the fact that approach 2 is built on a more rigorous mathematical
foundation whereas approach 1 is based on a more hypothetical premise. If we compare
the two approaches to the efficient frontier (see Figure (18)), we can see that neither
approach is perfect, but if ε is decreased the sampled plots of approaches will converge
a bit closer to the efficient frontier. However, a more comprehensive analysis is required
to ensure a more credible result. That could be done by including more stocks and more
constraints to the model. Additionally, it would be beneficial to conduct experiments
across alternative time periods (T), to ascertain potential variations in the outcomes.

KTH, Stockholm, Sweden 2024 21


References
[1] Elton, Edwin J and Gruber, Martin J. (1997). “Modern portfolio theory, 1950 to date”.
[Link]

[2] Fama, Eugene F and French, Kenneth R. (2004). "The Capital Asset Pricing Model:
Theory and Evidence".
[Link]

[3] Cheung, Wing. (2010). "The Black–Litterman model explained".


[Link]

[4] Pinelis, Michael and Ruppert, David. (2021). "Machine learning portfolio allocation".
[Link]

[5] Markowitz, H.M. (1952). “Portfolio Selection”. Journal of Finance, Vol. 7 No. 1: 77-91.

[6] Wikipedia. (2023). "Clique (graph theory)".


[Link]

[7] Birch, Jenna; Pantelous, Athanasios A. and Soramäki, Kimmo. (2016). "Analysis of
correlation based networks representing DAX 30 stock price returns".
[Link]

[8] Gurobi. (2024). "Mixed-Integer Programming (MIP) – A Primer on the Basics".


[Link]

[9] Yahoo. (2024). "What is the adjusted close?".


[Link]

[10] Investopedia. (2023). "Correlation Coefficients: Positive, Negative, and Zero".


[Link]
what-does-it-mean-if-correlation-coefficient-positive-negative-or-zero.
asp

KTH, Stockholm, Sweden 2024 22


I Appendix A
Stocks considered:
Stock Name Sector
[Link] Hexatronic Group AB Technology
[Link] Telefonaktiebolaget LM Ericsson Technology
[Link] Fortnox AB Technology
[Link] HMS Networks AB Technology
[Link] Addnode Group AB Technology
[Link] Sectra AB Technology
[Link] Dustin Group AB Technology
[Link] Hexatronic Group AB Technology
[Link] Vitec Software Group AB Technology
[Link] Invisio AB Technology
[Link] Elekta AB Healthcare
[Link] Vitrolife AB Healthcare
[Link] Swedish Orphan Biovitrum AB Healthcare
[Link] Getinge AB Healthcare
[Link] Camurus AB Healthcare
[Link] Biotage AB Healthcare
[Link] BioGaia AB Healthcare
[Link] Xvivo Perfusion AB Healthcare
[Link] Attendo AB Healthcare
[Link] Vitec Software Group AB Healthcare
[Link] Investor AB Financials
[Link] Nordax Group AB Financials
[Link] Skandinaviska Enskilda Banken AB Financials
[Link] Swedbank AB Financials
[Link] Svenska Handelsbanken AB Financials
[Link] Latour Investment AB Financials
[Link] Industrivärden AB Financials
[Link] Avanza Bank Holding AB Financials
[Link] Kinnevik AB Financials
[Link] Hexatronic Group AB Financials
[Link] Atlas Copco AB Industrials
[Link] Lagercrantz Group AB Industrials
[Link] Assa Abloy AB Industrials
[Link] Indutrade AB Industrials
[Link] SKF AB Industrials
[Link] Saab AB Industrials
[Link] NIBE Industrier AB Industrials
[Link] Lifco AB Industrials
[Link] Lundbergföretagen AB Industrials
[Link] Sandvik AB Industrials
[Link] Hennes & Mauritz AB Consumer Discretionary
[Link] Evolution Gaming Group AB Consumer Discretionary
[Link] Thule Group AB Consumer Discretionary
[Link] Dometic Group AB Consumer Discretionary
[Link] Kindred Group plc Consumer Discretionary
[Link] Electrolux AB Consumer Discretionary
[Link] Betsson AB Consumer Discretionary
[Link] New Wave Group AB Consumer Discretionary
[Link] Bilia AB Consumer Discretionary
[Link] AB Volvo Consumer Discretionary
[Link] Atrium Ljungberg AB Real Estate
[Link] AB Balder Real Estate
[Link] Castellum AB Real Estate
[Link] Wallenstam AB Real Estate
[Link] Fabege AB Real Estate
[Link] Wihlborgs Fastigheter AB Real Estate
[Link] Hufvudstaden AB Real Estate
[Link] Pandox AB Real Estate
[Link] Catena AB Real Estate
[Link] JM AB Real Estate

KTH, Stockholm, Sweden 2024 23


II Appendix B
Gurobi optimization constraints and clarification:

1. Budget Constraint:

• Constrains the total investment in the portfolio to 100% of available funds by


ensuring that the sum of investments in all assets equals 1.

2. Maximum Investment Constraint:

• Limits each asset’s maximum investment to a predetermined value ξ to avoid


overexposure to any single asset.

3. Minimum Investment Constraint:

• Ensures that only assets with an investment share above a certain threshold ε
are included in the portfolio to avoid excessively small investments.

4. Binary Constraints:

• Restricts the number of assets that can be chosen by assigning a binary variable
for each asset indicating whether the asset is included in the portfolio or not.

5. Number Constraint (K-constraint):

• Limits the total number of assets that can be included in the portfolio to a
predetermined number K.

6. Positivity Constraints (X-constraint):

• Ensures that investments in each asset are non-negative to avoid short-selling


or negative investments.

7. Correlation Constraints:

• Limits the simultaneous inclusion of assets based on their correlation, where


assets with a correlation above the accepted threshold η cannot be included
simultaneously in the portfolio.

8. Sector Constraints (L-constraint):

• Ensures balanced representation of different sectors by requiring a certain


number of assets from each sector to be included in the portfolio.

KTH, Stockholm, Sweden 2024 24


[Link]

You might also like