Investment portfolio can provide investors with a more robust financial management plan, but the uncertainty of its parameters is a key factor affecting performance. This paper conducts research on investment portfolios and constructs a two-stage mixed integer programming (TS-MIP) model, which comprehensively considers the five dimensions of profit, diversity, skewness, information entropy, and conditional value at risk. But the deterministic TS-MIP model cannot cope with the uncertainty. Therefore, this paper constructs a two-stage robust optimization (TS-RO) model by introducing robust optimization theory. In case experiments, data crawler technology is used to obtain actual data from real websites, and a variety of methods are used to verify the effectiveness of the proposed model in dealing with uncertainty. The comparison of models found that, compared with the traditional equal weight model, the investment benefits of the TS-MIP model and the TS-RO model proposed have been improved. Among them, the Sharpe ratio, Sortino ratio, and Treynor ratio have the largest increase of 19.30%, 8.25%, and 7.34%, respectively.

1. Introduction

Investment portfolio means that investors invest their own assets in stocks, funds, bonds, and other securities at the same time, in order to achieve higher or more stable profits under lower risk conditions. In the early research, many scholars constructed the mean-variance model and the portfolio effective boundary model, which opened a new era of investment portfolio. Among them, since Markowitz founded the portfolio theory, the development of portfolio theory has been extremely rapid [1,2]. Risks persist due to poor risk management and uncertainty in the market environment. Portfolio theory is one of the important financial theories that discuss the profits and risks in the investment process. In the management of risk, many scholars believe that the research of investment portfolio can effectively measure uncertainty and avoid risk. The investment portfolio mainly embodies the idea of investment diversification. By screening different types of risk asset projects, the purpose of reducing investment risks is achieved. The investment portfolio optimization method provides a powerful tool for risk management [3,4]. Using the model method of investment portfolio optimization to find a reasonable allocation of funds can help investors balance safety and profitability and ensure that they achieve maximum profits within the acceptable risk range. Whether it is the securities and finance industry or other academic fields such as research institutes and universities, how to effectively formulate appropriate investment strategies has always been the focus of research [5,6]. It is found that the game between investment and risk is always accompanied by investors. Continuously improving investment risk management capabilities is a top priority for regulatory authorities, financial institutions, and even individual investors.

Some investors tend to avoid risks by looking for the law of risk distribution, so that they can modify their strategies in a timely manner in the face of unexpected situations. In the application process of investment portfolio optimization, there are few or even missing historical data. How to accurately measure risk in the absence of historical data and how to reasonably estimate possible losses taking into account a variety of factors is also a huge challenge. In addition, the study found that financial risk measurement is based on a basic distribution assumption. The selection of appropriate distribution assumptions has a significant impact on the accurate measurement of risk, which in turn affects the efficiency of the overall investment plan. How to choose an appropriate distribution hypothesis is also a pain point in portfolio research. In the research on the uncertainty of portfolio risk distribution, researchers focus on how to incorporate the uncertainty of loss into the investment decision-making process and then improve the problem of portfolio optimization. In addition to the existing research on the specific distribution probability of hypothetical risks, many scholars have tried to conduct research from the risk itself. It is found that the loss is affected by many factors. In an economic environment that is rising frequently, the distribution of losses may be similar to a normal distribution. In a flat economic environment, the risk loss distribution may be similar to a certain distribution [79]. In a recessionary economic environment, the risk loss distribution may be similar to a certain Pareto distribution [9,10]. Under different distribution models, the choice of portfolio strategy often leads to significant differences in expected results. How to effectively screen the probability distribution of risks and how to effectively determine the investment portfolio plan are a hot topic in the research.

