Method to calculate the daily returns of financial assets df pct change is the right procedure to calculate any financial assets

0 votes

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.

Apr 23, 2021 in Python by Tatsuru

edited 4 days ago 8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP