Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following is the source code of a Python function that downloads the monthly returns on selected securities. The function requires the quantstats package, which

The following is the source code of a Python function that downloads the monthly returns on selected securities. The function requires the quantstats package, which is not installed on Google Colab. Install the quantstats package before creating the function. def MONTHLY(ASSETS , BEGIN , END): from yfinance import download DATA = download(tickers=ASSETS , start=BEGIN , end=END) ADJUSTED = DATA["Adj Close"] DAILY = ADJUSTED.pct_change() import quantstats as qs MONTHLY = qs.utils.aggregate_returns(returns=DAILY , period="M") from pandas import date_range MONTHLY.index = date_range(start=BEGIN , end=END , freq="M") return MONTHLY The function name isMONTHLYand it includes the following arguments: ASSETS: The symbols of the selected securities on Yahoo Finance, BEGIN : The beginning date of the historic data (inclusive), END : The end date of the historic data (exclusive).

Copy the code into Google Colab and run it. This will create the function in your notebook. Then apply theMONTHLYfunction to download the monthly returns on the following securities between Sep 1, 2018 (inclusive) and Sep 1, 2023 (exclusive):

  • Ethereum(ETH-USD),
  • Dogecoin (DOGE-USD),
  • TeslaInc. (TSLA),
  • Bitcoin (BTC-USD),
  • Starbucks Corporation (SBUX),
  • SPDR Gold Shares (GLD).

Use the historic data and find the optimum portfolio that maximizes the Sharpe Ratio such that:

  • The maximum allowable weight for each individual asset is 40%,
  • The minimum weight of Dogecoin (DOGE-USD) is 5%,
  • The minimum weight of Bitcoin (BTC-USD) is 10%.

Assume that the monthly risk-free rate is 0.2%. Allow short-selling in the optimum portfolio. Set the maximum sum of positive weights to 150% in the optimum solution. Suppose you will invest $6,000 in the optimum portfolio. How much will you invest in Ethereum (ETH-USD)? Round your answer to the nearest integer. Remember that if you loan the asset, the investment amount must be negative. If you own the asset, the investment amount must be positive.

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

More Books

Students also viewed these Finance questions

Question

1. How might volunteering help the employer and the employee?

Answered: 1 week ago