The origination and progress of modern portfolio theory

. Portfolio construction plays a vital role in investment decision. In this paper, we demonstrate the origination and progress of the modern asset portfolio theory as well as the state-of-art applications. Specifically, we discuss the measure to optimal portfolio configuration and apply Python to analyzing portfolio configuration. According to the analysis based on Markowitz portfolio theory, one can obtain the portfolio with the smallest risk or the largest Sharpe ratio and the efficient boundary among the portfolio composed of multiple assets. Investors can make rational investment according to their actual ability and risk preference. Overall, these results shed light on the combining traditional financial theory with emerging programming language to address financial issues more quickly and efficiently.


Introduction
Contemporarily, with the development of economy, the investment amount is getting higher and higher. The way to obtain the maximum return from investment has become a key issue that must be considered in the investment process. A portfolio is a diversified portfolio of assets, usually consisting of stocks, bonds, market assets, cash, and real assets (e.g., real estate and gold). Only reasonable asset portfolio allocation can obtain the maximum investment return. At present, various financial institutions have launched various financial products, the essence of which is to use the asset portfolio theory to reasonably allocate the proportion of various financial products. To put it simply, asset allocation is the process of selecting the asset category and determining its proportion in an asset portfolio [1].
In retrospect, in 1952, an American economist Markowitz's on financial magazine published a paper titled "portfolio selection" [2]. In this paper, the risk of its expected return and variance or standard deviation on behalf of the risk of combining research portfolio and a matter of choice for the first time, which marks the beginning of modern assets portfolio theory [3]. Although investment managers and economists have recognized the importance of risk, they have failed to measure it effectively and have paid more attention on returns. Markowitz's academic career peaked in 1959 with the publication of his magnus work portfolio (the Effective Diversification), for which he won the Nobel Prize for his in-depth and fruitful study of modern portfolio theory. In 1964, John Sharp published a single index model that greatly simplified the application costs of modern portfolio theory [4]. With the development of modern portfolio theory, many famous research results such as CAPM capital asset pricing model and APT model emerge at the historic moment. The essence of CAPM is the portfolio theory of risk-free assets and infinite short selling. It takes into account not only the decisions of individual investors, but also their overall decisions to determine market equilibrium. In portfolio theory, the price of an asset is provided externally and is not influenced in any way by investors. Given this price, a probability distribution is formed and investors are allowed to differ in their expectations [4]. However, in CAPM, asset price is not exogenous, it is a market equilibrium price. Arbitrage pricing theory (APT) was first proposed by Stephen Ross, an American economist, in 1976 [5]. It investigates and explains the equilibrium pricing of risky assets from a broader perspective. Similar to the capital asset pricing model, arbitrage regular earnings and risk estimation is a group of securities of the returns and risk of actual measure correctly. The correlation coefficient is to correctly reflect the future of the relationship, because of the history of digital data is unlikely to be repeated. Securities variables will change with time constant, i.e., these factors can cause theoretical assumptions to disconnect from reality in different ways.
In order to analyze the optimal portfolio, this paper investigates the relationship between covariance and correlation coefficient based on the calculation formula of expectation and variance. Besides, this paper also discusses part of the knowledge of finance theory, establishes the analysis model of asset portfolio allocation, and builds the model of return and risk (mean and variance) based on Python programming. The rest part of the paper is organized as follows. The Sec. 2 will the procedure of portfolio design and development. The Sec. 3 will the application of Modern Portfolio Theory Based on Python. The Sec. 4 will the limitation and future prospect.

The Markowitz mean value-variance model
If the investor invests in a portfolio composed of various of risky assets in a single investment period, and represents the rate of return be expected the i th of the assets, the expected return ratio of the portfolio is: where xi represents the investment proportion of the i th of the assets. 2 represents the variance of the ith of the assets, the variance of the portfolio consisted by n assets is: Here, i and j represent different assets, and ( , ) is the covariance between asset i and asset j, which is used to measure the correlation of rates of return of the two assets.
is the correlation coefficient between asset i and asset j, which can be used to compare the correlation between two assets, and represent the standard deviations of asset i and asset j, respectively. According to the Eq. (2), one concluded that the risk of the portfolio is related to the investment proportion of every asset, the correlation coefficient between different securities, and the standard deviation of every asset [3]. Therefore, in the case of the same rate of return, the variance of the assets should be as small as possible, and the correlation coefficient between each two assets also should be as low as possible, so as to minimize the risk.

The Sharpe ratio
Sharpe ratio is excess rate of return be expected of the portfolio divide the overall standard deviation, which can be mathematically described as: where represents the Sharpe ratio, represents the overall standard deviation of the portfolio, and represents the rate of interest which is risk-free. ( ) − is the rate of return be expected minus the rate of interest which is risk-free, which is excess rate of return be expected. The represents how much excess return the asset portfolio gain when investor assume additional unit of risk. It considers both of the rate of return and the risk [3].