In addition to the research on the probability of risk distribution, many scholars have conducted multidimensional research on the inherent uncertainty by citing models in cross-domains. Garlappi et al. (2007) constructed a portfolio model by estimating the confidence interval of the expected profit. The study found that the fuzzy aversion portfolio only performed stably for a period of time [11]. Tu and Zhou (2010) proposed a method that allows Bayesian Priors to reflect the objectives of economic problems. In terms of measurement of out-of-sample loss function, the model of portfolio strategy based on the objective priori can be significantly superior to the model developed in the classical framework [12]. Bayraktar and Zhou (2017) studied the fundamental theorem of asset pricing and option hedging prices under discrete-time nondominated model uncertainty and portfolio constraints. Research has discovered the duality of superhedging prices in a market where stocks are dynamically traded and options are statically traded [13]. The research of Golosnoy and Okhrin (2008) found that there is general uncertainty in the asset allocation model, and the optimal belief degree can be determined by developing a case-based decision-making method [14]. Some scholars use the linear loss aversion function to construct the model and obtain the optimal solution. This function assumes that the marginal utility of investors’ gains and losses is constant. Investor’s loss aversion degree and reference profit will vary with market conditions and relative wealth. The assumption that the loss aversion coefficient and the reference point remain unchanged does not conform to the true psychology of investors [15,16]. Huang and Qiao (2012) discussed a multiperiod securities investment portfolio selection problem and proposed an uncertain risk index adjustment model. The goal of optimal investment portfolio adjustment is to maximize the total incremental wealth under the constraints of accumulating risk index values during the control investment period and satisfying the constraints of self-raised funds in each period [17]. When analyzing the optimal investment decision of loss aversion investors, the dynamic change characteristics of loss aversion coefficient and reference point should be considered. At present, when building loss aversion models, scholars assume that the expected profit of assets is determined, and the average profit and profit distribution of risky assets in the market are both uncertain. Using the uncertainty of asset profit distribution for reference, the assumption of unknown profit distribution is introduced into robust optimization to describe the fuzzy aversion characteristics of investors, which is more in line with the real psychology of investors. Uncertainties are particularly prominent, and the economy has been affected. In this case, reasonable investment decisions are particularly important. For multiperiod investments, the experience and wisdom of investors are extremely important, where investing, profits, risks, and liquidity are often involved. These three are interrelated and restrict each other. This relationship is in the relationship between profit and risk. The performance is more prominent in time. High risk means high returns, and risk and profit are often proportional, but investors hope to obtain higher profits with less risk, which poses a big problem for investors and researchers. Therefore, it is still necessary to continue to study multistage investment under uncertain conditions.

In recent years, with the steady optimization theory and methods being gradually accepted and recognized by scholars, the uncertainty of using robust optimization to study the portfolio has become particularly novel. The robust optimization theory simply expresses the uncertain parameters in a specific interval and can flexibly control the degree of uncertainty. The robust optimization theory proposed by Bertsimas and Sim (2004) and Ben Tal et al. (2007) to deal with the uncertainty in the model is now a commonly used research method [18,19]. Huang et al. (2010) studied how to use robust optimization to analyze uncertain parameter problems and proved the effectiveness of the robust optimization model [20]. Dai and Wen (2014) proposed a robust optimization theory for minimizing the CVaR of the investment portfolio under the general affine data perturbation uncertainty set. Their research uses numerical experiments with real market data to illustrate the practicality of robust optimization models [21]. In venture capital, investors pay more attention to the right-leaning loss distribution risk, and then it is of practical significance to introduce information entropy into risk measurement research in the financial field. Through the review of the above literature, diversification of investment demand and uncertainty of risk preference are also hot issues in investment portfolio research in recent years. Many scholars have conducted in-depth investigations on the uncertainty of risk appetite. Information entropy can be used to measure the degree of deviation from uniform distribution. The deviation corresponds to a point that reflects the uncertainty of the probability distribution over the entire range of values. At the same time, information entropy can express more information about the distribution, more accurately reflect the risk of loss distribution, and then serve as an ideal means of measuring risk. It can be found from the above-mentioned literature that robust optimization, CAaR, and information entropy, as tools to measure stock investment risk, can be well applied in the symmetric and asymmetric distribution of probability. However, although most of the existing algorithms have played a certain role in improving the accuracy of the model solution, the convergence speed is often slow due to the complexity of the solution algorithm.

In the research of portfolio optimization, the mean-risk model usually assumes that the expected profit on risky assets is subject to a known probability distribution and that the number of transactions is infinitely divided, which is not consistent with the actual situation. In this paper, a two-stage robust portfolio optimization model is constructed, and the optimal solution in the worst case is found in the uncertain set. Based on the analysis and comparison of the above related literature, the research in this paper mainly includes the following innovations:(i)This paper summarizes the research results of related scholars, analyzes the classical portfolio problems in depth, and proposes a deterministic TS-MIP model considers the risk and diversity of investment problems.(ii)On the basis of deterministic model, the research content is further extended to uncertainty, and the mechanism of influence of uncertainty parameters on portfolio efficiency is analyzed in depth.(iii)In the research of dealing with uncertainty interference, this paper introduces the theoretical method of robust optimization, constructs a TS-RO model, and applies it to the research field of investment portfolio.(iv)In the numerical case analysis part, this paper uses data crawling technology to obtain the latest real data from real-time websites as the input part of the model and uses real data for a large number of case studies and parameter comparisons, to obtain practical investment advice.

The rest of this framework is as follows: Section 2 lists related basic theories and methods. In the third section, based on the basic deterministic TS-MIP model, we analyze the problem under uncertain parameters and further construct the TS-RO model. Section 4 obtains relevant data through data crawling technology and constructs numerical cases for analysis. Section 5 compares the key parameters of the model and puts forward some management investment recommendations.

