By Mandeep Kaur

In this blog, we will discuss various aspects of the portfolio evaluation and portfolio measurement. We’ll start discussing with why evaluation and measurement are necessary and will then move on to how to compute and analyze the returns generated by the portfolio after a particular time period.

One key difference between the calculation of portfolio returns in the previous blog and this blog is that, here, we will see how to compute the returns after they are generated. While in the previous case, we were computing expected returns of the portfolio based on the expected returns of the constituent stocks.

**Why Performance Measurement and Evaluation is required?**

Evaluation of the performance measurement is necessary for investors and portfolio managers both. However, the need for evaluating may be different for these two sets of people. Performance evaluation also shows the areas of effectiveness as well as improvements in the investment scheme. Some of the benefits for evaluating the portfolio performance include the following

- The return performance of the investment over time (performance measurement)
- How the observed performance is attained (performance attribution)
- If the performance is due to investment decisions (performance appraisal)

**Calculation of Portfolio Returns**

Let us assume that the period of evaluation is t, market value at the start of the time period was MV_{0} and at the end of this time period is MV_{t}. Further, the cash inflows at the start and end of the time period t are CF_{0} and CF_{t}. The return from the portfolio for this period can be computed as:

Consider the example below.

On Jan 1, 2017, the value of the portfolio was $ 100,000 and another $ 50,000 was inducted in the portfolio. There were no intermediate cash flows and on Dec 31, 2017, another $ 25,000 were introduced. The portfolio value as on close of business on Dec 31, 2017, is $ 200,000. The time period here is 1 year. The return from the portfolio can be computed in python as shown.

#Assigning various values MV0 = 100000 MVt = 200000 CF0 = 50000 CFt = 25000 #Calculating portfolio return Rt = ((MVt - CFt) - (MV0 + CF0)) / (MV0 + CF0) print (‘The return from the portfolio is:’, round(Rt*100,2)) #Output The return from the portfolio is: 16.67

As we can see from the above equation, we add any external cash inflow at the beginning of the period to the initial market value of the portfolio and subtract any external cash inflow at the end from the market value at time period t. The only assumption made here is that no liquid cash is maintained with the portfolio manager and all the cash is invested in the portfolio.

Now let’s assume that there are multiple such time periods or multiple cash inflows within the time period for which we are computing the returns. In these cases, we use time-weighted rate of return (TWRR) and money-weighted rate of return (MWRR) respectively.

**Time-Weighted Rate of Return (TWRR)**

If there are n time periods within our analysis period t and r_{t,i} denotes the return from the sub-period i, then the time-weighted rate of return can be computed as:

**Money-Weighted Rate of Return (MWRR)**

MWRR is essentially the internal rate of return from the portfolio. While computing the IRR, the initial market value MV_{0} is considered as the cash inflow at t = 0. All the current inflows are considered as positive in the below equation. Let R be the internal rate of return or the MWRR from the portfolio, it can be computed using the equation:

Where,

MV_{t} is the ending market value of the portfolio

MV_{0} is the initial market value

m is the number of time units in the considered period (number of days, weeks, months, etc.)

CF_{i} are the clash flows

L(i) is the time units remaining after the cash flow CFi is inducted

Using this method, we will now compute the TWRR and MWRR for the given portfolio.

Market value as on start of Jan 1 2017: $ 100,000

Market value as on close of Mar 31 2017: $ 110,000

Cash inflow on Apr 1 2017: $ 5,000

Market value as on close of Jun 30 2017: $ 120,000

Market value as on close of Sep 30 2017: $ 125,000

Cash inflow on Dec 31 2017: $ 7,000

Market value as on close of Dec 31 2017: $ 140,000

**Computing TWRR in Python**

#Defining the market value and cashflow lists MV = [100000,110000,120000,125000,140000] CF = [[0,0],[5000,0],[0,0],[0,7000]] #Computing return from each period ret = [0,0,0,0] for i in range(len(MV)-1): ret[i]=((MV[i+1]-CF[i][1])-(MV[i]+CF[i][0]))/(MV[i]+CF[i][0]) TWRR = 1 for i in range(len(ret)): TWRR = TWRR*(1+ret[i]) TWRR=TWRR-1 print ('The TWRR for the portfolio is (in %age): ', round(TWRR*100,2)) #Output The TWRR for the portfolio is (in %age): 27.22

**Computing MWRR in Python**

#Importing library import numpy as np #Computing MWRR of the portfolio is same as computing IRR of the below list IRR_list = [-100000,-5000,0,0,-7000+140000] #Calculating IRR IRR_quarterly = np.irr(IRR_list) IRR_yearly = 4*IRR_quarterly print ('The MWRR for the portfolio is (in %age): ', round(IRR_yearly*100,2)) #Output The MWRR for the portfolio is (in %age): 24.65

**Portfolio Return Components**

Having calculated the return from the portfolio, we will analyze various components of the return. These returns can be divided into three components.

P = M + S + A

Where,

P is the return from the portfolio

M is the market return

