Trading risk control model of electricity retailers in multi‐level power market of China

The decision‐making and risk assessment of electricity purchase and sales is the key to adapt to the electricity market for independent electricity retailers in China. This research carried out the purchase and sales risks of electricity for electricity retailers and constructed the multi‐level market purchase and sales combination optimization model. Based on the portfolio optimization theory, the conditional value at risk theory (CVaR) was proposed. Based on the evaluation index about the conditional risk profit and CVaR, electricity retailers purchase and sales combined optimization model has been constructed to explore the impact of purchase and sales risks by different factors in multi‐level electricity market. The example analysis was carried out by the fixed spread mode and the linkage spread mode. The results showed that the mathematical mean and variance of market spread had great influence on the electricity purchase and sales combination. Especially in the mature electricity market, the mathematical mean of spread and risk in medium‐ and long‐term market was smaller than that in spot market, and the best point of the electricity purchase and sales combination was shown on the smallest value of CVaR, while the electricity purchase and sales combination was optimal under limited conditions.


| INTRODUCTION
Currently, electricity reform is in the early stage of development in China. The main profit model of the electricity retailer is to sign the power sales contract with the retail market users and then use this as the basis for the load demand of the wholesale market to purchase electricity from the annual market and the monthly market, respectively. With the development and improvement of the spot market, the electricity retailers also need to participate in the spot market to purchase electricity. Moreover, the obvious trading links and the differences of the power market bring different degrees of investment risk for electricity retailers at various levels. 1 Minimizing the risk under the revenue target effectively and configuring the electricity investment portfolio is the focus of the electricity retailers. 2,3 Current researches are mainly on electricity retailers, while there are not many studies on the sales and the sales of electricity retailers from the perspective of risk. The current research can be divided into the following points: 1. Research on electricity purchase and sales of electricity retailers. Kirschen 4 studied the user's participation in the power retail market from the demand side and proposed | 2757 YU and SUn relevant technical means and market tools, which laid the foundation for the follow-up retail market. Anderson and Philpott 5 studied the bidding behaviors in the electricity market and constructed a bid optimization model. Based on Anderson's research, Fleten and Pettersen 6 proposed a cost-optimized bidding optimization model based on the Nordic electricity market and proposed a bidding strategy for price-receiving power companies. However, the shortcoming of these studies is that they only studied the trading technology level and did not provide risk-related research. 2. Research on trading risk of electricity sales retailers. In general, the degree of possible loss is more concerned and worthy of study than other indicators. 7 Therefore, it is more suitable to describe the risk of trading. For the research on the risk of electricity retailers, Martello 8 and others carried out risk assessment and decision analysis for the electricity retailers from the user demand side management analysis, based on risk uncertainty and price quota curve and utility theory, then built different simulation scenarios and considered fixed prices and real-time electricity price contracts. Kettunen et al 9 and others studied the impact of price and demand differences on the risk appetite of electricity retailers, thus affecting the electricity purchase contract portfolio strategy. Nojavan et al 10 and others proposed pricing decisions for fixed, timesharing, real-time electricity sales contracts, etc, from the perspective of various electricity generation sources on the electricity purchase side, considering wind, light, and hydrogen storage energy sources. Wei et al 11 considered both distributed energy and adjustable load to construct a new scheduling optimization model.
Through the research on the purchase and sales of electricity sold by the electricity retailers in the wholesale market and the retail market, 12,13 it can be found that there were different degrees of risk in multiple links. The electricity retailers needed to set the user subsidy spread and multi-level market electricity purchase combination to estimate and control the risk of purchase and sales. [14][15][16] However, most studies considered only on the medium-or long-term contracts of a single electricity source, or only proposed pricing decisions, thus had insufficient research on risk. This paper will analyze the profit risk from both purchase and sales sides of electricity and use the portfolio optimization theory to optimize the purchase and sales combination in the multi-level electricity market, which will help the electricity retailers to determine the electricity distribution plan, to improve the average return as large as possible, and to decrease risks as large as possible; that is, a multi-objective optimization model will be proposed in multi-level electricity markets. The main research innovations include the following: 1. The paper constructs a multi-level market purchase and sales combination optimization model based on the current new regulations for power market reform in China. 2. The paper constructs a CVaR-optimized model for purchase and sales of electricity retailers and designs two different scenarios, proposes the application of CVaR optimization theory and designs two different scenarios, and builds electricity combination optimization model. 3. Through the case analysis and sensitivity analysis, the effectiveness of the optimization model is verified, which can help the electricity retailers to determine the optimal combination of market power under the minimum risk.
The structure of this paper is as follows: Section 2 summarizes the portfolio optimization model as the theoretical basis of the thesis research. Section 3 analyzes the strategy of purchasing and selling electricity for electricity retailers in multi-level market. The transaction model is constructed in two dimensions, and the fixed price difference mechanism and the linkage price difference mechanism are designed. Section 4 is the analysis part of the example. The actual data and simulation data are collected to verify the model constructed in this paper. Section 5 presents the main conclusions.