2. Basic Theory and Model

2.1. Information Entropy

Information entropy can be defined as the possibility of discrete random events [2224], and the specific expression is shown in

Among them, the function of is to measure the probability of occurrence of the situation . In the current stage of theoretical research, information entropy has been widely used to measure the uncertainty of information, and there is a positive correlation between entropy and uncertainty. In addition, the information entropy function also has the following three special properties:(i)Continuity: is a continuous function of , (ii)Nonnegativity: (iii)Extreme value: if and only if the condition is , the information entropy achieves the maximum value

2.2. Value-Added Entropy and Actual Entropy

Value-added entropy is a kind of generalized entropy [25,26], which can be defined as

Suppose there are types of stocks or securities in the market, and the type contains possible prices . The number of all possible value combinations is . refers to the investment ratio of the securities, and is the output ratio in the price combination. In addition, and represent the rate of profit, assuming that short selling is not allowed, that is, . The above formula (2) can be further transformed into

Actual entropy: in the actual financial market, investment transactions require costs, and an investment portfolio that ignores transaction costs will often have a great impact on actual profits and may make investments invalid. Introduce typical transaction costs into the portfolio and define linear transaction costs. However, linear transaction costs rarely appear in investment costs, so the improved transaction cost function can be expressed as

This paper draws on the improved typical transaction cost function and establishes a dual-objective portfolio model with the largest profit expectation and the smallest risk expectation. Set as the investment ratio in stocks, as the expected rate of profit, and as the actual rate of profit of stocks and securities, and the portfolio model based on the measurement is expressed as

Among them, means that short selling is not allowed, if and only if and . Actual entropy can reflect the speed of appreciation and the cumulative profit of funds. Compared with the mean function that cannot directly reflect the cumulative profit of the fund, the combination of actual entropy and actual entropy can be more effective and more appropriate to reflect the investment profit.

2.3. CVaR

VaR can usually be defined as value at risk [27,28], that is, the maximum loss of an investment portfolio in a normal market in a specific period under a specific confidence level of . Set as the loss function of the investment portfolio, and the specific meaning is the expected loss of the investment portfolio. Among them, is the investment decision vector, which specifically means the proportion of risky securities in the investment portfolio. is a 0–1 variable of value at risk, which represents the profit rate of securities stocks. Then, there is . When is fixed, is a function of . Assuming that is a continuous random variable, the probability density function of is , then , and the distribution function is , which represents the probability that the loss does not exceed , is the upper limit of risk, and is the nonincreasing right continuous function of . Assuming that is used to represent the confidence level, of is expressed as

However, because is only a quintile within a certain confidence level, the left-tail risk beyond this quintile cannot be measured by , which leads to failure in assessing the overall risk of the portfolio and makes investors may ignore huge losses in some small probability events. At the same time, cannot measure the risks in some extreme situations, such as financial crises. Based on this, under certain was proposed. can be defined as the conditional average value of losses exceeding under a certain confidence level, which is used to measure the average excess level of losses [29,30]. According to the research of related scholars, is more sensitive to the shape of the loss distribution at the tail of the distribution [31,32]. According to the definition of , we can get

It is found that must be used in the process of solving equation (7), and the mathematical expression is extremely complicated, and it is difficult to calculate the result. In order to solve this problem, Rockafellar and other scholars constructed an auxiliary function and effectively connected and [33,34]. The auxiliary function iswhere . Due to the diversity and complexity of the market environment, the loss caused is also uncertain, and the probability density function is not easy to calculate. Therefore, the method of using historical data to simulate calculations is selected, and historical data is used to predict the specific future random vector. Assuming that the random variable in the past trading day represents scenarios, the value of each scenario is , and the probability of any one scenario is . So, it exists that

Because of the existence of function in equation (9), and because function is usually not continuous and differentiable, general algorithms cannot be solved. Here, the aggregation function proposed by related scholars is used to smooth the function [35,36]. For any , the above function can be expressed as

2.4. Two-Stage Mixed Integer Programming (TS-MIP) Model

