# How to calculate daily returns

Stock Returns. Probably the most fundamental and focal concept within investment analysis &amp; portfolio management. How to calculate stock returns then? Perhaps more importantly,

Stock Returns. Probably the most fundamental and focal concept within investment analysis & portfolio management. How to calculate stock returns then? Perhaps more importantly, why should you calculate it that way?Table of Contents hide1 Profits vs. Return2 Generalized Return of a Stock3 How to Calculate Stock Returns with Dividends3.1 What are Dividends?4 Generalized Return of a Stock with Dividends4.1 Total Return vs. Dividend Yield5 How to Calculate Stock Returns on Excel®5.1 Accessing Financial Data5.2 Extracting Relevant Data5.3 Calculating Stock Returns on Excel6 How to Calculate Stock Returns on Python7 Wrapping Up

TL;DR

You can calculate the total stock return using this formula / equation:

Where

reflects the return on a stock

refers to the Price at time

, aka the price you sell the stock for; put differently, its ending value.

on the other hand reflects the Price at time

, aka the price youbought the stock for. Its the beginning value, if you like; or the initial investment, if you will.

This stock return formula holds regardless of whether youre calculating the daily return, weekly return, monthly return, or annual return depending on the data youre working with.

If youre working with daily data and want to calculate annualized return from daily returns, you can either:

• multiply the daily return by 250 (the approximate number of days the stock market is open for in a year), or
• use

where

here reflects the daily return

Now, to seewhy this equation works the way it does, and to understand it inside out, read on.

You might want to grab a cup of tea though. This is probably the most in-depth explanation of how to calculate stock returns on the internet.

Just a quick note though  the equations in this article are best viewed on a laptop/desktop. Unfortunately, mobile phones dont quite render the equations as well as desktops. Were looking into technologically feasible solutions to overcome this issue.

If you havent seen our post on Investment Fundamentals: Price, Risk & Return, its worth reading that first.

But heres a quick recap of the core point from that article:

Return refers to the amount of money that you make from your investment, expressed in percentage terms.

If youd prefer to learn by video, heres the related video:

Yes, we are on YouTube. No, we wont ask you to like, subscribe, or click this button and that.

But people like you do seem to be subscribing to our channel increasingly   its great to have you all on board. Were grateful.

Now, before we explore how to calculate stock returns, its important to get some fundamentals right.

Specifically, we want to know the difference between profit and return.

## Profits vs. Return

Imagine that you buy stock in Facebook for $160 and sell it for$192.73.

What is your profit and what is your return?

If you think about profit profit shows you the amount of money that you earn from an investment. And its expressed in dollars or pounds or whichever currency youre working with.

The return shows you exactly the same information, except that its expressed in percentage terms.

In this example, to get the profits, we would start with the selling price (the amount or the price at which we sold the stock) and take away the purchase price (the price at which we bought the stock).

And that gives you the profit. Note that in this context, profit is akin to capital gains, which is the difference between what you bought something for and what you sold it for.

We can annotate the Selling Price (or ending value) as

and the Purchase Price (or beginning value) is

.

So

means this is the price at time

plus one. And

means that is the price of the stock at time

.

And

could be whatever you like. So it could be the date of purchase, or it could be the month of purchase, or it could be the quarter of purchase. It really depends on the frequencies that you are working with.

in our case was $192.73 and was$160. Take the difference between the two and you end up with a profit of $32.73. To get the return, all we need to do is express the same$32.73 in percentage terms. And we do that by expressing it relative to the original investment of $160. What does that look like? Well, the return of a stock is calculated as: Remember again the is the Selling Price. is the Purchase Price. And then were scaling the difference between the two by the original price (i.e., the Purchase Price) to get the amount of money that you make, expressed in percentage terms. In this example, is$192.73 and

is $160. Take the difference between the two and divide it by (which is$160).

Now, because of the way the equation is written out, we can actually split it into two parts.

So I can take $192.73 and divide that by$160. And then subtract $160 divided by$160. So I can rewrite this equation like so:

And this then simplifies to $192.73 divided by$160, minus one (because anything divided by itself is always equal to 1).

When you solve for this, youll find that the return is 20.46%.

This Article features a concept that is covered extensively in ourInvestment Analysis and Portfolio Management (with Excel®) Course.

If youre interested in learning more about calculating stock returns (and portfolio returns) while working with real-world data, then you should definitely check out the course.

## Generalized Return of a Stock

Lets just look at calculating stock returns again. But this time, well work with notations instead of numbers.

The return on a stock is:

This can be rewritten as:

Anything divided by itself is always equal to 1. And so this equation here can be rewritten like this:

And thats pretty much it!

So when you think about how to calculate stock returns, the general equation can look like this:

Notice the subscript

in

.

could be anything  it could be Facebook or Alphabet (formerly Google) or Amazon or Netflix  whatever you like.

is just a generic term or generic notation for any stock.

So

refers to the return on the stock

.

You can calculate the return on a stock using either formula and youll end up at exactly the same result.

All right. Hopefully, this makes sense. If its not quite clear, please re-read this article up until here before continuing on.

## How to CalculateStock Returns with Dividends

Lets step it up now, and consider an example with dividends.

Imagine you buy 67 shares of Apple Incorporated at $149.04; you earn dividends of 63 cents per share for 4 quarters and then sell your shares for$191.03 each.

What is your profit and what is your return?

Before we crunch the numbers, theres a fair bit of information here. So lets just de-clutter make sure we understand what were working with.

We have the number of shares, which is not really relevant to calculate the return. But it is relevant to calculate the total profit (capital gains or capital appreciation) for instance.

Thats because your total profit is impacted by the number of shares that you own as well as the difference in the purchase price and selling price.

Then we have the purchase price which is $149.04. And then we have information about dividends. ### What are Dividends? Now, in case youre not familiar with what dividends, theyre just a share of the profit that investors can get. When you buy shares in a company, you technically own part of that company. And that entitles you to earn this dividend, which is just a part of the profit that the company can pay out for you to keep. This is just one of the rewards that you get for owning shares. So in this example, youre going to earn a dividend of 63 cents for every share that you own. And remember, you own 67 shares. So youre going to get 67 times sixty-three cents as your total dividends. And youre earning this dividend every quarter, for four quarters. So youre earning sixty-three cents four times in a year. And then were saying that you sell your shares for$191.03. So thats your selling price.

Lets see how we can split the profit.

The profit now would be the selling price plus the dividends (because this is the total amount of money that youre earning), and then you would subtract the purchase price (which is how much it costs you).

Using annotations again can make life easier. So the profit can be expressed as:

Strictly speaking, the notations should be more clear.

The notation

implies that you get all of the dividends at time

. In a sense, it suggests that this is an annual dividend.

But in reality, thats not true. Because youre getting dividends every quarter.

And so really, you would want to have:

But that just makes it unnecessarily complicated. And so to simplify things, and make life easier, weve just called it

.

Plugging in our numbers then:

Note that the dividends are 63 cents per share for four quarters. Multiplying $0.63 by 4 gives us the total dividends for 1 share for 1 year. ## Like our content? ### Get access to our exclusive Newsletter and learn about: • Latest Articles by Fervent • Finance and Investing Courses • Investing Resources and TipsNotice: JavaScript is required for this content. Solve for that, and youll find that the profit is$44.51. Thats for 1 share though. If you want the total profit, youll want to incorporate the fact that you own 67 shares.

The total profit is therefore:

Lets now look at how to calculate stock returns when were dealing with dividends.

Its actually quite straightforward. We just change the equation for return a little bit and include this dividend aspect. Our modified return formula looks like this:

Plugging in our numbers into the return calculation looks like so:

Again, as before, if you were to split this into three parts like so:

Or even two parts, like so:

This then simplifies to this:

Note that

.

And the 1 represents

.

And finally, when you solve for this youll find that the return on Apple is 29.86%.

Great! You now know how to calculate stock returns both with and without dividends. How about we take things up a notch now?

## Generalized Return of a Stock with Dividends

Lets just quickly look at how this equation works (using only notations this time).

The return of a dividend-paying stock is:

This can be rewritten as:

Which can then be simplified to:

Now that this is hopefully clear, we can come up with a general equation for the return of a stock

:

Importantly, if you know this equation, then you dont really need to know the previous equation that we looked.

Thats because we can just modify this new equation that we know and well end up with a previous one anyway.

Say for instance youre trying to calculate the return for a stock that doesnt pay any dividends.

Well, then the

will just be equal to zero.

And so the equation simplifies to:

Just a quick note. We know its tempting to call the dividends

, but we would strongly encourage you to write it out as

and not

.

Thats because we (as in people in Finance) tend to use

to refer to debt.

And as you progress on in your journey to mastering finance, youll end up using the

notation a lot more frequently (and youll use it to refer to the debt of a company).

To make your life easier then, and to avoid any confusion, we would strongly recommend that you work with

as your own notation for dividends, instead of

.

### Total Return vs. Dividend Yield

Now that you know how to calculate stock returns with dividends, we can think about total return vs. dividend yield.

Essentially, total return is made up of the dividend yieldand capital gains (aka capital appreciation).

You already know how to calculate total return because we literally just applied it using this formula:

Earlier on, we defined this as thereturn of a dividend-paying stock.

Now, note that this formula can be rewritten as:

Alternatively, we could also write it out like this:

If we write it out this way, then we can literally see the formula for stock returns broken up into:

• capital gains (the first part of the formula), and
• dividend yield (the second part of the formula)

For clarity, we can explicitly say that the Dividend Yield (DY) is

And the capital gains (or capital appreciation), dubbed CG is equal to

Seeing it this way, we can say that

Total Return = CG + DY

Or write the formula for total return mathematically as

