Research on optimal portfolios based on optimization and Simulated Annealing Algorithm A comparison of optimal portfolios between the Chinese and American stock market

. This paper is aimed to show the correctness of our model, which combines optimization and the Simulated Annealing Algorithm and uses it to compare the American stock market with the Chinese stock market. Furthermore, we want to use this model to construct an optimal portfolio and expect to determine if it is general. We select nine stocks for both American and Chinese stock markets and use them to construct optimal portfolios. The study results show that the optimal portfolio based on the Sharpe ratio is optimal for these stock markets. Furthermore, this research study finds a strong correlation and significant differences between these stock markets.


Introduction
In recent years, the research on selecting the best portfolio based on Genetic algorithms and deep rankness has been an important research field. It is widely believed that rational investors should diversify their investments. According to Wagner and Lau (2018), investors can reduce risk without sacrificing expected returns by diversifying their portfolios. Moreover, the rate of return on welldiversified low-risk portfolios is significantly lower than the return on well-diversified higher-risk portfolios [1]. Thus, in this paper, we choose a portfolio with diversification to offset the riskiness of individual securities so that portfolios consisting of large numbers of higher-risk securities may be less risky than portfolios consisting of small numbers of low-risk securities. Financial knowledge plays an essential role in this process.
Also, to select the best portfolio, we should decide on a standard to optimize. According to Liu (2007), in the context of dynamic portfolio choice, the investment opportunity set is described by four characteristics of the asset return dynamics: the expected return, the maximum Sharpe ratio, the hedging covariance vector and variance, and the covariance matrix of the state variables that is not spanned by the covariance of the assets [2]. This paper chooses the return, variance, and Sharpe ratio for standards to determine the best portfolio for the Chinese and American stock markets within nine fixed assets.
Many researchers have already put forward their own opinions on these questions. According to Zakamouline and Koekebakke (2009), different algorithm systems and models may lead to different results for the best portfolio [3]. As Christie (2005) stated, estimators of the Sharpe ratio have less helpful distributions than estimators of mean and variance [4]. The error in the estimate of the Sharpe ratio can be too large to make valuable conclusions. However, both Brauneis and Mestel's (2019) study and Zakamouline and Koekebakke's (2009) model show the better performance of the Sharpe ratio in portfolio choosing [3,5]. Especially, Brauneis and Mestel had emphasized that in terms of the Sharpe ratio and certainty equivalent returns, the 1/N-portfolio outperforms single cryptocurrencies and more than 75% of mean-variance optimal portfolios. Thus, our goal is to determine whether the Sharpe ratio is the optimal choice based on the optimization algorithm assisted with the simulated annealing algorithm.
Furthermore, according to Liu (2018), With the development of China's economy and the opening of the stock market system, the stock market linkage between China and the United States has increased gradually [6]. However, they still have differences. For example, according to Yue et al.
(2020), information transfer between Stock Market Sectors is quite different between the two countries [7]. Furthermore, based on Ji, Zhang, and Guo's (2008) research, Canadians were more willing to sell and less willing to buy falling stock compared to the Chinese. Nevertheless, when the stock price rose, the opposite occurred: Canadians were more willing to buy and less willing to sell [8]. It is still unknown whether these differences will let the same standards determine the Chinese and American stock market best portfolios or not.
Last but not least, As Gao, Ren, and Umar (2021) discovered, COVID-19 is the main reason for the sharp fluctuation of the U.S. stock market and Chinese stock market. However, the strong growth of daily new cases, which continued for months, has made the U.S. stock market insensitive to COVID-19 compared with China [9]. In addition, the particularly loose interest rate policy has effectively suppressed the volatility of the U.S. stock market. In contrast to China, the near-zero interest rate applied by the U.S. makes it difficult to generate sufficient monetary policy space to address a new potential crisis. However, how the best portfolio choices would be selected is also a yield that must be explored. Thus, this paper hopes to fill this gap by maximizing the portfolio's Shape ratio and showing whether Gao, Ren, and Umar's conclusion is still right until 2022.
In conclusion, based on research results, this article is dedicated to determining whether the Chinese or American stock market is suitable for this algorithm system by comparing these portfolios with preceding individual assets. Moreover, this article wants to show the difference in the degree of optimization before and after the outbreak of COVID-19. Generally, this paper mainly focuses on and study from portfolio construction, optimization degree analysis, and the cause and effect of differences and similarities in American and Chinese stock markets four aspects.