| PORTFOLIO OPTIMIZATION THEORY
The mean-variance model 17 is a basic portfolio optimization model that uses the mean and variance distribution of the return distribution to represent the expected returns and risks and to determine the optimal portfolio for a given target. If the combined expected return is the abscissa and the risk index is the ordinate, it can constitute the income-risk plane of the portfolio, as shown in Figure 1, which reflects the relationship between portfolio returns and risk. Among them, the set of points on the curve and within the curve is called a feasible set, which corresponds to a certain portfolio, called a feasible portfolio. For curve ACB, at all given risk levels , on the top, the point is the upper half of the curve where the expected return is the largest. That is, the CA segment of the curve, which is called the effective frontier of the feasible portfolio set. It is a subset of the feasible set, and it can be said that the portfolio is the most optimal solution on the effective frontier curve. An effective frontier is an intuitive tool that provides decision-makers with a clear decision between risk and expected return.
The conditional value at risk theory 18 (CVaR) is derived from VaR and refers to the conditional mean of loss exceeding VaR, reflecting the average potential loss that may be exceeded by the VaR value. The schematic diagram of CVaR is shown in Figure 2.
The formulas and description for VaR and CVaR can be found in reference. 19 Comparing the two theories of VaR and CVaR, CVaR has obvious advantages, which can be summarized as two points: Firstly, conceptually, CVaR is not a single quantile, but the average of tail loss, only the tail loss greater than VaR can be estimated and calculated, so it is sufficient to measure the tail loss. Secondly, CVaR is a consistent risk measure and it can be applied to portfolio optimization for any distribution pattern. This is also the main point of its superiority to VaR.

STRATEGY ANALYSIS OF ELECTRICITY RETAILER IN MULTI-LEVEL MARKET
There are many types of electricity retailers now in China. This paper focuses on the strategy of purchasing and selling electricity for independent electricity retailers. Since an independent electricity retailers does not have a physical industry, its role in the electricity market is more similar to that of an intermediary, and the main benefit is also derived from the intermediate spread. In the current electricity market environment, it is mainly based on the catalog price, which is the spread model, and is a means used during the transition of the electricity market from catalog price to market-based electricity price. 20,21 For a electricity retailer, the purchase and sales of electricity combination strategy can be divided into two parts, a multi-level market electricity purchase combination strategy and a multi-type user sales combination strategy.

| Multi-level market electricity purchase combination model
According to the current regulations in China's electricity market reform document and the time dimension, the power market can be divided into three major categories: medium-and long-term market, spot market, and futures market. Among them, the medium-and long-term mainly include the annual trading market and the monthly trading market. The spot market includes the day-to-day market, the intraday market, and the real-time market. In the multi-level electricity purchase market, the main considerations here are divided into annual market, monthly market, daily market, and real-time market. The trading types of each market are different, and the income expectation and price fluctuation risk are also different. 22 In general, medium-and long-term market income expectations are the lowest, followed by the day-to-day market, and finally the real-time market. For the price fluctuation risk, the medium-and long-term market risk is the smallest, followed by the day-to-day market, and the real-time market has the greatest risk. The electricity retailers can consider a variety of uncertain market factors, government regulation, their expected returns, and other complex conditions to choose purchase electricity in multiple markets and allocate the proportion of electricity purchases. Finally, they can achieve maximum returns and spread risks.
The electricity retailer combines the purchased electricity at all levels according to the total demand forecast. Assuming that the predicted demand on the user side is Q; the annual market share of electricity purchased is x 1 , the monthly market share of electricity purchase is x 2 , the market share of electricity purchased a few days ago is x 3 , the real-time market purchases is x 4 , and ��� ⃗ x T = x 1 ,x 2 ,x 3 ,x 4 ∈ X represents a set of purchased electricity combination ratio vectors, where X indicates the electricity purchase combination feasible set, then the proportion of purchased electricity meets the following conditions: Assume that the spread of the sales company in the annual market is y 1 , the monthly market clearing spread is y 2 , the spread between the market and the market is y 3 , the real-time market spread is y 4 , the catalog price is p 0 , the price of electricity purchased at all levels of the market is

