Project Report
Project Report
Ajay Kumar
Master of Science
Ajay Kumar
M19MA002
II
Certificate
This is to certify that the Project Report titled Portfolio Optimization, submitted by Ajay Ku-
mar (M19MA002) to the Indian Institute of Technology Jodhpur for the award of the degree
of M.Sc., is a bonafide record of the research work done by him under my supervision. To the
best of my knowledge, the contents of this report, in full or in parts, have not been submitted
to any other Institute or University for the award of any degree or diploma.
III
Contents
List of Notations
List of Expressions
List of Abbreviations
1. Introduction
2. Literature Review
3. Markowitz’s Theory
4. Optimization Techniques
8. Empirical Study
9. Conclusion
10. Bibliography
IV
List of Notations:
• N = Total number of assets
• Σ = Covariance matrix
• µ = (µ1 , µ2 , µ3 , ..., µN )T
• w = (w1 , w2 , w3 , ..., wN )T
V
List of Expressions:
•
PN
wi = 1
i=1
• µP = N
P
i=1 wi µi
• σP2 = N
P PN
i=1 j=1 wi σij wj
σij
• ρij = σi σj
µM −µr f
• Sharpe Ratio= σM
VI
List of Abbreviations:
• CML : Capital Market Line
VII
1 Introduction:
Portfolio Optimization is a decision-making method in which an amount of
money is invested in various financial assets and allocated weight is changed to minimize the
risk and maximize the return.
H. Markowitz is a famous American economist who is best known for his work in
modern portfolio theory. He wrote a paper named “Portfolio Selection” in 1952. He proposed
that instead of investing in low risky financial assets, invest in a diversified stock portfolio and
minimize the risk in those. Later he got a Noble Prize in 1990. Harry Markowitz laid the
fundamentals principles of selecting assets for an investment portfolio in 1952. Along the lines
of Markowitz’s theory extensive research has discovered extensions to Markowitz MV(Mean-
Variance) model[1] . Later William F. Sharpe has developed the theory of optimal portfolio selec-
tion after inclusion of risk-free asset in markowitz’s portfolio and constructed CAP’M(Capital
Asset Pricing Model) model, with the help of this he constructed the optimal portfolio which
is named as market portfolio(Tangency Portfolio)[21] .
2 Literature Review:
There has been a lot of work done regarding the Markowitz Theory
concerning the allocation of money in the portfolio using various types of models. Basically,
there are two main tasks to portfolio formation to achieve the target: 1. Selection of assets
with higher revenue. 2. Determine the allocated value proportion of each asset. According
to this model, an investor wants to minimize the risk for a given level of return or maximize
the return for a given level of risk[1] . Polynomial Goal Programming Model(PGP). The PGP
model’s eventual purpose is to minimize deviations between the optimum of each objective
and the aggregate final objective. This model is particularly advantageous in the sense that it
guarantees the existence of an optimal solution, it provides the flexibility to cater to investors’
preferences. The relative simplicity of calculation methods that are used and the fact that
the model is general enough to include investors’ preferences related to higher-order moments,
skewness and kurtosis, are among the other advantages to this model[2] . The original MV
model has some restrictions which means that an investor can take decisions at the time of
investing and then have to wait until the result. But dynamic optimization allows investors
to analyze their portfolio at any time[3] . In this paper, it has been described how to build an
effective quantitative strategy by deep learning. The LSTM(Long-Short Term Memory)Network
a kind of RNN(Recurrent Neural Network) to forecast the stock price in order to illustrate the
quantitative trading strategy[4] . (M-V-S-K)Mean-Variance Skewness Kurtosis model. This
paper gave an advanced hybrid approach to solve the selection of portfolio with kurtosis and
skewness, which involve not only the multi-objective optimization but also include the data-
driven return prediction and asset selection. In addition, the multi-objective optimization has
been transformed into a non-linear programming model with preferences of risk[5] . Benefits
of diversification. Diversification is a risk managing process, in which investors invest in a
portfolio that contains a wide variety of assets rather than invests in a single type of asset.
This strategy helps to reduce risk if the portfolio does not contain perfectly correlated assets.
Diversification neutralizes the negative performance of the portfolio by positive performance
assets[8][13] .What is the relationship between the risk and expected return of an investment? The
capital asset pricing model (CAPM) provides an initial framework for answering this question.
The CAPM (Sharpe, 1964; Lintner, 1965) marks the birth of asset pricing theory. This model
is based on the idea that not all risk should affect asset prices[17] . The test which deals with
1
the linear hypothesis for the GMVP weights were obtained using the assumption of invertible
covariance matrix. However, the problem of potential multicollinearity and correlations of assets
constitutes a restriction of the classical portfolio theory. Therefore, there is an interest in making
new theory in the presence of singularities in the variance-covariance matrix. So, we extend
the test by analyzing the portfolio weights in the small sample case with a singular covariance
matrix[17][20] . After investigation of the properties of the optimal portfolio to maximizing the
Sharpe ratio and develop a method for the calculation of the risk of this portfolio. This has
been get by constructing an optimal portfolio which minimizes the risk and at the same time
clashes with the market portfolio on the efficient frontier(Markowitz’s Bullet) which is related
to the sharpe ratio portfolio[21][24] .
3 Markowitz’s Theory:
A Portfolio means a collection of various kind of finan-
cial assets like stocks, bonds, shares, financial debts, mutual funds, etc. and Optimization
means a method/activities/coordination to make something (which may be a system, decision,
design) worthwhile as much as possible.The pioneering method of portfolio optimization was
given by H. Markowitz (1952) in his paper ”Portfolio Selection”[1] . Portfolio management is a
decision-making process in which an amount of money is invested in various financial assets,
and the invested weight is constantly changed in order to minimize the risk and maximize
the return[1][10] . Basically, there are two approaches to manage a portfolio: quantitative and
traditional. The traditional approach is likely as a fundamental approach and the quantitative
approach means to technical approach. Both of these have some common characteristics like as
analysis of historical data, evaluation of performance over time, true value of assets. However
the traditional managers believe in qualitative factors, regime shifts but quantitative managers
believe in risk management, the discipline of market trends, universe exploration[4] . In financial
markets constructing an efficient portfolio to forecasting market trend is a challenging task
under quantitative approach so most of the investors are using some mathematical models and
some machine learning algorithms to increase the prediction accuracy[11] .
4 Optimization Techniques:
In this section we analyze a portfolio which contains only risky assets, Firstly we
analyze a two risky assets portfolio and then extend it for N number of risky assets using
Lagrangian Method of Undetermined Multipliers, and we will construct a Minimum Variance
Portfolio(MVP)
(w) + (1 − w) = 1
2
where ρ is the correlation coefficient of A & B, now eliminate w from above equations
and put different-different values of ρ, and see, how the graph will change in Risk-Return space.
To plot the below graphs I have used data[12] of closing price of two banks,
AXIS and SBI, on monthly basis of year 2020. Then insert all data in Excel-Sheet and use all
expressions which are required to find different parameters to plot graphs.
⇒ σ(R) = | (E(R)−µ 2)
(µ1 −µ2 )
σ1 − (µ1µ−E(R))
1 −µ2
σ2 | (4.1.d)
Table: 2
Feb. Mar. Apr. May June July Aug. Sep. Oct. Nov. Dec.
σ(R) 0.164 0.128 0.093 0.058 0.023 0.012 0.047 0.082 0.0117 0.0152 0.187
ρ = −1
µ(R) 0.001 0.002 0.002 0.003 0.003 0.004 0.005 0.005 0.006 0.006 0.007
*There is no return for January month, return(%change) starts from second month.
The data in above table is of risk and return value on monthly basis of AXIS and SBI banks,
now plot a graph using above data, by which we get a hooked line in Risk-Return space as
shown below:
Figure: 1
Table: 3
3
Feb. Mar. Apr. May June July Aug. Sep. Oct. Nov. Dec.
σ(R) 0.164 0.148 0.136 0.127 0.123 0.124 0.130 0.140 0.153 0.169 0.187
ρ=0
µ(R) 0.001 0.002 0.002 0.003 0.003 0.004 0.005 0.005 0.006 0.006 0.007
Figure: 2
E(R) = (σ(R)−σ2 )
(σ1 −σ2 )
µ1 + (σ(σ1 −σ(R))
1 −σ2 )
µ2 (4.1.h)
Table: 4
Feb. Mar. Apr. May June July Aug. Sep. Oct. Nov. Dec.
σ(R) 0.164 0.166 0.168 0.171 0.173 0.175 0.178 0.180 0.182 0.185 0.187
ρ=0
µ(R) 0.001 0.002 0.002 0.003 0.003 0.004 0.005 0.005 0.006 0.006 0.007
Figure: 3
4
4.2 Markowitz Mean-Variance analysis for N Risky assets
Analysis of a portfolio that contains N no. of Risky assets using the Lagrangian
method of undetermined multipliers :
1
PN PN
minimize 2 i=1 j=1 wi σij wj
PN
subjected to i=1 wi µi = µP
PN
i=1 wi = 1
From Lagrangian
PN PN
wi σij wj − λ1 ( N
1
P PN
L= 2 i=1 j=1 i=1 wi − 1) − λ2 ( i=1 wi µi − µP ) (4.2.a)
Now differentiate eq. no. (4.2.a) w.r.t. wi , λ1 , λ2 and put equal to zero.
so,
∂L
PN
∂wi
= i=1 σij wj − λ1 − λ2 µi = 0 (4.2.b)
∂L
PN
∂λ1
= i=1 wi − 1 = 0 (4.2.c)
∂L
PN
∂λ1
= i=1 w i µi − µP = 0 (4.2.d)
wT e = 1 (4.2.f)
w T µ = µP (4.2.g)
from (4.2.e)
now insert eq. no. (4.2.h) into eq. no. (4.2.f), (4.2.g) than we get two equations in terms
of λ1 & λ2
consider, α = eT Σ−1 e, β = eT Σ−1 µ = (µT Σ−1 e)T because covariance matrix is a symmetric
matrix so it’s equal to it’s transpose and γ = µT Σ−1 µ than we have
5
λ1 α + λ2 β = 1 and
λ1 β + λ2 γ = µP
consider, Determinant(∆) = αγ − β 2
now put values of λ1 & λ2 in eq. no. (4.2.h) then we get optimum weight is equal to:
1 −1
w= ∆
Σ [(γ − βµP )e + (αµP β)µ] (4.2.k)
σP2 = wT Σw
σP2 = λ1 + λ2 µP
αµ2 −2βµ +γ
σP2 = P ∆ P (4.2.l)
so, by this equation, we can conclude that the minimum risk(variance) portfolio
is represented by a parabolic curve as shown in the below graph by varying the value of µP .
From here the concept of efficient frontier is introduced, we will discuss it in the next section.
Figure: 4
Alternatively, if we plot this graph in σP − µP space then it will look like as a hyper-
bola(Markowitz’s Bullet).
Efficient Frontier:
6
The efficient frontier is the set of portfolios on the upper left boundary of the
attainable set, between the minimum variance point(MVP) and the maximum return point(as
shown in the above diagram). Here MVP denotes a portfolio that has minimum risk(variance).
So above At this point, all portfolios are efficient portfolios and below this point all portfolios
are inefficient.
Table: 5
A glance at Table 4 reveals that Assets A&B are experiencing regular variability from
year to year, implies they are risky assets. On contrary the combined portfolio experiencing
zero variance in returns, implies this portfolio is riskless. One thing have you noted here,
that these both assets are negatively correlated, that’s why Markowitz proposed that, investor
always should invest in a diversified portfolio[13] .
Examples : PPF(Public Provident Funds), T-Bills, Municipal Bonds, Govt. Bonds, etc.
Two assets portfolio means a portfolio which contains two assets in those one is risky
asset and another risk-free asset. So, let us consider that rf is rate of return for risk-free asset
and risk is of course zero, and for µrisky is rate of return for risky asset and σrisky is measure
7
of risk for the same. Now let us suppose that w and 1 − w amount of money invested in risky
asset and risk-free asset respectively.Now compute return and risk for this portfolio,
µP = (1 − w)rf + wµrisky
= rf + w(µrisky − rf )
σP = wµrisky
Eliminate w from above two equations, then we will get a straight line,
µrisky −rf
⇒ µP = rf + ( σrisky
)σP
Figure: 5
According to above figure here w = 0 means investor is risk averse and invested
his/her all money in risk-free asset and w = 1 means investor is risk lover and invested his/her
all money in risky asset.
8
Market Portfolio(Tangency Portfolio) and the tangent line is called CML(Capital Market Line).
Consider w = (w1 , w2 , ..., wN ) and µ = (µ1 , µ2 , ..., µN ) are weight vector and return vector
corresponding to each risky asset i.e. (a1 , a2 , ..., aN ) and wrf is weight and µrf is return of
risk-free asset, so
PN
i=1 wi + wrf = 1
PN
⇒ wrf = 1 - i=1 wi , this is the proportion of wealth invested in
risk-free asset.
1
PN PN
minimize 2 i=1 j=1 wi σij wj
PN
subjected to i=1 wi µi + wrf µrf = µP
PN PN
1
wi σij wj +λ(µP −wrf µrf − N
P
Define the Lagrangian: L = 2 i=1 j=1 i=1 wi µi ) (5.0.a)
Now differentiate eq. no. (5.0.a) w.r.t. to wi and λ and put equal to zero.
so,
∂L
PN
∂wi
= i=1 σij wj − λ(µ − µrf e) = 0, i = 1, 2,..., N (5.0.b)
∂L
∂λ
= (µ − µrf e)T w − µP + µrf = 0 , where w = (w1 , w2 , ..., wN )
on solving (5.0.b) we get w = λΣ−1 (µ − µrf e), substituting into (5.0.c), then
µP − µrf = λ(γ − 2µrf β + µ2rf α) , where α, β and γ are constants using eq. no. (4.2.j)
these are the boundary tangent lines, so now we will consider only upper tangent line
because every investor wants to gain more return as much as possible.
2
Now let us suppose that Market Portfolio(Tangency Portfolio) represents by point M (σM , µM ).
The coordinates of this tangent point are the solution of following two equations,
9
αµ2P −2βµP +γ
σP2 = ∆
from eq. no. (4.2.l)
q
µP = µrf + σP αµ2rf − 2βµrf + γ from eq. no. (5.0.d)
where:
• µP = Return of portfolio
• µrf = Risk-free rate of return
µM −µrf
• σM
= Sharpe Ratio
• σP = Risk pf portfolio
Now we plot both equation of CML as well as equation of efficient frontier on Risk-Return space.
Figure: 6
10
6 Asymptotes on Markowitz’s Curve
Now we will draw asymptotes on Markowitz’s Bullet. An asymptote of a curve is a
line such that distance between line and curve proceeds towards to zero as x and y coordinates
tends to infinity.
after rewriting
φ2 (m) = αm2 − ∆
0
⇒ φ2 (m) = 2αm
φ1 (m) = −2βm
c = − φφ01 (m)
(m)
2
2βm
⇒ c= 2αm
β
⇒ c= α
µP = mσP + c
q
β
⇒ µP = ±( ∆α
)σP + α
Now we will plot this asymptote line on graph with markowitz curve and it will look like as
follows:
11
Figure: 7
Now pick up equation of both asymptote and CML from above sections then we will
find point of intersection with the help of these two equations, which will be our main result,
so equation are as follows,
β−αµrf √ √
⇒ √
α
= ∆( α − 1)σP
β−αµrf
⇒ σP = √ √ √
α ∆ α−1
(7.0.1)
Now put the value of σP , eq. no. (7.0.1) in equation of asymptote then we will get value of
µP ,
12
β β−αµrf
µP = α
+ √
α α−1
√
β( α−1)−µrf
⇒ µP = √
α−1
(7.0.2)
Now plot this intersection point P(let) on graph with markowitz’s curve(Efficient Frontier),
which is as follows,
Figure: 8
Now we have the best portfolio in our hand for those investors who bother only about re-
turn, for those who wants to gain maximum return as much as possible. Now we will apply
the same algorithm on real data set also, and we will plot the point of intersection on graph
also, so we might sure that these lines intersect really or not. For application part we have
done this same study on real data set also. we took closing price of thirty stocks of one year
time period and then apply the same algorithm and compute all things which we have done in
above sections, and we got the intersection point of CML and asymptote.
8 Empirical Study:
Now we will apply the same algorithm on a real market dataset.
Data Set:
We have used closing price of top 30 companies of their shares from stock market.
We have analysed this dataset of 1 year, from January 2019 to January 2020. We imported
this dataset from yahoo finance. All the data preprocessing was done using python.
Statistical Variables:
In this whole work We have used many statistical tools which are like as mean,
expected return, variance, standard deviation, correlation coefficient, covariance, variance-
covariance matrix, sharpe ratio, etc.
13
Minimum Variance Portfolio(MVP):
Here We have applied the algorithm of section (4.2) using python and got minimum
variance point on efficient frontier, which is as follows:
Here we have applied the algorithm of section (5) and got market portfolio on
efficeint frontier, which is as follows:
14
Here we have applied the algorithm of section (7) and got the optimal portfolio,
which is as follows:
9 Conclusion:
Generally, all investors are risk-averse, so from this work, we concluded that, investors
should always buy only those types of securities that are negatively correlated, now suppose
that an investor two assets in the portfolio, which are negative correlation and if one asset’s
price drops than other’s price will automatically go high, so the investor will not have a fear
of losing all of his money. On the contrary, if both the assets are positively correlated, then no
doubt there is a chance that if he gets lost in one then he will be at loss in another one also.
Another thing we have concluded is that an investor should always try to construct a portfolio
of wide variety of assets rather than invest in a single type of asset. Because if an investor
invested all of his money in a single company and that company become insolvent after some
time than that investor loses his all money.
In the market there are some investors who wants to invest in a portfolio which
contains both risky and risk-free assets, so those type of investors will go through the CML. If
an investor have chosen his/her portfolio below market portfolio means he/she have invested
in both assets is called long selling and if an investor have chosen his/her portfolio above mar-
ket portfolio means he/she has borrowed money from bank(as a Risk-free asset) and invested
total money in market is called short selling. If an investor have chosen his/her portfolio at the
point of market portfolio implies he/she have invested his/her all money in market(Risky Asset).
In the same market both types of investors are there like risk averse investors and
risk lover investors, so if a investor ready to take more risk implies he/she has some hope of get
more return then others and surely he/she will get. So here in this work we have constructed a
portfolio for such investors, who only believes in getting maximum return as much as possible
but at the same time this portfolio is more risky then all other portfolios. In this work we have
claimed that this portfolio lies at intersection point of asymptote and Capital Market Line.
15
10 Bibliography:
References
[1] H. Markowitz, Portfolio Selection, J. Finance(1952), p. (77)
[2] Mircea Bahna, A Literature Review on The Goal Programming Methods used for Portfolio
Optimization, Bucharest University of Economic Studies, ASE,(2020), p. (1),(2)
[3] Yuanyuan Zhang, Xiang Li & Sini Guo, Portfolio selection problems with Markowitz’s
mean–variance framework: a review of literature,(2017), p. (126)
[4] Van-Dai Taorcid, Chuan-Ming Liu Orcid, and Direselign Addis Tadesse, Portfolio
Optimization-Based Stock Prediction Using Long-Short Term Memory Network in Quanti-
tative Trading(2020), p. (1)
[5] Bilian Chen Jingdong Zhong Yuanyuan Chen, A hybrid approach for portfolio selection
with higher-order moments: Empirical evidence from Shanghai Stock Exchange, (2019),p.
(1),(2)
[6] Edwin J. Elton, Martin J. Gruber, Stephen J. Brown, William N. Goetzmann- Modern
Port-folio Theory and Investment Analysis-Wiley (2013), p. (11),(39),(41)
[10] Wang Wuyu LiWeizi Zhang Ning Liu Kecheng, Portfolio formation with preselection using
deep learning from long-term financial data, (2019), p. (2),(3)
[11] Ayodele Ariyo Adebiyi, Aderemi Oluyinka Adewumi, and Charles Korede Ayo, Compar-
ison of ARIMA and Artificial Neural Networks Models for Stock Price Prediction, (2014),
p. (2)
[12] https://in.investing.com/
[13] Jack Clark Francis, Dongcheol Kim - Modern Portfolio Theory, Foundations, Analysis,
and New Developments-Wiley (2013), ch. (1),(2),(3),(4)
[14] Stanislaus Maier-Paape and Qiji Jim Zhu - A General Framework for Portfolio The-
ory—Part I: Theory and Various Models, (2018)
[15] Mercedes Landete, Jaun F. Monge, Jose L. Ruiz - Sharpe portfolio using a cross-efficiency
evaluation, (2016)
[16] Taras Bodnar, Stepan Mazur, Yarema Okhrin - Bayesian estimation of the global minimum
variance portfolio, (2017)
[17] Matteo Rossi - The capital asset pricing model: A critical literature review, (2016)
[18] Karolis Cizauskas - Revisiting Markowitz: portfolio optimisation including higher moments
of return, (2019)
16
[20] Taras Bodnar, Stepan Mazur, Krzysztof Podgórski - A test for the global minimum variance
portfolio for small sample and singular covariance, (2016)
[22] Simone Farinelli, Manuel Ferreira, Damiano Rossello, Markus Thoeny, Luisa Tibiletti -
Beyond Sharpe ratio: Optimal asset allocation using different performance ratios, (2008)
[23] Edwin J. Elton, Martin J. Gruber and Manfred W. Padberg - Simple Criteria for Optimal
Portfolio Selection: Tracing Out the Efficient Frontier, (1978)
[24] Taras Bodnar & Taras Zabolotskyy - How risky is the optimal portfolio which maximizes
the Sharpe ratio?, (2016)
17