<jupyter_start><jupyter_text>Load in Data<jupyter_code>tickers = ['AAPL', 'MSFT', 'CVX', 'GE', 'GOOGL']

stock_data = utils.get_data(tickers, '1d', '2015-01-01', '2021-01-01')<jupyter_output>[*********************100%***********************]  1 of 1 completed
AAPL data downloaded...
[*********************100%***********************]  1 of 1 completed
MSFT data downloaded...
[*********************100%***********************]  1 of 1 completed
CVX data downloaded...
[*********************100%***********************]  1 of 1 completed
GE data downloaded...
[*********************100%***********************]  1 of 1 completed
GOOGL data downloaded...<jupyter_text>Get Expected Returns<jupyter_code>stock_returns = invs.stock_invariants(stock_data)
stock_returns.head()
exp_returns = stock_returns.mean() * 252
exp_returns<jupyter_output><empty_output><jupyter_text>Get Covariance Matrix<jupyter_code>riskmodel = moments.RiskModel(tickers)

stock_cov = riskmodel.avg_hist_cov(stock_data)
stock_cov<jupyter_output><empty_output><jupyter_text>Solve Optimisation Problem<jupyter_code>optimiser = Optimiser(tickers, exp_returns, stock_cov)
weights = optimiser.mean_variance(threshold=0.1)
# weights = optimiser.max_sharpe()

# min_pos = lambda x: x >= 0.1*np.ones(len(tickers))
# optimiser.add_constraint(min_pos)

# weights = optimiser.solve(objective='max_sharpe')
weights
optimiser.weight_tearsheet(weights)<jupyter_output>Annual Return: 15.026
Annual Volatility: 23.203
Annual Sharpe: 0.561