Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

8. Compare the grim trigger and tit-for-tat strategies.

Answered: 1 week ago