Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 9 . The Python function Sharpe _ Ratio uses a helper function data _ func to calculate the a , b , R a

Exercise 9. The Python function Sharpe_Ratio uses a "helper" function data_func to calculate the a,b,Ra,Rb and from a data set of 20 stocks. This data is then used by the sharpe_Ratio function to calculate x and y(x-optimal and y-optimal) and return the optimal Sharpe Ratio s_max. Finish Sharpe_Ratio by filling in the missing line of code below. Hint: How did you find the amount to invest in stock B in the previous exercise?
[] from math import sqrt
def Sharpe_Ratio (stock_A_ticker, stock_B_ticker, R_f) :
(a,b,s,t,p)= data_func (stock_A_ticker, stock_B_ticker)
r=R-f
y_optimal = # Finish this line.
S_max =a**xoptimal+b**yoptimal-rs****2**xoptimal*****2+t****2**yoptimal*****2+p**s**t**xoptimal**yoptimal2
print(f"The maximum possible Sharpe Ratio for these two stocks is (round(S_max, 4)}. The unrounded Sharpe Ratio is")
return S-max
image text in transcribed

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

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

CFD is highly risky. Do you agree? Give reasons for your answer.

Answered: 1 week ago

Question

Different types of Grading?

Answered: 1 week ago

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago