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