TransWikia.com

ROI and stock rates

Economics Asked by wollud1969 on March 22, 2021

I’m an engineer with minimal to zero knowledge about economical topics, please be patient with me if the following question makes no sense or is too basic …

Currently I’m working through the “Python Data Science Handbook” of Jake van der Plas. In the chapter about time series data there are several examples with financial numbers, in particular stock rates.

In one example he calculates the ROI out of a series of stock rates:

from pandas_datareader import data

# data_source google won't work anymore, use yahoo
goog = data.DataReader('GOOG', start='2004', end='2016',
                       data_source='google')
goog = goog.asfreq('D', method='pad')
ROI = 100 * (goog.tshift(-365) / goog - 1)
ROI.plot()
plt.ylabel('% Return on Investment');

So, he divides data from one year ago with the current data, plus 1, times 100 (to get it into percent values).

For my understanding, the central formular is (with $f_0$ for the data from one year ago and $f_1$ for the current data):

$frac{f_0}{f_1} – 1 equiv frac{f_0}{f_1} – frac{f_1}{f_1} equiv frac{f_0 – f_1}{f_1} $

What I found when googling for ROI are especically the definitions from Wikipedia:

return on investment = Net income / Investment

or

return on investment = (gain from investment – cost of investment) / cost of investment

or

return on investment = (revenue − cost of goods sold) / cost of goods sold

Although the latter both definitions come quite close to the formular above, I’m unable to see the relationship between stock rates used in the data of the code example and the words used in the definitons from Wikipedia.

Can anyone help me to understand this a bit better, with a brief explanation or a hint where to continue reading on this topic?

Thanks and cheers
Wolfgang

3 Answers

I agree with Dan it is likely a typo.


Some definitions (using your notations)

Investment : $f_0$

Investment one year later : $f_1$

Net income : $f_1 - f_0$

ROI: $-1 + frac{f_1}{f_0}$

It follows that the correct code should be

ROI = (goog/goog.tshift(-365) -1)*100

Answered by keepAlive on March 22, 2021

To understand the return formula, think of it this way: ROI is the effect/effort - 1. If you invest 100 dollars today, which is your effort, and one year later you have 105 dollars (effect), you get a 5% payoff.

Answered by AlexB on March 22, 2021

This article discusses ROI:

https://www.investopedia.com/articles/basics/10/guide-to-calculating-roi.asp

This article covers adjustments to stock price and volume data:

https://blog.quandl.com/guide-to-stock-price-calculation

Some observations about efforts to maximize ROI from stock investing:

  1. When one enters a market position, such as in the stock market, this is a random experiment where the investment tends to produce a percent gain or loss over time.

  2. The invested capital may be taking a loss in the position while some other position in a different stock is typically making a large gain at the same time. Or the position is making a small gain while a large gain is made in an alternative position.

  3. If one makes a loss of -50% on the position then one must make a gain of 100%, either in the same position or a different position, just to break even. The total cost of entrance to the position, price paid plus commissions, is the denominator in the calculations.

  4. Surfing price waves is an effort to cut losses short when one gets into a random experiment that produces a loss and to let winners run when one gets into a random experiment that produces large gains.

  5. Those who hold to the efficient market hypothesis or random walk theory argue that one cannot anticipate the random price movements of the stock market so it is best to invest in an index of stocks.

  6. Some stock pickers seem to be able to beat the market but other sources say perhaps 80% or more of active money managers do not beat the S&P 500 index for significant periods of time.

Answered by SystemTheory on March 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP