Modern Portfolio Theory-Searching For the Optimal Portfolio-Portfolio Management in Python

Follow us on LinkedIn

In the previous installment, we presented a description of the Model Portfolio Theory and provided a concrete example in Python. We also explained the concept of an Efficient Frontier and provided a visual presentation of it. Recall that,

… the efficient frontier (or portfolio frontier) is an investment portfolio which occupies the “efficient” parts of the risk–return spectrum. Formally, it is the set of portfolios which satisfy the condition that no other portfolio exists with a higher expected return but with the same standard deviation of return (i.e., the risk). The efficient frontier was first formulated by Harry Markowitz in 1952.

A combination of assets, i.e. a portfolio, is referred to as “efficient” if it has the best possible expected level of return for its level of risk (which is represented by the standard deviation of the portfolio’s return). Here, every possible combination of risky assets can be plotted in risk–expected return space, and the collection of all such possible portfolios defines a region in this space. In the absence of the opportunity to hold a risk-free asset, this region is the opportunity set (the feasible set). The positively sloped (upward-sloped) top boundary of this region is a portion of a hyperbola and is called the “efficient frontier”. Read more

In this follow-up post, we are going to search for the optimal portfolio, i.e. one that has the highest risk-adjusted return. To do so, we will maximize the portfolio’s Sharpe ratio. The Sharpe Ratio is a financial metric that helps investors determine the return of an investment compared to its risk. It presents the average return that investors earn above the risk-free rate per unit of volatility or risk. The higher the Sharpe Ratio of a portfolio, the better it is in terms of risk-adjusted return.

Our hypothetical portfolio consists of 3 Exchange Traded Funds: SPY, TLT, and GLD which track the S&P500, long-term Treasury bond, and gold respectively.  We downloaded 10 years of data from Yahoo Finance and utilized a Python program to search for the optimal portfolio. The figure below shows the Efficient Frontier along with the optimal portfolio (depicted by the red dot).

Portfolio Management in Python

The figure below shows the optimal portfolio’s composition, return, volatility, and the Sharpe ratio.

Modern Portfolio Theory in Python

Further questions

What's your question? Ask it in the discussion forum

Have an answer to the questions below? Post it here or in the forum

LATEST NEWSBill to allow referendum on northern Virginia casino advances in legislature
Bill to allow referendum on northern Virginia casino advances in legislature

FALLS CHURCH, Va. (AP) — Legislation that would allow a referendum on a casino in the northern Virginia suburbs of the nation’s capital cleared a hurdle Thursday when a state Senate committee voted to advance the bill. The bill would allow Fairfax County to hold…

Stay up-to-date with the latest news - click here
LATEST NEWSCanada Officially Adds India to Its Probe of Election Meddling
Canada Officially Adds India to Its Probe of Election Meddling

Canada’s public inquiry into foreign interference will examine allegations that India sought to meddle in recent national elections, potentially inflaming already-elevated tensions between the two countries.

Stay up-to-date with the latest news - click here
LATEST NEWSAustralia Seen Cutting Interest Rates Late This Year as Inflation Lingers
Australia Seen Cutting Interest Rates Late This Year as Inflation Lingers

Australia’s central bank will embark on an easing cycle in the final three months of this year, economists predict, trailing major counterparts as inflation proves stubborn Down Under and takes longer to return to target.

Stay up-to-date with the latest news - click here
LATEST NEWSMost actively traded companies on the Toronto Stock Exchange
Most actively traded companies on the Toronto Stock Exchange

TORONTO — Some of the most active companies traded Wednesday on the Toronto Stock Exchange: Toronto Stock Exchange (21,025.78, down 8.81 points): Royal Bank of Canada. (TSX:RY). Finance. Down $1.40, or 1.05 per cent, to $132.34 on 20.3 million shares. B2Gold Corp. (TSX:BTO). Mining. Down…

Stay up-to-date with the latest news - click here
LATEST NEWSMicrosoft hits $3 trillion market value, second to Apple
Microsoft hits $3 trillion market value, second to Apple
Stay up-to-date with the latest news - click here

2 Comments

Leave a Reply