## 3 Methodology
### Quantitative Models
#### 3.2.2 Portfolio Optimization  
The objective of portfolio optimization is to try to find the optimal asset allocation based on the stock price prediction phrase. Portfolio construction top-down investing was adapted to pick up the top-performing stock based on the prediction model to construct a multiple asset portfolio, as shown in Figure 4. On the basis of stock prediction results, the expected return and standard deviation for each stock are calculated. For each time period, the top predicted performance stocks with the highest predicted expected returns will be selected to construct a portfolio with initial weights, in which EQ is most commonly assigned. As the number of stocks and the correlated weights are determined, the portfolio cumulative return is calculated by (9). The optimal set is a set of current allocation weights for the selected stocks in the constructed portfolio. By adjusting the model parameters of the portfolio optimizers, we can figure out the optimal weights for the selected stocks in the constructed portfolio. Simulation and optimization techniques were used to seek the optimal weights for the constructed portfolio, instead of using the conventional EQ method. Simulation is a widely used technique for portfolio risk assessment and optimization. Portfolio exposure to different factors is often evaluated over multiple scenarios, and portfolio risk measures such as value-at-risk are estimated. Generating meaningful scenarios is an art as much as science, and presents a number of modeling and computational challenges. Monte Carlo simulation (MCS) is a valuable tool for evaluating functional relationships between variables, visualizing the effect of multiple correlated variables, and testing strategies. MCS solves a deterministic problem based on probabilistic analog by creating scenarios for output variables of interest. First, it generates random portfolio weights and calculates the corresponding portfolio measurements such as expected returns, volatility, and Sharpe ratio. The random weights are adjusted until reaching the highest Sharpe ratio value. All possible generated portfolio scenarios can be seen as a color map as the distribution of random weights in Figure 5a, where an efficient portfolio was found as a red dot sign with the highest Sharpe ratio value. The efficient frontier line is also presented in Figure 5b. Figure 4: Portfolio optimization model. \begin{tabular}{l} \hline \hline
**Algorithm 1**Pseudocode of the Monte Carlo Simulation \\ \hline
**Input** \\ -  Number of iteration: \(n\) \\ -  Number of assets for each portfolio: \(N\) \\ -  Initial weight array: \(W_{0}=\)[\(w_{1},\ldots,w_{N}\)] with \(\sum_{i=1}^{N}w_{i}=1\) and \(i=1,\ldots,N\) \\
**Output** \\ -  Maximum of Sharpe ratio \\ -  Optimal weight array \(W=\)[\(w_{1},\ldots,w_{N}\)] with \(\sum_{i=1}^{N}w_{i}=1\) \\
**for**\(i\)**in**range(\(n\)): \\ -  Initial random weights: \(W_{i}\) \\ -  Save the temporary weights: \(W_{i}\) \\ -  Calculate expected portfolio return _exp_ret[i]_ \\ -  Calculate expected volatility _exp_vol[i]_ \\ -  Calculate Sharpe ratio: _SR[i] = exp_ret[i]_exp_vol[i]_ \\
**end** \\ \hline \end{tabular} 
2. Optimization Modeling: Mean-variance Optimization (MVO)  
A portfolio constructed from \(N\) different assets can be described by means of the vector of weights \(w=(w_{1},w_{2},\ldots w_{N})\), with the constraint given \(\sum_{i=1}^{N}w_{i}=1\). The \(N\)-dimensional vector \(I=(1,1,\ldots,1)\) is denoted by \(I\). Therefore, the constraint can conveniently be written as \(w^{T}I=1\). Denote the random returns on the stocks by \(r_{1},\ \ldots,\ r_{N}\), and the vector of expected return by \(\mu=(\mu_{1},\mu_{2},\ \ldots,\ \mu_{N})\) with \(\mu_{i}=E(r_{i})\) for \(i=1,2,\ldots,\ N.\) The covariances between returns will be denoted by \(\sigma_{ij}=Cov\big{(}r_{i},r_{j}\big{)}\), in particular \(\sigma_{ii}=\sigma_{i}^{2}=\text{Var}(r_{i})\). These are the entries of the \(N\times N\) covariance matrix \(\mathbf{\Phi}\). \[\mathbf{\Phi}=\left[