Combined loss
Loss probability O

VaR
Maximum loss CVaR p 0 + y i ,i = 1,2,3,4. Usually, in a market environment where supply exceeds demand, the spread is positive, indicating that the market price is rising; in the market of short supply, when the spread is negative, the market price is declining. The formula for calculating the electricity purchase cost of the electricity retailer in the wholesale market is: Regardless of the user difference in the electricity sales market, it is assumed that the spread between the electricity retailer and the user is a fixed value m 0 , that is, the average price of the user's electricity is p 0 + m 0 . In general, m 0 is negative. Regardless of the deviation between actual and predicted power, only the impact of market electricity price fluctuation is calculated on the value at risk of the electricity retailer, so that the combined income function of the electricity company can be calculated: The loss function of the electricity retailer is:

| Multi-class user sales combination model
In the multi-user market, differentiated user packages 23 are used for different types of users, which leads to differences in retail prices of electricity, which in turn affects the operating income of the electricity retailers. For the user spread, it can be divided into the following situations: 1. Designing the spread without considering the electricity purchase market In this case, the design of the user spread package has nothing to do with the revenue of the electricity purchase market, and the user spread is prioritized. It is assumed that the user spread market is divided into four categories, specific division based on references. 19 The market share of the premium market users is 1 , the spread is m 1 , the proportion of senior market users is 2 , the spread is m 2 , the proportion of electricity in the general market users is 3 , the spread is m 3 , the proportion of secondary market users is 4 , and the spread is m 4 . Assume that the wholesale market unit purchase spread is y 0 , the total user demand for electricity is Q, so the user's market electricity sales income function is: The loss function of the electricity retailer is: 2. Designing the spread considering the electricity purchase market It is possible to decrease the risk of business decision mistakes or the failure of bidding in the wholesale market by binding the spread between the user market and the wholesale market. On the basis of the market spread at the wholesale level of electricity purchase, a certain percentage is taken as the user spread, combined with the result of the spread of the electricity purchase market. Assuming that the annual market spread is 1 , the monthly market spread is 2 , the market spread extraction ratio is 3 , and the real-time market spread extraction ratio is 4 . It should be noted that the user spread extraction is only based on the negative value of the wholesale market spread, that is, the ratio of the price reduction space, so that the profit function of the sales company is: The loss function of the electricity retailer is:

| CVaR-optimized purchase and sale combination model
In order to solve the problem of purchase and sales electricity combination of electricity retailers in multi-level market, the CVaR theory is used to construct a electricity retailer's electricity sales optimization combination model. Through the analysis of the multi-category users' electricity sales market, it is known that the optimal electricity purchase combination results obtained under different spread mechanisms are different, and then, the research will be carried out separately:

Fixed spread mechanism
Under this situation, through the analysis of the electricity loss combination function of the electricity purchase and the loss function of the electricity sales, it can be known that the electricity combination function of the electricity retailer is: In the above formula, � ⃗ y = y 1 ,y 2 ,y 3 ,y 4 represents the market purchase price combined vector, which is obtained from historical sample data or Monte Carlo simulation. 24 In order to facilitate calculations, while obtaining user spreads m of q Sample, we define �� ⃗ m = m 1 ,m 2 ,m 3 ,m 4 as the combined vector representing the user's spread. Then the definition formula of CVaR is: The estimated value of function F � ⃗ x, � ⃗ , is: By setting dummy variables z k (k = 1,2,...,q), function F � ⃗ x, � ⃗ , can be represented by a linear function, where z k is shown as follows: Then, optimization problems have been turned into linear programming problems. Under the CVaR constraint, the optimization problem of the smallest loss of electricity purchase and sales of electricity retailers is expressed as: In the formula, is a defined as the level of risk. By solving the model, it is possible to obtain the optimal purchase and sales combination of the electricity retailer. is the VaR value under the constraint of certain confidence level and risk level, which is also the maximum possible loss of the electricity retailer.