The effective frontier theory
When the financial products that investors choose to invest are fixed, as the investment proportion of various investment assets changes, there are many groups of different combinations of risks that investors need to assume and returns, different risks lead to different returns, which is called feasible set. The effective boundary is to the select the assets with higher expected returns from feasible set when investors need to assume the same risks, or you can choose a portfolio with less risk when there is the same return. The way investors choose the optimal portfolio of the efficient boundary is related to their preference. This depends on the attitude of investors face to the risk, which can be reflected by the undifferentiated curve. An investor may have several parallel undifferentiated curves, forming the family of the undifferentiated curve [3]. The risk seeker had a lower and gentle slope, while the risk averse had a higher and steeper slope.

The CAPM model
CAPM model considered that the balanced return of all risky assets is a linear function of the risk, the risk and the return are linearly. The model of risky assets is: where r is the return of the risk-free, is the return of security i, is the return of portfolio M, measures the risk of security i of the above portfolio, it is often used as a risk index in practice to construct investment portfolios. For equilibrium situation, the price of the security adjusts to this point. The expected return on each security is exactly equal to the return of risk-free plus the risk premium. CAPM model analyze both systemic risk and the unsystemic risk, analyze the return for investors to assume additional risk quantitative, in the securities market, the unsystemic risk can be avoided through investment diversification [5]. Therefore, there is no risk premium for this kind of risk, but systemic risk cannot be eliminated, it can have an impact on expected returns. A sketch of the model is given in Fig. 1.

The APT model
APT model believes that the expected return is proportional to the risk, i.e., the expected return is greater as the risk greater. Since arbitrage activities will change the price of the assets, it eventually leads to the disappearance of arbitrage opportunities, investors are only faced with an investment situation in which higher returns are matched with greater risks. APT model only requires investors to prefer to wealth. The model assumes that the income of securities is generated in the following way: where is the return of security I, is the i th generating factor of return, measures the influence of change of factor on return , is the random deviation. In such a model, it is believed that the return of risky assets is in a linear function with some influencing factors. APT model is consistent with CAPM model when the generation index of returns equal to market portfolio returns. On this basis, CAPM model is a special case of APT model, which is more general that needn't be limited to market securities portfolio [5].

Technical level
Actually, when the investors decide to deal with Portfolio Theory, they may meet some problems as this theory has some boundedness in reality. First of all, the factors of using theory are very harsh. They not only need professional people who are familiar with the theory and intelligent computing equipment, but also need accurate reaction. That's because in reality, the stock market is changeable. It requires the ability that can solve every problem quickly when investors meet. Nevertheless, with the technical level at present, it's hard to reach the acquirement. In addition, even if we really try ourselves best to complete, the result is uncertainty. Therefore, in the nature, the limitation of using Portfolio Theory depends on its total cost [6]. Moreover, the investment activities of developed countries have proved strongly this idea. Thus, many security analysts and managers regarded investment as a kind of art more than science.

Future data
As mentioned above, because the stock market is so changeable that theory cannot solve problem with direction. In other words, the historical model that made before also faced uncertainty when meet future data (e.g., Mean-variance model and Efficient boundary model). The basic method of Portfolio Theory is to express the investment price and the investment risk of security, i.e., it can get the efficient boundary. Moreover, with that boundary, one can find the situation that get maximum profit whatever the risk is or get minimum risk whatever the profit is. Besides, Portfolio Theory mainly research in following two ways, i.e., the risky portfolio or non-risky portfolio [7].
From these two different situations, the model will also have some differences. To be specific, in risky portfolio situation, we can definite that its efficient boundary is on feasible set top left and this boundary outward convexity. The tangent point of the arc to the indifference curve is the point which shows the best investment situation. But if this investor prefers facing risks, the point will move to right along the boundary or in the other way, it moves to left. On this occasion, the variable depends on whether investor prefers risks. That makes future data unsure.
In non-risky portfolio situation, the variable becomes to how investors control credit granting area (the investment rate of non-risky portfolio is greater than zero) and borrow area (the investment rate of risky portfolio is less than zero). It takes advantage of monetary lever of high risks and high returns.

Other theory
Additionally, the model cannot match all situation, and future data is still unsure. Otherwise, there isn't only one theory can be used in reality. As time goes on and political and economic environment changes, more and more new theory has appeared and developed (e.g., behavioral finance). Compared with those new theories, the limitation of Portfolio Theory becomes more obvious. However, this theory still has its own advantages. It considers fully with risk and earnings and it makes portfolio investment has its own decision criteria with quantitative analysis. Therefore, it still possesses considerable feasibility. Thus, if one wants to make use of Portfolio Theory better, we should know its limitation better and then make appropriate adjustments accordingly to solve all kind of investment questions in reality.

