MC1-Project-2
Overview
In this project you will use what you learned about optimizers to optimize a portfolio. That means that you will find how much of a portfolio's funds should be allocated to each stock so as to optimize it's performance. In this case we define "optimal" as maximum Sharpe ratio.
You will leverage the function you created in the last project that assessed the value of a portfolio with a given set of allocations.
Task
Write a Python function named optimize_portfolio() that can find the optimal allocations to a four stock portfolio. You should optimize for Sharpe ratio.
Inputs to the function include:
- Start date
- End date
- Symbols for for equities (e.g., GOOG, AAPL, GLD, XOM)
The function should return:
- A list of floats that represents the allocations to each of the equities.
An example of how the function would be called:
allocations = optimize_portfolio(startdate, enddate, ['GOOG','AAPL','GLD','XOM'])
Also, create a chart that illustrates the value of your portfolio over the year and compares it to SPY. The portfolio and SPY should be normalized to 1.0 at the beginning of the period.
todo: include example chart here
Suggestions
None yet.
Make sure your optimize_portfolio() function gives correct output. Check it against the examples below.
Example output
Here's an example output for your function. These are actual correct examples that you can use to check your work.
todo:example 1
todo:example 2
Minor differences in float values may arise due to different implementations.
What to turn in
Via t-square turn in attachments only:
- Your code as submission.py
- Your chart as chart.pdf