A diversified investment portfolio has lower volatility risk than personal assets, and increasing the diversification of the investment portfolio can help investors reduce the variance of the investment portfolio. Not only can the risk in the investment portfolio be effectively and accurately measured, but also the investment portfolio can evaluate diversity. According to investment portfolio theory, diversity can be used to reduce nonsystematic risks. Specifically, the greater the value, the more diversified the investment portfolio. Based on the above theory, in the model proposed in this paper, is used to adjust the direct function to determine the new objective function to measure the risk of the investment portfolio. The value-added entropy combined with the real entropy function is used to measure the statistical profit of investment. Skewness function is used to measure investment increment. Based on the above analysis and combined investment portfolio strategy research, this paper proposes the following TS-MIP model, the structure of which is shown in Figure 1. The problem of outer layer maximization benefit planning mainly analyzes the maximization of income and the maximization of investment diversity and the maximization of skewness. Corresponding to it is the problem of internal minimization of risk, which mainly includes the minimization of information entropy and the minimization of investment risk. The investment risk here is measured by the .

The stage of maximizing the benefit of the outer layer is the overall stage, and the specific form is as follows:

The objective function is combinatorial optimization problem, which maximizes the profit under the condition of the lowest risk. The first line of constraint indicates the lower bound of profit. The second line of constraint indicates the maximum investment ratio, short selling is not allowed, and there is no additional capital inflow. The third line of constraints indicates the upper limit of investment diversity. The fourth line of constraints indicates the upper limit of the investment increment. The fifth and sixth lines of constraints are related variable constraints; the purpose is to ensure the feasibility. The inner minimization problem is second stage, and the form is as follows:

The specific meaning: the objective function is to minimize information entropy, the risk. The first line of constraints represents that the lowest value of information entropy is higher than the limit threshold. The second line of constraint represents that the risk that investors can bear is lower than the upper bound of the maximum tolerance. The third line of constraints describes the calculation strategy for cumulative risk. The fourth line of constraints indicates the maximum investment ratio and no remittance of external funds. The fifth line of constraints indicates that the probability of all scenarios is 1. The sixth, seventh, and eighth lines of constraints are related variable constraints. In order to calculate with , assuming that the rate of profit on investment shows a normal distribution, can be expressed as according to the law of large numbers, where measures the maximum loss of the investment portfolio. Then, we obtained that

Among them, is the probability density function of the standard normal distribution, which can be expressed as

In addition, because cannot directly predict and is extremely difficult to calculate, this paper uses a computer program to assist in the solution of the model. In order to introduce the two-stage optimization model and its application in the risk-considering investment portfolio problem, the relevant decision variables and parameters are summarized in Table 1.

3. Two-Stage Robust Optimization (TS-RO) Model with Uncertainty

3.1. Portfolio Optimization Problem with Uncertainty

The real capital market environment is full of instability and randomness, and it is extremely difficult or even impossible to obtain the accuracy of data parameters. In the research of dealing with uncertain information, many scholars have cited the theory of robust optimization. Robust optimization model can effectively provide an effective measure of uncertainty. Studies have found that it plays an extremely restrictive role in dealing with uncertain information parameters. In this section, by citing the theory of robust optimization, a two-stage robust optimization model for solving portfolio problems under uncertain conditions is constructed [37]. Based on the analysis of real securities and stock markets, this paper takes the two-stage basic model as the research object to explore the impact of uncertainty in depth. In the actual market analysis process, the upper bound of the expected risk probability is not always certain. In other words, in a complex capital market environment, investors’ risk attitudes are not always consistent. As investors’ risk attitudes change, the original assumptions of expected risk probability as deterministic will not reflect the reality. Therefore, this section extends the expected risk probability from certainty to uncertainty. According to the relevant theory of robust optimization, the assumptions are as follows. Set the expected risk probability that is , where is the nominal demand, and are the disturbance items [38]. Based on the above problem description and feasibility assumptions, this paper builds the TS-RO model. The expected risk of uncertainty in the model is , and the uncertainty set is the most commonly used ellipsoid set [39]. The norm is used to define the uncertain ellipsoid sets , , and as adjustable safety parameters, as well as the spherical diameter of the uncertain set. It means that at most disturbance items deviate from the nominal set [40,41].

Theorem 1. For the given condition that is closed and convex, when the parameter is uncertain, the constraint adjustment of the second stage part of the TS-RO model under uncertain conditions is equivalent to TS-MIP model, that is, , in which, in order to simplify the expression, set .

Proof. The conventional ellipsoid uncertainty set is , where , and its constraints can be translated as . For is positive and closed, it is a convex problem. Therefore, convex problem can be solved by Karush-Kuhn-Tucher condition. with . Therefore, the meaningful solution to deal with uncertain problems is its robust feasible solution. In all robust feasible solutions, how to interpret the value of the target (and possibly uncertain) still needs deeper analysis. When applied to the target problem, it is natural to quantify the quality of the solution through the guaranteed value (i.e., the maximum value) with the help of the “worst case-oriented” concept of robust theory. Thus, the best possible robust feasible solution is the one that solves the TS-MIP model , or which is the same, the optimization problem in the TS-RO model. The latter problem is called the robust counterpart of the original TS-MIP problem. Above all, Theorem 1 can be proved.