Linkage spread mechanism
Under this kind of situation, through the analysis of the electricity loss combination function of the electricity purchase company and the loss function of the electricity sales combination, it can be known that the electricity combination function of the electricity retailer is: In the above formula, y T = y 1 ,y 2 ,y 3 ,y 4 is the combined vector representing the market purchase price, which is obtained from historical sample data or Monte Carlo simulation y of q Samples. In order to facilitate the calculation, while obtaining the user spread difference of q Sample, we define T = 1 , 2 , 3 , 4 as the combined vector representing the user's spread. Then the definition formula of CVaR is: The estimated value of function F � ⃗ x, � ⃗ , is:

YU and SUn
By setting dummy variables z k (k = 1,2,...,q), function F � ⃗ x, � ⃗ , can be represented by a linear function, where z k is shown as: Then, optimization problems have been turned into linear programming problems. Under the CVaR constraint, the optimization problem of the smallest loss of electricity purchase and sales of electricity retailers is expressed as: In the formula, is a defined risk level. By solving the model, it is possible to obtain the optimal purchase and sales combination of the electricity retailer. is the VaR value under the constraint of certain confidence level and risk level, that is, the maximum possible loss of the electricity retailer.
It should be noted that in the actual calculation process, the unit electricity consumption is usually targeted in order to facilitate understanding and calculation; that is, the total electricity consumption is not considered. Then, the electricity retailer and the user prioritize the spread, that is to say, in general, the user category composition and the spread information on the sales side can be obtained in advance, and then, the combination optimization problem can simplify the purchase electricity combination x T . The model is solved by the GAMS software using CPLEX 11.0 linear solver from ILOG_solver.

| Analysis of fixed spread mode
In the actual operation in electricity market, the spread of the user contract is determined in advance. Firstly, the first kind of spread mechanism is simulated and calculated in the paper. In order to simplify the calculation, the original model is simplified, and the unit electricity gain and loss is taken as the research object, so it is not affected by the market electricity demand. Secondly, the classification of the user market is also based on the user evaluation results, so that the specific division results and the spread of users at all levels are shown in Table 1.

Initial situation of the electricity market
According to the analysis of the electricity purchase market, it is assumed that the electricity price fluctuations of all levels are subject to a normal distribution, and the average and variance figures of the electricity price spreading at all levels are estimated. The results are shown in Table 2.
Based on the estimated parameters, through the Monte Carlo simulation method, we randomly generate four groups of 100 market spread samples according to the normal distribution, providing data support for subsequent optimization calculations. Then, we calculate the optimal electricity distribution ratio and value at risk of each market under the confidence level = 0.95 in the current environment. In order to simplify the calculation process and combine the connotation of value at risk, we determine the optimal electricity distribution ratio of each market and maximize the total return while the value at risk is the lowest.
While the condition that the electricity distribution at all levels is unconstrained and the confidence level is 0.95, the expected returns under different electricity distribution scenarios and the results of VaR and CVaR are shown in Table 3.
In the case where the confidence level is 0.95, the calculation shows that the optimal electricity distribution result is (1, 0, 0, 0); that is, all the electricity is purchased from the annual market. At this time, the expected profit of the sales company is 0.00176261 Yuan/kWh. When the VaR value is 0 Yuan/ kWh, there is 95% probability that the sales company loses less than 0, and the CVaR result is 0.004856 Yuan/kWh, indicating that the average potential loss is 0.004856 Yuan/kWh. Figure 3 shows the mean-CVaR effective frontier curve. It can be seen from the Figure that the larger the expected return, the smaller the conditional risk value, which seems to be different from the traditional portfolio result, but this is reasonable. By analyzing the expectations and variances of the four electricity markets, the expected return of the annual market is the highest, and the risk is the smallest, which is obviously superior to other markets. Therefore, under the unconstrained conditions of electricity distribution at all levels, the annual market expects the most profit, and the risk is smallest; the largest advantage of the portfolio appears at point A; that is, the distribution ratio is (1,0,0,0). The probability of this in the mature electricity market is extremely small, but it cannot be ruled out in the electricity market where supply exceeds demand; this extreme phenomenon will exist and provide information for speculators.
In the previous research, most scholars have studied the future trend of China's power market based on the mature power market. However, due to the particularity of China's national conditions, the power market reform will take more time to improve. The risk that may exist in the initial stage is more worthy of study. The results in this example indicate that in the initial stage, due to the imperfect stock market, the market allocation is biased toward the medium-and long-term market, which is not conducive to the healthy development of the electricity market. The risk arising from the situation suggests that market managers should be constrained by setting the upper and lower limits of the proportion of electricity purchased at all levels of the electricity market.