Methods
First, we take every stock as an asset to find each stock's optimal portfolio. We use the optimization algorithm, assisted with simulated annealing algorithms, to achieve the goal.
All the notations used in this algorithm system are always the same, where cj is the coefficient of every asset in the portfolio, and xij means return in i th asset and i th day. Additionally, every asset is sorted alphabetically. Moreover, the optimization equation for optimal portfolio based on mean, variance, and Sharpe ratio are shown as formulas (1), (2), and (3): Moreover, we use Python to solve these optimization problems supported by simulated annealing algorithms.
Considering that the last two optimization problems are neither linear nor convex, we will apply a simulated annealing algorithm (S.A.) to find approximately optimal solutions for them. One of the most significant features of the data field is that it has many locally optimal solutions with similar optimal values. Therefore, traditional optimization algorithms will easily be trapped in locally optimal solutions. However, S.A. updates the solution in a specific random way at the beginning and finally locks onto optimal global solutions with significant probability. In this case, S.A. is a practical choice to seek optimal solutions among the influences of locally optimal solutions. Considering the instability of S.A., we apply the S.A. module thirty times to each problem. After calculating them, we can attain portfolios with the highest return, minimum variance, and most significant Sharpe ratio. Secondly, comparing these optimal solutions with every individual asset by histograms and line charts. These graphs can visually determine the association. Last but not least, compare the Chinese stock market's optimal portfolios with American's. Histograms, line charts, and pie charts will also be used to examine their differences.

Data collection
We select the American stock market's average weekly closing price from the Wind database and the Chinese stock market's average weekly closing price from the CSMAR database. For both American and Chinese stock markets' closing prices, we take (this week's closing price -last week's closing price) / last week's closing price to be the rate of return. We select "APPLE", "WALMART", "COCA-COLA", "WELLS FARGO", "UNITED AIRLINES", "TESLA", "PFIZER", "XCEL ENERGY" and "BOSTON PROPERTIES" to be the sample for analysis American stock market. As for Chinese stock market, we choose stock code number "600027", "600028", "600031", "600048", "600088", "600598", "600763" and "601668" to be the Chinese stock market's sample. Data from 2009/9/30 to 2019/9/30 for both American and Chinese stock markets are used to be analyzed, and data from 2019/3/29 to 2022/3/31 is used to be compared with each other. Moreover, since we consider the risk-free asset a constant asset 0, thus we do not need to check its distribution and independence, and it would not influence the result of the Sharpe ratio. Figure 1 shows the American assets' distribution compared with the normal distribution, which has the same mean and variance with these assets. Moreover, Figure 2 shows their independence.    , almost every asset's distribution is close to a normal distribution with the same mean and variance. Furthermore, from Figure2 and Figure4, when lag is equal to 0, the correlation is bound to be 1. However, other correlations are mainly within the blue lines, which means a low degree. In other words, every asset is mutually independent. Above all, the selected assets are independent and identically distributed. The quality of i.i.d. (independent and identically distributed) satisfies the data's representatives, making our simulation and portfolios reliable, general and persistent.

Results
Python is used to construct a model and find optimal solutions in this paper. R is used to draw Figures and confirm our solution. Moreover, we use Excel and SPSS to execute the data collected from databases. Moreover, pie charts, histograms, and line charts will be used to examine data and visually determine the association.

The optimal portfolio solution in the American stock market
The mean, variance, and Sharpe ratio of every asset are shown in Table 1:

The optimal portfolios based on mean
By the optimization algorithm shown in formula (1), we get the optimal solution shown in Figure  5 and get the maximum return of 0.042207.

Figure 5
Coefficients of every asset (stock) for optimal solution based on return (USA) We took the optimization degree of mean as (optimal valueoriginal mean) / optimal value, then we can form a table of optimization levels. Since optimal value is the largest return and some returns may be negative, we can form an optimization table of degrees as shown in Table 2: It is evident that the optimal return is larger than any other individual return, and we determined the degree of optimization based on the return is 0.8841807.

The optimal portfolios based on variance
By the optimization algorithm shown in formula (2), we get the optimal solution shown in Figure  7 and get the minimum of 0.0028592.

Figure 6
Coefficients of every asset (stock) for optimal solution based on variance (USA) We took the optimization degree of mean as (original varianceoptimal value) / original variance. Then we can form a table of optimization levels. Since the optimal value is the minimum variance that should be smaller than any other assets, we should take the same scale as in 3.1.1, making it easier to be compared. We can form an optimization table of degrees as shown in Table 3: It is evident that the optimal variance is much lower than any other individual variance, and we determined the degree of optimization based on return is 0.9225635.

The optimal portfolios based on the Sharpe ratio
By the optimization algorithm shown in formula (3), we get the optimal solution shown in Figure  7 and get the maximum Sharpe ratio of 1.70375. We took the optimization degree of mean as (optimal valueoriginal Sharpe ratio) / optimal value. Then we can form a table of optimization levels. Since the optimal value is the minimum variance that should be smaller than any other assets, we should take the same scale as in 3.1.1, making it easy to be compared. It is evident that the optimal return is larger than any other individual Sharpe ratio, and we determined the degree of optimization based on the return is 0.931124. After comparing, we can conclude that optimizing the portfolios based on the Shape ratio has the largest degree of optimization in our model. Thus, the optimal solution limited by the maximum Shape ratio is our optimal solution for the American stock market, shown in Table 4.