Summary
The experiment result shows that investors can find minimum risky situation or maximum Sharpe Ratio situation and efficient frontier in multiple assets. They can invest rationally according to their own ability and risk preference. To a large extent, python convenience calculation of expected yield and portfolio variance in Portfolio Theory and can quickly find the best way. It has very important value in application of Chinese financial market [9]. The way to integrate traditional financial theory with new program design language, as well as faster, more efficient solve financial questions should be taken seriously by financial analyst and new technical personnel.

Background and Relations
Although the core of modern portfolio theory as the Mean-Variance Model which is presented by H. M. Markowitz was produced in the last century, it is still one of the foot stones in fields including commerce, finance, and accounting nowadays. As differed from the past, a new critical factor of production is greatly appreciated by people under the rapid development of the Internet. For an ancient and conventional financial industry with a requirement on data management, it is becoming one of the main demands of financial operators to analyze and predict through simple Mathematic models which are classified, effectively integrated from complicated data day by day. Therefore, the programming language with its useful and effective features and powerful data analysis capacity is increasingly applied to research on financial engineering by more and more financial operators. Nevertheless, recent research showed that under the background of exploratory data analysis, python has the highest growing speed (seen from Fig. 2). The reason is that it has a fast-learning curve and lots of high-quality data science and machine learning software [8]. In 2020, Tiobe has voted it for the most popular language all over the world. The Table. 1 gives the libraries for python that can be utilized for financial issue.

Advantages
Python is a computer program design language interpretation. Without BC to be coded, python can directly run on the source code, which means its development efficiency is much higher than other programming languages such as Java and C++ et al. Furthermore, on modern portfolio theory, recent research shows that Python provides efficient high-level data structures and specialized in the collection of stock price data packages [10]. Simultaneously, the design for Python is very readable. It is more abstract than others which means high consistency with Mathematic principles. Overall, python is suitable for those who are not professional programmers but is willing to use the computer as a kind of convenient and efficient tool.

Application achievement
Efficient frontier has been used in investment for years, it shows how to consider risks and benefits by numbers. Before 2008, MPT models were determined to be useful. Most portfolio managers asset their products through considering feasible set or Beta coefficient. However, in 2008, Investors made large loans to companies with uncertain risks that might not be repaid because they thought they could disperse their risk through diversified investment. These assets passed through layers of packaging, and caused devastating results. Afterwards, many limitations of traditional MPT models started to reveal and were received attention, which made the researchers find a better way to define the optimal allocation of assets. They gradually found the importance of exogenous variable, and started to focus on Factor configuration which could reduce the influence of parameter changes on the mean-variance model and consider other aspect (e.g., climate change and tax rate) that could have a large influence on the market.
Nowadays, there are a lot of platforms based on python that provides open-source, frameworks, quantitative strategies, and data origins that can help investors choose their suitable investment portfolio [10]. For example, pandas, as a Python frame of rich data structures and tools, is used for finance data calculating including but not limited to the calculating matrix, building models, and statistics data. These tools ameliorate data's hysteresis quality, Enable the model to respond to data changes promptly, improve data precision which can even give traditional MPT models new life [11]. Therefore, fully open data sources lower the threshold for asset allocation which makes innovation easier. Fig. 3 presents an example of multifactorial prediction.

Future prospect
The modern portfolio theory, under the conditions of science and technology development, is now turned to an intelligent stage from evolution stage based on factor allocation through big data. On this basis, simple and useful Python becomes a mainstreaming language configured by many quantization platforms that are researching asset allocation. A series of research achievements produced by using Python may be approximately contributed to configuration models and theories through massive and different methods, and this great improvement is insufficient accuracy by conventional models. In addition, it provides diversified investment schemes for investors. However, according to recent research, the Modern Portfolio Theory and allocation are not deeply concerned by people. It can be ascribed to the high ratios of resident housing and bank deposit in some conservative and not sound enough countries (e.g., China). With this in mind, it is still a big challenge to generalize this theory.

Conclusion
In summary, this paper investigates optimal portfolio allocation based on Markowitz portfolio theory. Specifically, relevant knowledge and models, state-of-art application of modern portfolio theory based on Python, and its advantages and limitations are demonstrated. According to the analysis, python greatly facilitates the calculation of expected return and portfolio variance in Markowitz's portfolio theory, and can quickly find the optimal portfolio, which is of great value for the application of Markowitz's portfolio theory in China's financial market. In the future, it will be more valued by financial analysts and emerging technology professionals, since it can combine the traditional financial theory with the new programming language, solve the financial problems more quickly and efficiently. Overall, these results offer a guideline for applying AI and big data to financial investment analysis.