Mature electricity market scenario
In the actual electricity market, the actual purchase of electricity at all levels of the market is not completely dominated by the electricity retailer. The electricity distribution studied here is only the expected electricity distribution of the electricity retailer. In current environment, due to the instability of the spot market, the electricity price is high; electricity retailers are more inclined to buy from the medium-and long-term markets. However, as the electricity market continues to improve, the spot market's revenue expectation will be greater than the medium-and long-term contract market, but the risk is still greater in the spot market. In this scenario, the electricity retailer needs to consider more about the electricity purchase combination. It is assumed that the electricity price fluctuations at all levels of the electricity market are still subject to a normal distribution, and the average and standard deviation of the electricity price spreads at all levels is estimated. The results are shown in Table 4.
In the case of unconstrained market at all levels, we choose the confidence interval as β = 0.95 and = 0.9, then calculate the optimal results of the electricity distribution in both cases. The corresponding expected returns and VaR, CVaR values are shown in Table 5.
T A B L E 2 Distribution data of electricity price spread in the initial electricity market (Yuan/kWh) In order to obtain a curve of the combined expected return with the CVaR value, the risk level value has been changed and the above calculation has been repeated. Take the risk index CVaR as the abscissa, and the expected return as the ordinate to obtain the expected-CVaR effective leading-edge curve as shown in Figure 4.
It is clear from Figure 4 that under the same electricity market condition, the effective frontier curves of the 95% and 90% confidence levels are significantly different. Since the actual risks and benefits cannot be infinite, the risk level has a little interval scope, and when the risk level is too low, the model has no effective solution; when the risk level is too high, the market-optimized combination point will have the first scenario result, that is, the optimal combination is (1,0,0,0).
Comparing the two results, we can find that as the confidence level increases, the risk value also increases. It can be said that the confidence level is an indicator of the risk aversion of investors. Under the same conditions, if the confidence level is low, the sales company pursues high returns. The proportion of the spot market will increase, indicating that the electricity retailer is risk-oriented and tending to choose the electricity purchase decision with high profit and high risk; on the contrary, when the electricity retailer is risk-averse, the sales company will increase. The retailer purchasing electricity in the long-term market tends to choose electricity purchase decisions with low returns and low risks.

Sensitivity analysis
According to the calculation results of the user market, in this example, the average spread of the user market is −0.01574 Yuan/kWh. Under the premise of the optimal electricity purchase combination, the expected value of the income is affected by the user market spread as shown in Figure 5.
It can be seen from Figure 5 that the impact of the spread of the four user markets on the expected value of the income is different, and the influence of the advanced user market is the largest. The elasticity coefficient of the advanced user market spread to the expected value of the income is calculated as −0.4669; in the superior user market, the elasticity coefficient of the market spread to the expected value of the income is −0.432; then in the ordinary user market, the elasticity coefficient of the market spread to the expected value of the income is −0.4076; finally, in the secondary user market, the elasticity coefficient of the market spread to the expected value of the income is −0.0672.
Combining the optimal electricity purchase combination and sensitivity results analysis of various scenarios, we can see that different risk-biased electricity retailers will choose T A B L E 4 Distribution of electricity price spreads in mature electricity markets (*10 −3 Yuan/kWh)  different risk levels and thus get different optimal electricity purchase combinations. As mentioned in the previous article, the purchase of electricity portfolio is only an expectation of the electricity retailer to purchase electricity in the future electricity market. It can provide effective information and data support for the electricity purchase company to make electricity purchase decisions, but in actual operation, the proportion of electricity purchase in all levels of market is not completely controlled by the electricity retailer, especially in the spot market. In more cases, it is entering the spot market to purchase electricity under the electricity deviation. Therefore, for the electricity retailer, it is necessary to allocate the proportion of electricity purchase in the medium-and long-term electricity market and reduce the risk of purchasing electricity in the spot market, so as to effectively increase the company's maximum profit within the acceptable risk range.