The optimal portfolio solution in the Chinese stock market
We use the same methods and algorithms used in American portfolio analysis. The mean, variance, and Sharpe ratio of every asset are shown in table 5:

The optimal portfolios based on mean
We use the same optimization equation in formula (1), and the solution we did by our algorithm system is shown in Figure 8 with the maximum return of 0.040956:

Figure 8
Coefficients of every asset (stock) for optimal solution based on return (Chinese) Using the same method to determine to optimize degree in 3.1.1. We can form an optimization table of degrees as shown in Table 6: The optimal return is larger than any other individual return, and we determined the degree of optimization based on the return is 0.95772.

The optimal portfolios based on variance
We use the same optimization equation in 3.1.2, and the solution we did by our algorithm system is shown in Figure 9 with a minimum variance of 0.0006885:

Figure 9
Coefficients of every asset (stock) for optimal solution based on variance (Chinese) Using the same method to determine to optimize degree in 3.1.2, we can form an optimization table of degrees as shown in Table 7: It is evident that the optimal variance is much lower than any other individual variance, and we determined the degree of optimization based on return is 0.965565.

The optimal portfolios based on the Sharpe ratio
We use the same optimization equation in 3.1.3, and the solution we did by our algorithm system is shown in Figure 10 with the maximum Sharpe ratio of 1.24037:

Figure 10
Coefficients of every asset (stock) for optimal solution based on the Sharpe ratio (Chinese) Using the same method to determine to optimize degree in 3.1.3, we can form an optimization table of degrees as shown in Table 8: It is evident that the optimal return is larger than any other individual return, and we determined the degree of optimization based on the return is 0.9725114.
After comparing, we can conclude that optimizing the portfolio's Shape ratio has the largest degree of optimization in our model. Thus the optimal solution limited by the maximum Shape ratio is our optimal solution for the Chinese stock market, shown in Figure 10.

Portfolios compared the American stock market with the Chinese stock market in 2016-2019 and 2019-2020
Since portfolios limited by the maximum Sharpe ratio are the optimal solution for the Chinese stock market and the American stock market, we use it as a standard to examine what changes have been brought to the American and Chinese stock markets before and after the outbreak of COVID-19.

Changes in the American stock market
With the same methods used in 3.1.3, we get the optimal portfolios based on the Sharpe ratio from 2016 to 2019 and 2019 to 2022 in American stocks. Figure 11 and Figure 12 show how they are distributed. To be more visually, assume we have an original asset of 100 dollars and put this asset into our models of optimal solutions. We make two optimal portfolios' time series and put them together as shown in Figure 13: The comparison of two optimal portfolios (USA) The stock price stopped increasing at high speed during 2019. However, this optimal solution will increase with an even faster speed from 2020 and have a much higher asset than 2016-2019.

Changes in the Chinese stock market
With the same method in 3.2.3, we get the optimal portfolios based on the Sharpe ratio from 2016 to 2019 and 2019 to 2022 in Chinese stocks. Figure 14 and Figure   To be more visually, we make two optimal portfolios' time series and put them together as shown in Figure 16: The stock price severely influenced the Chinese stock market and had the most extended period of decreasing around 2019. Furthermore, the stock price in the Chinese was continuing to descend, and only after 2020 did the stock price begin to increase at a low speed.

Comparison between American stock market and Chinese stock market
We consider American and Chinese returns of 2016-2019 and 2019-2022 as two individual assets, and we have two portfolios with coefficients shown in Figure 17 and Figure 18: These two optimal solutions have the same trends, and the increased speed of the Chinese portfolio is much faster than the American portfolio. Both stopped increasing from 2019 to 2020, but the Chinese portfolio decreased faster than the American portfolio.

Sharpe ratio is always the optimal solution
In both the American and Chinese stock markets, the portfolios limited by the maximum Sharpe ratios always have the largest degree of optimization. The Sharpe ratio is always the optimal solution based on our algorithm system. It also confirms the correctness of Zakamouline and Koekebakke's (2009) model and Brauneis and Mestel's theorem. Moreover, supported by simulated annealing algorithms, our model can even reach the optimized degree of 97% [3].
The Similar result of optimized degree shows the strong connection between the American stock market and the Chinese stock market. Policies, fluctuations, globalization, and natural catastrophe can all be the factors that may influence the correlation among stock markets all over the world. For example, according to Li and Peng (2017), "a larger rise or a larger fall in U.S. policy uncertainty would both reduce the magnitude of subsequent co-movements between the Chinese and American stock markets" [10], in other words, changes in American stock market may affect mainly the influence the sales of it, whereby leading to changes in the co-movements of the Chinese stock markets. Moreover, according to Huang et al. (2018), the Chinese stock market and the American stock market have a strong correlation that price changes in the American stock market can predict subsequent day price changes in the Chinese stock market [11]. The similar tendency of optimal portfolios in 2019-2022 also confirms the existence of prediction and strong correlation. Although there may be some errors and fluctuation in the time series, both lines show high-speed development before 2019 and the same speed with increasing from 2019 to 2022. These reasons all show the correlation between these two stock markets and explain why the Sharpe ratio model can be the optimal solution.