S = B – M, where B is the benchmark return. S signifies excess return due to investing style (for example, a manager investing only in large-cap automotive sector)

A = P – B, is the active return generated by the manager over the benchmark

**Performance Attribution**

The active return or the value-added return (return of the portfolio – benchmark return) can be attributed or broken into three components.

**Pure sector selection**: Pure sector selection assumes that the manager holds the same sectors in the portfolio as in the benchmark but in different proportions. The proportion of each security within each sector is also held the same as in the benchmark. The active performance is due to the selection of the weights of the sector only.**Within-sector selection return**: This assumes that the portfolio manager holds all the sectors in the same proportion as the benchmark and the returns are generated by adjusting the weights of securities in each sector.**Allocation/selection interaction return**: This involves the joint effect of changing the weights of both the securities and the sectors in the portfolio. Any increase in the weight of a security will also increase the weight of that sector.

Where,

R_{V} = Value added return

w_{P, j} = Portfolio weight of sector j

w_{B, j} = Benchmark weight of sector j

R_{P, j} = Portfolio return of sector j

R_{B, j} = Benchmark return of sector j

R_{B} = Return of portfolio’s benchmark

S = Number of sectors

In the above equation, the first term refers to the pure sector allocation, the second term refers to the selection interaction return while the third term refers to the within-sector selection return.

We will now compute all the three components of active return for the below portfolio using python.

#Defining the weights and returns of all sectors in portfolio and benchmark port_weights = [6.77,8.52,36.22,5.24,18.53,14.46,10.26] bench_weights = [6.45,8.99,37.36,4.65,16.56,18.87,7.12] port_returns = [-0.82,-3.28,1.96,0.44,2.98,2.32,0.54] bench_returns = [-0.73,-4.34,1.98,0.24,2.22,-0.48,-0.42] #Calculating and printing the sum of weights of sector in portfolio sum_port_weights = 0 for i in range(len(port_weights)): sum_port_weights+=port_weights[i] print ('The sum of portfolio weights is: ', round(sum_port_weights)) #Calculating and printing the sum of weights of sector in benchmark sum_bench_weights = 0 for i in range(len(bench_weights)): sum_bench_weights+=bench_weights[i] print ('The sum of benchmark weights is: ', round(sum_bench_weights)) #Calculating and printing the return from the portfolio ret_port=0 for i in range(len(port_returns)): ret_port+=port_weights[i]*port_returns[i]/sum_port_weights print ('The return from the portfolio is: ', round(ret_port,2)) #Calculating and printing the return from the benchmark ret_bench=0 for i in range(len(bench_returns)): ret_bench+=bench_weights[i]*bench_returns[i]/sum_bench_weights print ('The return from the benchmark is: ', round(ret_bench,2)) #Calculating active return from the portfolio ret_active = ret_port - bench_port print ('The active return is: ', round(ret_active,2)) #Calculating pure sector return pure_sec_ret=0 for i in range(len(port_weights)): pure_sec_ret+=(port_weights[i]-bench_weights[i])*(bench_returns[i]-ret_bench)/sum_port_weights print ('The pure selection return is: ', round(pure_sec_ret,2)) #Calculating selection interaction return sel_int_ret=0 for i in range(len(port_weights)): sel_int_ret+=(port_weights[i]-bench_weights[i])*(port_returns[i]-bench_returns[i])/sum_port_weights print ('The selection interaction return is: ', round(sel_int_ret,2)) #Calculating within-sector selection return wit_sec_ret=0 for i in range(len(port_weights)): wit_sec_ret+=bench_weights[i]*(port_returns[i]-bench_returns[i])/sum_port_weights print ('The within-sector selection return is: ', round(wit_sec_ret,2)) #Summing up all the components ret_active_2 = pure_sec_ret + sel_int_ret + wit_sec_ret print ('The total active return from the components is: ', round(ret_active_2,2)) #Output The sum of portfolio weights is: 100 The sum of benchmark weights is: 100 The return from the portfolio is: 1.34 The return from the benchmark is: 0.56 The active return is: 0.78 The pure selection return is: 0.05 The selection interaction return is: -0.08 The within-sector selection return is: 0.81 The total active return from the components is: 0.78

As can be seen from the above results that the sum of all the three components add-up to the active returns from the portfolio (also known as alpha).

**Summary**

In this blog, we saw how to compute the returns from a portfolio in a given time period with multiple cash flows using TWRR and MWRR. We also saw how to divide the portfolio returns into components. Lastly, we covered the attribution of active return into three components, viz., pure sector allocation, within-sector allocation and allocation/selection interaction returns.

**Next Step**

If you want to learn various aspects of Algorithmic trading then check out the Executive Programme in Algorithmic Trading (EPAT™). The course covers training modules like Statistics & Econometrics, Financial Computing & Technology, and Algorithmic & Quantitative Trading. EPAT™ equips you with the required skill sets to be a successful trader. Enroll now!

**Disclaimer: ***All investments and trading in the stock market involve risk. Any decisions to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.*

**Download Python Code**

- Portfolio Analysis – Performance, Measurement and Evaluation – Python Code