| Linkage spread mode analysis
For the user linkage spread model considering the revenue of the electricity purchase market, only the mature electricity market environment is analyzed here, assuming that the parameters are the same as those in Table 4. For the setting of the user spread extraction ratio, combined with the fixed spread mode analysis, the setting ratio is mainly divided into two types of markets, one is the medium-and long-term electricity market, and the other is the spot market. The specific settings are shown in Table 6.
Similarly, the normal distribution in the previous example is used to randomly generate four sets of 100 market spread samples and to provide data support for subsequent optimization calculations. We calculate the sample of the spread and obtain the expected return of the electricity purchase market and the user market, as shown in Figure 6.
It can be seen from Figure 6 that the expectation of electricity purchase and the expectation of electricity sales in the medium-and long-term electricity market are significantly lower than those in the spot market. The electricity spread between the medium-and long-term electricity market is also lower than that of the spot market; that is, the expected profit in the medium-and long-term market is less than the spot market income. However, in terms of standard deviation, the fluctuation of the spot market is significantly larger than the medium-and long-term markets, which basically conforms to the trend of electricity price distribution in mature market.
Under the unconstrained situation of all levels of market, the confidence interval is chosen to be 0.95, and the optimal result of electricity distribution is calculated. The corresponding expected return and VaR, CVaR values are shown in Table 7.
In order to obtain the curve of the combined expected return with the CVaR value, the risk level value is changed, and the above calculation is repeated, with the risk index CVaR as the abscissa and the expected return as the ordinate. The expected-CVaR effective leading-edge curve is obtained, as shown in Figure 7. It can be seen from the Table 7 and Figure 7 that at the 95% confidence level, the risk of the electricity retailer in the linkage mode is partially transferred to the user side; the effect of the high expected return of the spot market is greatly reduced. It can be understood that even if the spot market has high returns, the dividends equally distributed to users are also high, which leads to the reduction of the sales revenue of the electricity retailer in the spot market, coupled with the high risk of the spot market. These factors will cause the sales companies to reduce the electricity distribution in the spot market. However, for the medium-and longterm market with stable income and low risk, especially the annual market, the weakness of the difference in earnings is compensated by the low risk in the linkage spread model, and the dividend is low but the dividend distributed to the user is not low. The difference between the income and the spot market is not obvious, so the proportion of electricity distribution in the annual market is very obvious.
Through optimization calculations, it is found that under the condition of minimum risk value, the expected income of the electricity retailer is only 0.0029833 Yuan/kWh, and the risk value is also very low, only 0.0001805 Yuan/kWh, indicating that the risk is very small.
Comparing the fixed spread model and the linkage spread model analysis results, the expected-risk situation of the two results is shown in Figure 8. Figure 8 shows the comparison of two kinds of spread modes, in which fixed 1 refers to the optimal result of the fixed spread mode, linkage 2 is the optimal result of the linkage spread mode, and fixed 2 refers to the operation result of the same electricity distribution with linkage 2; linkage 1 is the result of the calculation of the same electricity distribution as the fixed 1. It can be seen from the Figure that the risk value of the linkage spread model is significantly lower than the fixed spread model. For example, the minimum risk of the fixed spread model is significantly higher than the risk of the two linkage models; but the benefit of the linkage model is also significantly smaller than the fixed pattern. It can also be understood that the fixed spread model is applicable to risk-appropriate sales companies, while the linkage spread model is applicable to risk-averse sales companies.
Under the two different price difference models, the conclusions obtained are obviously different. Although the overall benefit of the fixed spread model is significantly higher than the linkage spread model, the linkage spread model can reduce the risk of the sales company itself through risk transfer and expectation improvement. In the previous research, most scholars carried out research on fixed models. In the early stage of power market reform in China, the spread model will last for a long time when the reform of transmission and distribution prices is not perfect, so how to reduce risk through price linkage is worth studying.

| CONCLUSION
From the perspective of risk control, this paper studies the behavior of electricity retailers in purchasing and selling electricity, mainly based on the risk value theory and conditional risk value theory commonly used in portfolio optimization theory to optimize the electricity purchase company's electricity purchase combination in multi-level electricity market. Firstly, the paper summarizes the theory of portfolio optimization and focuses on CVaR theory, respectively.