The American stock market is different from the Chinese stock market
Although these two stock markets have strong connections, however, they are pretty different from each other. The American stock market is much more mature than the Chinese stock market, but the Chinese stock market is steadier than the American stock market. From the optimization degrees table, the optimized degree of Shape ratio for the American stock market is much larger than for return and variance, which is the result of mature and high-level development. The differences in the line chart and the situation of diversification show other information transfers between America and China, which Yue et al. (2020) can explain: the most active sector in information exchange is the non-bank financial sector in the Chinese and the technology sector in the America market [7]. For example, the real estate sector is an information receiver in the Chinese market but a source in the American market. Thus, the U.S. stock market is expected to react to demand related to news originating from the housing sector, such as building approvals. In contrast, this is not the case in China since the markets are driven by supply-side factors such as changes in bank lending. This factor leads to huge differences between the American and Chinese stock markets, influencing optimal portfolio choices for these two stock markets.

The influence of COVID-19 is more severe in Chinese from 2019 to 2020 but less severe from 2020 to 2022
These two portfolios have a low speed of increasing that is nearly close to 0. However, the portfolio of Chinese stocks' decreasing degree is larger than American stocks from 2019 to 2022, which shows the influence of COVID-19 is more severe in the optimal Chinese portfolio. Although Chinese stock prices had more severe damage from 2019 to 2020, they recovered quickly and even increased faster than American stock prices. Though some differences exist between our conclusion and the conclusion from Gao et al., their reasons can also explain our model's results [9]. Our results confirm that the strong growth of daily new cases, which continued for months, has made the U.S. stock market insensitive to COVID-19, as shown in Figure 17. According to Gao et al., the impact of COVID-19 on the stock market showed a significant leverage effect in both the U.S. and China. When the stock market volatility was high, COVID-19 imposed a more substantial effect on the stock market volatility [9]. It can also prove that the American stock market is much more mature than the Chinese stock market, with a minor fluctuation.
Furthermore, the lower impact on the American stock market during the epic of COVID-19 can also be explained by the American stock market becoming insensitive to the impact of 30000-40000 new cases per day. On the contrary, China remained highly sensitive to relatively small daily increases in new cases; however, the robust epidemic control did not cause abnormal volatility in the stock market. However, with the better and better command of COVID-19 from the Chinese government, the Chinese stock market's portfolio stock prices perform better-recovering than American from 2020 to 2022. According to Liu et al. (2020), the negative influence on the mainland Chinese market does not last for long. This demonstrates the quick recovery of the mainland Chinese market from the pandemic after the confirmed cases decreased [12]. It can also confirm the correctness of our model's correctness.

Conclussion
The present article has explored how to find an optimal portfolio solution for the American stock market and Chinese stock market. Most of the studies believed that the optimal portfolio solutions based on the Sharpe ratio would be the best choice of selections to find an optimal portfolio. This study hopes to use an algorithm model that combines optimization and the Simulated Annealing Algorithm to find optimal portfolio solutions for American and Chinese stock markets. Based on the findings, we can conclude that an optimal portfolio based on the Sharpe ratio is the best solution with our models. Furthermore, although the optimal portfolios show huge correlation and similarities between American and Chinese stock markets, they still have significant differences. 1. American stock market is much more mature than the Chinese stock market. However, the Chinese stock market can recover and activity better. 2. COVID-19 has a slighter impact on the American stock market since its insensitive attitudes toward COVID-19. However, the Chinese stock market shows a strong capability of recovering and exceeding depending on the epic of COVID-19. This research can also help further studies to find optimal portfolios based on these selections. As with all studies, our work has several limitations. One of them is that we only studied nine individual assets but not all assets from both stock markets, we only selected the most significant stocks, and the conclusion may not be too general. Another limitation is that we did not study the demographic variables such as age, gender, education level, experience in the stock market, type of investor, etc. Due to a lack of data to analyze our model. Further studies could consider much more stocks and add more demographic variables to prove the correctness of our optimization model. It would also be interesting to investigate further how COVID-19 will impact the American and Chinese stock markets and if our model can also be applied in the coming days.