I have a very simple question about Python in calculating some basics in finance. I would like to calculate the daily returns of financial assets. The financial assets could include stock prices, S&P500, and treasury bonds. From a mathematical or physical viewpoint, they have different units.
For example, stock price has the unit of US dollars, but S&P500 and treasury bonds are essentially the dimensionless quantities. I would like to calculate the daily returns of those financial assets using Python.
What I am thinking in my mind is to calculate the returns of all the assets using the same method
pct_change() in the Pandas module in Python. Namely, the procedure of my calculation is as follows.
Let df denote the DataFrame consist of all the assets, then daily returns of assets are calculated in the same way as
returns = df.pct_change()
My question is to know if this is indeed the right procedure or not.