3.2. Two-Stage Robust Optimization (TS-RO) Model with Uncertainty

Based on the above analysis and combined investment portfolio strategy research, this paper proposes the following TS-RO model. Under uncertain conditions, the expression form of the outer maximization stage is the same as the TS-MIP model, and the specific form is as follows:

Since the risk attitude of investors is considered, the expression form of the second stage inner minimization problem is significantly different from the basic model. The specific form is as follows:

It is worth noting that, in the inner minimization problem with uncertainty, the objective of the objective function is rewritten to solve the infimum problem due to the heterogeneity of investors’ risk attitudes. The meaning of the second term of the constraint is the risk probability scenario under the worst scenario. When the disturbance term of the uncertain parameter fluctuates within the range of the ellipsoid set, the adjustable safety parameter reflects the decision under the worst scenario. Its purpose is to solve the most stable investment income scenario, that is, the most stable income. In the process of calculation, the planning problem is more difficult due to the solution of multiple quadratic functions. Therefore, in the follow-up study, in the program involving a large number of calculations, computer software and existing commercial software are used to solve the problem. The package is used for solving calculations to ensure the accuracy of the obvious results.

4. Numerical Experiment

Suppose that an investor conducts investment activities on a stock exchange and selects 10 securities stocks as alternatives through multiple comparisons in multiple securities markets. After rigorous data comparison and advantage analysis, the best investment plan combination is screened out in order to achieve the purpose of maximizing the comprehensive benefits. In the process of selecting securities and stocks, the following factors and principles need to be considered comprehensively. First, the ultimate goal of investors is to maximize profits, but, at the same time, they must also take into account their risk tolerance. In other words, investors are pursuing the maximization of profits on the basis of certain risk expectations. Second, the investor’s investment assets are fixed, and the initial investment proceeds will be used again for investment. Third, the investment process is rational. When investors face the risk of resisting the initial threshold, the investment quota will no longer be added. According to the above basic elements and principles, this paper first uses data crawling technology to obtain the relevant database, then uses the computer to simulate and check the model, and finally obtains investment management recommendations and research enlightenments through a large number of comparisons.

4.1. Data Collection

In this section, we use actual financial securities market data to conduct simulation experiments to verify the effectiveness of the model. In the data acquisition stage, this section uses python to write the technical framework, Python 3.6, requests, math, time, pandas, matplotlib, pyecharts, statsmodels, scipy, jieba, and pylab. Figure 2 describes the calculation steps of the data crawling technology. First, log in to the target web page, browse the relevant web page information (Eastern Fortune.com), and search for the online information of the target web page. Secondly, analyze the web page structure, view the source code of the web page, and click on the next page to observe the change of the url in the search bar of the browser. Thirdly, use the dictionary method to read the data directly, and save the read data to the preset file database. Next, use a loop strategy to crawl the data step by page, jump to the next page after completing the crawling of one page of data, and repeat the same data collection process. Finally, when the acquired data is stored in the database, the crawling process is terminated.

This section obtains historical data of historical stocks from a real website (Eastern Fortune.com). The data is obtained from the period from July 24, 2020, to December 20, 2020, about 1,000 statistical data generated by 100 exchanges of 10 stocks on the next day. Since the trading of stocks is only carried out on the trading day, the data sequence is sorted by time, but the time sequence is not continuous. In order to facilitate statistical calculations, this section sorts them according to the order of the trading days, which are 1 to 100 trading days. Table 2 describes the initial part of the data form of the obtained stock information. Before the numerical simulation, we conducted a simple statistical analysis of the historical profits of 10 stocks. Table 2 lists the average profit, standard deviation, skewness, and kurtosis of a single stock.

The relevant parameter settings in this section are as follows: when investors sell securities in the securities market, the ratio of securities lending margin shall not be less than 50%, so k = 0.5. In the process of stock trading, the transaction cost includes commission, stamp duty, and transfer fee, which is generally 0.3% of the transaction amount. Due to the existence of transaction fees, stock trading should not be too frequent. This paper studies wind as three levels; one is based on a 30-day cycle, another is based on a 60-day cycle, and the third is based on a 90-day cycle. Analyze the relevance and influence of various indicators of stock trading. The profit rate of the stock is fitted according to historical parameters, and the fitted value of the historical data is used as the profit rate for analysis. On the assumption of the confidence interval, this paper, respectively, assumes 85%, 90%, 95%, and 99% confidence intervals and analyzes the parameters of each confidence interval.

