<jupyter_start><jupyter_text>Expected Portfolio Return:<jupyter_code>np.sum(weights * log_returns.mean()) * 250<jupyter_output><empty_output><jupyter_text>Expected Portfolio Variance:<jupyter_code>np.dot(weights.T, np.dot(log_returns.cov() * 250, weights))<jupyter_output><empty_output><jupyter_text>Expected Portfolio Volatility:<jupyter_code>np.sqrt(np.dot(weights.T,np.dot(log_returns.cov() * 250, weights)))<jupyter_output><empty_output><jupyter_text>***<jupyter_code>pfolio_returns = []
pfolio_volatilities = []

for x in range (1000):
    weights = np.random.random(num_assets)
    weights /= np.sum(weights)
    pfolio_returns.append(np.sum(weights * log_returns.mean()) * 250)
    pfolio_volatilities.append(np.sqrt(np.dot(weights.T,np.dot(log_returns.cov() * 250, weights))))

pfolio_returns, pfolio_volatilities
pfolio_returns = []
pfolio_volatilities = []

for x in range (1000):
    weights = np.random.random(num_assets)
    weights /= np.sum(weights)
    pfolio_returns.append(np.sum(weights * log_returns.mean()) * 250)
    pfolio_volatilities.append(np.sqrt(np.dot(weights.T,np.dot(log_returns.cov() * 250, weights))))
    
pfolio_returns = np.array(pfolio_returns)
pfolio_volatilities = np.array(pfolio_volatilities)

pfolio_returns, pfolio_volatilities<jupyter_output><empty_output>