All right so hopefully this makes sense. If any part of this article is not clear so far, please read it again before moving on any further.

## How to Calculate Stock Returns on Excel®

Alright. Now that you know how to calculate stock returns manually, lets look at how we can implement this on Excel®, using some real-world data.

### Accessing Financial Data

Getting access to financial data can be an expensive affair. But thankfully, we have free alternatives as well.

If you pop into Yahoo! Finance, lets say were looking at Facebook. You just put in the ticker over here.

We want to get some data, so you can go into historical data right here and then set the time period.

Were just going to go with the 1st of January 2012. Importantly, Facebook was not listed as a public company on the 1st of January 2012. They were listed later on in 2012, but it doesnt matter because Yahoo! Finance will pull the data from the first day of trading.

So we dont need to know the exact date and when they started trading. Im just going to arbitrarily set the last date of data as the 31st of December 2017.

You can choose any other time frame that you like. But if you want to work with us in this then maybe work with the same dates just to make life easier.

Go ahead and click done then and then make sure to hit Apply.

And then you want to download your data which will come out as a CSV file.

### Extracting Relevant Data

Heres the data that were looking at. Theres quite a lot of things going on here but lets just see what the information is.

Weve got the Date, which is the date of trading.

Then weve got Open, which is the price at which the stock opened.

Next, weve got High, which is the high point of the day  so thats the highest price at which the stock traded at on the day.

Low is the lowest point of the stock  so its the lowest price at which the stock traded at on the day.

Close is what the stock closed at.

And Adjusted Close (aka Adjusted Closing Price) is pretty much the same as Close, except that it will also adjust for dividends.

When companies pay out dividends, the stock price actually decreases. And so the Adjusted Closing Price will factor in that change in price as a result of the dividends.

It will also incorporate effects for things like stock splits, and stock bonuses, for example.

Volume is just the number of trades that took place on the day.

For the purpose of what were trying to do here  to calculate stock returns  we dont actually need all of this information.

We only really need the Date and Adjusted Close columns so were going to keep just those 2. And rename Adjusted Close to Price (see below).

### Calculating Stock Returns on Excel

Now we can calculate returns, daily.

Recall that return is:

In this case,

is the price on the 21st of May 2012. And

is the price on the 18th of May 2012. Apply the formula on Excel® like this:

We can see that the return there is -10.99\% or approximately -11 percent (see pic below).

And then you want to do exactly the same thing for all of these prices.

All you need to do is double click the corner of the cell (where you see the little green square in the bottom right corner of cell C3) and Excel® will magically calculate all of your daily returns.

And thats pretty much it!

Okay, lets now consider how to calculate stock returns on Python.

## How to Calculate Stock Returns on Python

Calculating stock returns on Python is actually incredibly straightforward.

You could either:

• calculate stock returns manually, by using the .shift() method to stack the stock price data so that

and

share the same index, or

• by using the .pct_change() method thats built into Pandas

We showcase both methods in great detail in our popular video on Calculating Stock Returns on Python (Code-along), viewable here:

Video playback issues? Watch it here instead.

Here are the timestamps for the video:

• 00:00  Introduction
• 00:18  Return of a stock formula
• 01:45  Importing package dependencies
• 02:42  Importing the data (reading a csv)
• 04:19  Exploring & filtering the data
• 05:35  Cleaning the data
• 06:50  Calculating Stock Returns on Python
• 13:00  Exploring Stock Prices & Stock Returns
• 16:14  Returns vs. Expected Returns
• 16:55  Approaches for Estimating Expected Returns
• 17:28  Summary

Importantly, while the video doesnt explicitly say so, you want to make sure that there are no missing observations when you apply the pct_change() method.

If you have missing observations in your daily stock price data, use .pct_change(1, fill_method=None) to calculate stock returns on Python.

Incidentally, this video is part of our course on Investment Analysis & Portfolio Management (with Python)so do check that out if youre interested in learning how to leverage the power of Python for investment analysis.

## Wrapping Up

You now know how to calculate stock returns. Actually, you know more than that including:

• The different ways of expressing the stock return formula, both with and without dividends.
• How to calculate stock returns manually.
• Accessing data for free from Yahoo! Finance
• Extracting relevant data for to calculate stock returns with real-world data.
• Using Excel® to make your life easier by quickly calculating stock returns for daily returns in one go
• Using Python to make your life even easier by calculating stock returns with a single line of code!

Next Steps

Now that you know how to calculate stock returns, why not take the next step and explore the other side of the coin?

Were talking about the risk of a stock of course! Learn how to measure the risk of a stock in our sister article (hint: its the standard deviation of a stock!).

We also recommend reading:

• How to Calculate Portfolio Returns
• How to Calculate Portfolio Risk

Better yet, if youre genuinely serious about taking your investment analysis skills to the next level, check out the course below.

Do you want to leverage the power of Excel® and learn how to rigorously analyse investments and manage portfolios?

Explore the Course