Artificial intelligent assistant

How to graph aggregate portfolio performance? Here is an example of a performance graph of a "motif" on Motif Investing. The motif is a portfolio containing Apple and Microsoft stocks weighted at 50% each. The graph represents the aggregate performance of the 2 stocks over time (the blue line). The green line is the S&P500. The y-axis is measured in percent. !enter image description here Given the historical stock prices how would you generate this graph (or something similar to it)?

To aggregate two stocks, you have to imagine a portfolio with them in some ratio. The natural thing is $\frac 12$ each by starting dollar value, so you bought the same dollar amount of each on day $1$ and held it throughout. Or maybe you rebalance at the end of each year-selling the one that has gained the most and buying the other so you start each year with the same dollar amount. Maybe you like Apple better than Microsoft, so your portfolio is $\frac 34$ Apple and $\frac 14$ Microsoft. The S & P 500 is essentially this with (about) 500 stocks in a ratio of market capitalization. To create the data, just make a column with the Apple and Microsoft prices each day, then evaluate the value of the portfolio under the rules you choose.

If it sounds like this is more about what you want to plot than how to do it, you are correct. That is the hard part. Whatever you plot, please state clearly what you are plotting.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 452a62506423e0deee3214a1e9a0e6c7