Figure 3 depicts the volatility of the profit rate of the selected 10 stocks 100 times. It can be seen that the fluctuation of stocks is relatively large, which shows that the volatility of investment income is relatively large. It can also be found that there is no obvious law for the fluctuation of stocks, so there are no algorithms and tools that can accurately predict stock investment profits. Overall, the volatility of individual stocks is affected by objective economic factors, which is manifested in the overall change trend of the macro. From the above figure, it can be seen that the volatility of stocks has a certain time regularity; that is, there are overall ups and downs. The trend of. Therefore, in the investment process, it is necessary to take into account the various factors of the investment, as well as to make a reasonable plan in combination with objective conditions and risk tolerance.

Figure 4 depicts the overall (100 trading days) average amount of fluctuations in 10 stocks. Only from the perspective of the average value, among the 10 stocks, the average value of volatility of 8 stocks is higher than 0, and the average value of volatility of 2 stocks is lower than 0. This shows that the overall stock market at this stage shows a good development trend. Stockholders showed a positive attitude towards the improvement of economic conditions and actively invested funds in the stock market.

4.2. Model Algorithm Design

In this paper, based on the Matlab (R2016a) platform, the algorithm framework is designed, and the algorithms of the two-stage basic model and the TS-RO model under uncertain conditions are constructed, respectively. Solve by calling the solver Gurobi (9–1–0). In order to ensure the rigor and scientificity of the experiment, all algorithms are operated in the same computing environment (Windows 10, Intel (R) Core (TM) i5-8300H CPU @2.3 GHz, RAM 8 GB, 512 G SSD). The algorithm framework and calculation steps of the model are shown in Algorithm 1.

(i)Input Measurement data
(ii)   Initialization: Input the initial value; Setting parameter value boundary;
(iii)   Step 1:
(iv)     For TS-MIP model: Define variable type; Set probability function;
(v)     else TS-RO model
(vi)       Define the variable type; Generate random number; Set the safety parameters;
(vii)     End
(viii)   Step 2: While
(ix)       Input , do step 3; Otherwise: re-step 1;
(x)     End while
(xi)   Step 3: Initialize
(xii)     Input Parameter constraints; Variable constraints;
(xiii)     End
(xiv)   Step 4: Do for: Set the solution environment; Solved by Gurobi;
(xv)        If met step 3: Out the result and time
(xvi)        Else: profit step 2;
(xvii)   End do

5. Sensitivity Analysis

5.1. The Computational Efficiency of the Model

In the same computing environment and the same computing scale, this section analyzes the factors affecting the running time of the model. After fixing the relevant parameters, the investment cycle is the only variable. We divide the time period (L/DAY) into 30, 60, and 90 trading days and compare the differences in the running time of the model. The calculation results are shown in Table 3. The analysis found that the length of the time period has a positive correlation with the calculation time; that is, the longer the time, the longer the calculation time of the model. Secondly, the calculation time of different models is slightly different. Among them, the calculation time of the equal-weight model is the shortest, the calculation time of the TS-MIP model is in the middle, and the calculation time of the TS-RO model is the longest. The increase in computing time reflects the increase in computing volume, which means that the computing volume and complexity of the TS-RO model are also the largest.

5.2. Autocorrelation Analysis

The long memory of financial securities asset profits refers to the significant autocorrelation of distant time intervals in the time series of profits; that is, historical events will continue to affect the future. Since stock securities data has obvious long memory, historical data information can be used to predict future profits and other related parameters. In this section, the parameters obtained are normalized, and the correlation effects can be compared more clearly. In this section, using the autocorrelation coefficient method, research and analysis found that the income of the industrial average index has significant long memory, as shown in Figures 5 and 6. The autocorrelation function is a measure of correlation, that is, a measure of similarity, which is the correlation between the function and the function itself. When there are periodic components in the function, the maximum value of the autocorrelation function can well reflect this periodicity. Cross-correlation is the similarity between two functions. When both functions have the same periodic component, the maximum value can also reflect this periodic component. From the perspective of linear space, correlation operation is actually an inner product operation, and the inner product of two vectors in linear space represents the projection of one vector to another vector, indicating the similarity of the two vectors, so the correlation operation reflects this kind of similarity.

From Figures 5 and 6, we can find that the fluctuation of the curve tends to be flat. For the autocorrelation graph test, stationary series have short-term correlation. This property indicates that, for stationary series, only recent series values usually have a more obvious influence on the current value. The farther apart the past value, the smaller the influence on the current value. As the number of delay periods increases, the autocorrelation coefficient of a stationary series will decay relatively quickly to zero and fluctuate randomly around zero, while the autocorrelation coefficient of a nonstationary series decays slowly. This is the use of autocorrelation graphs, the standard for the stationarity test.

