Question: Problem 2 . (20 Points) Please perform the following tasks: Please write function that calculates the Sharpe ratios of assets, defined as annual geometric mean

Problem 2. (20 Points) Please perform the following tasks:

  1. Please write function that calculates the Sharpe ratios of assets, defined as annual geometric mean of excess returns divided by annual volatility of the excess returns. Excess returns are defined by asset returns subtracting the risk-free rates. The function should take two arguments: the returns of each of the assets and the risk-free rate (note if there are multiple columns of returns then multiple ratios should be calculated and assuming 252 trading days a year)
  2. Load the price data from the file named AssetPrice.xlsx into Python as a dataframe. Please note the first two columns of the data are daily price levels and the last column is the annual risk-free rate in unit of percentage (e.g., a 1.5 value stands for annual rate of 1.5%) and assumes 252 trading days a year. Calculate the daily returns of the assets as well as the daily risk-free rate first, then call the function you just written in step 1 and returns the Sharpe ratios of each of the assets. Write print statement to print out the Sharpe ratios of each of the assets. Note in the data file, one of the columns is for adjusted price of the ETF SPY and the other for the ETF AGG

Excel will be provided.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!