5.3. Influence of Safety Parameters

To ensure the unbiased and scientific nature of the experiment, the parameters are fixed. The model under the condition of deterministic information is the TS-MIP model. With the increase of security parameters, the parameters in the model such as rate of profit, diversity, skewness, information entropy, and CVaR are not affected. In the environment of uncertain risk preference, the model is the TS-RO model. The parameter diversity, skewness, and information entropy are not disturbed by uncertainty. Under the environment of uncertain risk appetite, the risk attitude of investment has changed. Here, through the method of robust optimization, the relevant risk preference range and boundary are constructed with the help of uncertain sets. The benefits of important parameters, CVaR, and total revenue are significantly affected by safety parameters.

Figure 7 describes the impact of security parameters on A: revenue and B: diversity. It can be seen from Figure 7 that, under deterministic information conditions, changes in security parameters will not have an impact on revenue and diversity. The figure shows that the influence curve of the TS-MIP model is a horizontal straight line. Of course, the deterministic TS-MIP model cannot cope with the problem of portfolio optimization under uncertain conditions. Under conditions of uncertain information, changes in security parameters have a positive impact on profits, but not on the diversity of investment portfolios. Specifically, as the level of security parameters increases, investors’ investment income also shows an increasing trend. That is, when the risk is controllable, the rate of profit on investment is higher, and the investment ratio is larger.

Figure 8 describes the impact of security parameters on C: skewness and D: information entropy.

It can be seen from Figure 8 that, under deterministic information conditions, changes in security parameters will not have an impact on skewness and information entropy. The figure shows that the influence curve of the TS-MIP model is a horizontal straight line. Of course, the deterministic TS-MIP model cannot cope with the problem of portfolio optimization under uncertain conditions. Under uncertain conditions, changes in security parameters will not have an impact on skewness and information entropy. This shows that it is not the controllability of risk that affects investor confidence, but other deeper factors.

Figure 9 describes the impact of safety parameters on E : CVaR and F: total benefits. From the change trend of the curve in Figure 9, it can be found that, under certain information conditions, changes in safety parameters will not have an impact on CVaR and overall benefits. The figure shows that the influence curve of the TS-MIP model is a horizontal straight line. Under uncertain conditions, changes in safety parameters will have a significant impact on CVaR and overall benefits. As the security parameters increase, the risk of investment shows an increasing trend, which is often referred to as a robust price, which is the price paid to resist risks. But, at the same time, the increase in safety parameters also makes the overall benefit show an increasing trend, which can increase investors’ investment confidence when they choose investment.

5.4. Testing the Effectiveness of the Portfolio

For comparison, three financial ratios are listed below to measure the pros and cons of stocks and securities. The Sharpe ratio is used to help investors understand the profit on investment related to their risk. Unlike the , the Sortino ratio is used to evaluate the excess profit of a portfolio given a downside risk. The Treynor ratio () represents a risk-adjusted profit based on systemic risk. Generally speaking, the greater the value of the Sharpe/Sortino/Treynor ratio, the greater the risk-adjusted profit, and the more attractive the risk-adjusted profit for rational investors.

is an indicator proposed by William to research and measure fund performance [42]. This indicator is not only a standardized indicator for fund performance evaluation, it has been successfully applied in many fields as well. The purpose of the is to calculate how much excess profit will be generated per unit of total risk assumed by the portfolio. When all assets in the portfolio are risk assets, the Sharpe ratio applies. The formula for calculating the is

Among them, is the expected annualized profit of the investment portfolio, is the annualized risk-free interest rate, and is the standard deviation of the annualized profit of the investment portfolio. The Sharpe ratio represents how much excess profit investors can get for each additional risk point. If it is greater than 1, it means that the fund’s profit is higher than the volatility risk; if it is less than 1, it means that the operational risk of the fund is greater than the rate of profit.

In this way, the Sharpe ratio of each investment portfolio can be calculated, that is, the ratio of investment profits to more risks.

The higher the Sharpe ratio, the better the portfolio. Through experimental verification, it is found (Table 4) that when , the equal weight method is the lowest (11), the TS-MIP model is in the middle , and the TS-RO model is the best . Compared with the equal weight method, the Sharpe value of the TS-RO model increased by 18.97%. In addition, in each model, as the time period increases , the Sharpe ratio gradually increases. This law shows that long-term investment is due to short-term investment, which can provide decision-making suggestions for investors’ investment cycle planning.

is the standard for quantitatively dealing with the trade-off between the profit and risk of investment plans and the final selection of investment plans. Its calculation formula is as follows:

Among them, is the profit rate of the investment portfolio, which is replaced by the average value of the profit rate of the investment plan obtained by the simulation. is the minimum profit required by investors of 2%. is the risk that the actual rate of profit is lower than the average value, that is, the downside risk of the rate of profit, is the lowest acceptable rate of profit, and can be the risk-free rate or 0. The is a measure that is more in line with investors who are more sensitive to the decline in asset value. The higher the ratio, the higher the profit rate by the fund if it bears the same unit of downside risk.

The result verification in Table 5 found that, taking as an example, the equal weight method is the lowest , the TS-MIP model is in the middle , and the TS-RO model is the best . Compared with the equal weight method, the of the TS-RO model has an increase of 8.20%. In addition, in each model, as the time period grows , the is gradually increasing, further verifying the conclusions obtained by the Sharpe Ratio. It should be pointed out that risk is the uncertainty of the result. This uncertainty includes situations where the actual rate of profit is lower than expected and situations where the actual rate of profit is higher than expected. From the perspective of project investors, it is undoubtedly beneficial for the actual rate of profit to be higher than the expected value (i.e., average) when making investment decisions. This uncertainty brings unexpectedly high profits to investors. Therefore, we should not pay attention to these risks in the investment but should pay attention to the risk that the actual rate of profit is lower than the expected value of the investment decision.

is the ratio of the value of the fund’s profit rate exceeding the risk-free interest rate to the systemic risk. measures the excess profit that the fund receives from the systemic risk of the unit. The larger the , the higher the risk-adjusted profit. The is based on the fact that nonsystematic risks have been completely diversified; that is, it is believed that the portfolio of assets held by the fund has fully diversified the risks of individual stocks or industries. is suitable for evaluating nonsystematic risk of completely diversified funds, such as large-cap index funds.

The numerator of the Treynor ratio is still the excess profit of the asset portfolio, is the expected annualized profit of the portfolio, is the annualized risk-free interest rate, and the denominator becomes systemic risk . Its economic meaning is that every unit of systemic risk is assumed. For risk, represents the profit of a single stock, represents the market profit, and represents the variance of the market profit.

As shown in Table 6, through experimental verification, when , the equal weight method is the lowest , the TS-MIP model is in the middle , and the TS-RO model is the best . Compared with the equal weight method, the of the TS-RO model increased by 7.34%. In addition, in each model, as the time period increases , is gradually increasing, which further verifies the conclusions obtained by and . Regarding the excess profit the investment portfolio can get, the greater the value of the , the stronger the ability of the fund manager. The applies to a fully diversified investment portfolio, at which time nonsystematic risks have been completely diversified, and only systemic risks in the market are considered [43,44].

6. Conclusion

Research on investment portfolio issues can provide investors with more robust investment plans, and the uncertainty in it is a key factor affecting investment performance. Aiming at the investment portfolio problem, this paper comprehensively considers the five dimensions of profit, diversity, skewness, information entropy, and conditional risk value and constructs a two-stage mixed integer programming (TS-MIP) model. However, the deterministic TS-MIP model cannot cope with the problem of uncertain information. Therefore, this paper constructs a two-stage robust optimization (TS-RO) model by introducing robust optimization theory.

In terms of case experiments, this paper uses data crawler technology to obtain actual data from real websites for analysis and verifies the effectiveness of the proposed model in dealing with uncertain problems. The comparison of models found that, compared with the traditional equal weight model, the investment benefits of the TS-MIP model and the TS-RO model proposed in this paper have been improved. Among them, the Sharpe ratio, Sortino ratio, and Treynor ratio have the largest increase of 19.30%, 8.25%, and 7.34%, respectively. Combined with the results of empirical analysis, this paper analyzes the investment decisions of investors and puts forward some suggestions to investors.

The content and contributions of this paper mainly include the following: first, in response to the uncertainty of the rate of profit, this paper uses historical data as the basis to predict the rate of profit and express the uncertainty scenario. Second, after the analysis of the mean-variance model, this paper uses the two-stage integer programming theory to establish a portfolio model that maximizes profits, minimizes risks, and considers both profits and risks. Third, the empirical analysis of the model using the data of 10 stock indexes in my country’s stock market shows that the model is feasible and effective, giving investment decision-makers a simple, clear, and intuitive guidance. Fourth, relevant suggestions are made to investors. Investors should strengthen their ability to obtain relevant information and be able to identify and analyze the information and then use relevant technologies to predict stock profits. Moreover, conservative, prudent, and aggressive investors must consider their own circumstances when investing and should not invest blindly.

Data Availability

No data were used to support this study.

Conflicts of Interest

The authors declare that they have no conflicts of interest.