**1. Introduction**

Over the last few decades, the installed power-generation capacity of China has exploded, especially for hydropower capacity, increasing from 20 GW in 1980 to 352 GW in 2018 [1,2]. However, wasted hydropower is often associated with the rapid deployment of hydropower because of a lack of energy planning, delayed construction of power grid, and multiple interest game [3]. According to official statistics, wasted hydropower exceeded 28.7 terawatt hours (TWh) and 31 TWh, respectively, in Sichuan and Yunnan in 2016 [4], which are the two hydropower-dominated power grids. This is a very serious problem and also partly motivated the electricity market reform. Therefore, the "Opinions on Further Deepening the Reform of the Electric Power Systems: Document No. 9" was promulgated in March 2015 by the State Council and the Central Committee of the Communist Party [5].

Since the new round of electricity market reform in 2015, various regions and provinces in China have created medium- and long-term electricity markets, and a grea<sup>t</sup> deal of progress has been made. Two regional trading centers in Beijing and Guangzhou, as well as provincial trading centers in each province, have been set up to handle cross-provincial, cross-regional, and intra-provincial transactions. From the perspective of the whole country, the market reform has been deepened year by year due to positive factors, such as diversified market entities, rich trading varieties, and diversified market services. In 2018, the total amount of electricity traded (including the generation rights traded) in the national electricity market was 2065.4 billion kilowatt hours, up 26.5% from the previous year. The proportion of electricity traded in the market was 30.2% of the total electricity consumed by the

whole society, 4.3 percentage points higher than in the previous year. The proportion of electricity traded in the market was 37.1% of the electricity sold by power grid enterprises [6].

Yunnan Province, as one of the first batches of comprehensive pilot provinces of electricity market reform, has always been in the forefront of domestic electricity market reform. After several years implementing successful operations, much progress has been made in, for instance, the market scale, the market supervision and the trading mechanism. By the end of December 2018, a total of 7662 market entities had completed registration and gained access. This scale is three times that of the initial stage of the Yunnan electricity market (YNEM). In 2018, more than 85 billion kilowatt-hours of electricity were traded in the provincial market, an increase of more than 21% from the previous year. Among this electricity, the proportion of clean energy trading electricity accounted for more than 97%, ranking highest in the country. Trading electricity accounted for more than 62% of the electricity sold in the Yunnan power grid (YNPG) [7]. This increase in electricity trading volume indicates an increase in market demand, which promotes the reduction of hydropower curtailment to a certain extent. In addition, medium- and long-term trading mechanisms are becoming increasingly mature, and trading varieties are abundant, providing diversified choices for market players [8]. As a pioneer in the new round of electricity market reform in China, the newly reformed YNEM has achieved initial results, where an increasingly mature, e fficient, and fair electric power trading market has been gradually established, which provides valuable experience for the construction of electricity markets in other provinces.

The market operators of the YNEM have been committed to enriching the construction of the trading mechanism. To further promote market competition, enrich trading varieties, alleviate information asymmetry, and improve trading e fficiency, the continuous bidirectional transaction (CBT) was designed and applied in the YNEM in 2018 [9], which is characterized by a sequential two-stage bidding process with real-time market information disclosure that integrates call auction (CA) and continuous double auction (CDA) [10,11]. The CBT is quite di fferent from the original trading methods in the YNEM. How to design and implement CBT business, such as bidding and market clearing, is a problem worth studying.

Research on electricity trading mechanisms attracts much attention. Many experts and scholars have done a grea<sup>t</sup> deal of work on this topic [12]. On the one hand, game theory, auction theory, and other mechanism design theories are widely used in power market design. Using game theory, Carlos Silva et al. designed a new mechanism. In the deregulated environment, efficiency (economic dispatch) can be achieved despite the information barrier of effective distribution of power production [13]. Based on the theory of signal game, Liu Z et al. took the degree of information interference as an important factor to evaluate the bidding mechanism and put forward a semi-random matching (GSM) incentive bidding mechanism [14]. In order to alleviate the market power of participants and improve the social welfare of the power market, Xiaoyan Zou took the social welfare contribution of each participant as the key factor of market clearing, paymen<sup>t</sup> and settlement, and transaction matching rules, and proposed a new double-sided auction mechanism [15]. Under the condition of satisfying the characteristics of mechanism design theory of individual rationality, incentive compatibility and paymen<sup>t</sup> cost minimization, Zou P et al. analyzed, derived and designed a customized pool-based market mechanism by using the economic mechanism design theory [16]. In order to institutionally stabilize the market, Chen Zhang and Wei Yan restricted the abuse of market power by restricting the arbitrage opportunities generated by multiple markets and developed a mechanism [17]. In order to realize the long-term stability of electricity price in the day-ahead electricity market [18–20], Ying Yu et al. designed an incentive contract menu. In the framework of a one-leader and multi-follower game, a bilevel Stackelberg game model was also proposed to find the optimal incentive mechanism [21]. On the other hand, with the development of power system, the design of power market in the environment of rapid penetration of renewable energy and distributed energy is also concerned [22]. Agalgaonkar et al. examined placement and penetration level of the distributed generations under the standard market design (SMD) framework [23]. Based on the indirect mechanism design framework, Khazaei and Zhao

aggregated renewable energy power generation companies in a two-settlement electricity market and designed the revenue distribution mechanism by solving the competitive equilibrium of the special market with transferable revenue [24]. Liu et al. discussed P2P power trading mechanisms based on auction and bilateral contract and analyzed their effectiveness in the future power distribution system, to reasonably manage power trading between users [25]. To develop strategies for the integration of prosumers into competitive electricity markets, Parag and Sovacool identified and discussed three potential retail markets related to the integration of retail power grid, peer-to-peer models, and retail community groups [26]. Relying on blockchain and CDA mechanism, Wang et al. proposed a decentralized electricity transaction mode for microgrids [27]. Mengelkamp et al. derived seven market components as a framework to build an efficient microgrid energy market [28].

Although there are a lot of studies on market mechanism, its literature and real application on integrated CA and CDA in the electricity market, which is dominated by medium- and long-term power energy trading, are relatively less. This paper aims to research and design the CBT and put it into operation in YNEM. To this end, the clearing model with the goal of maximum social welfare for the CBT is proposed, which is the theoretical basis of market clearing based on CBT trading rules. Correspondingly, based on the di fference and connection analysis of the two stages, the design of a two-stage integrated market clearing algorithm to ensure the data consistency and business continuity is also introduced. Moreover, the practical experiences in implementing the CBT-based electricity trading platform (CETP) are described. Finally, the practical application is analyzed, and the CBT mechanism, clearing model, algorithm, and platform construction experience mentioned in this paper may provide valuable insight for other power market constructions.

The rest of the paper is structured as follows. In Section 2, the continuous bidirectional transaction of the YNEM is briefly introduced. The two-stage integrated clearing model of the CBT is proposed in Section 3. Section 4 illustrates the design of the market-clearing algorithm of the CBT. Section 5 presents the architecture and some implementation strategies adopted in the CETP. The practical application of the CBT based on the CETP in the YNEM is shown in Section 6. Finally, conclusions are drawn in Section 7.

#### **2. Organization of Continuous Bidirectional Trading Mechanism**

Unlike the major electricity markets operated by Pennsylvania-New Jersey-Maryland(PJM), California Independent System Operator (CAISO), and Electric Reliability Council of Texas (ERCOT) in North America [29–31], British Electricity Trading and Transmission Arrangements (BETTA) in Great Britain [32] and Nord Pool Spot in Nordic Europe [33], the YNEM is dominated by mediumand long-term electrical energy transactions briefly described in Figure 1. Moreover, all trading contracts require physical delivery, which means that the final transaction results need to be checked by YNPG [34]. The continuous bidirectional transaction (CBT) is new to the YNEM; it was introduced in the beginning of 2018, and currently, this bidding scheme is applied to the monthly market, where electricity consumers and producers submit a set of price-volume pairs, indicating their willingness to buy and sell electricity for the next operating month [9]. The CBT, together with the original bilateral transaction and matching transaction, constitute the main transaction varieties in the monthly market.

The CBT is a multistage double auction with numerous buyers and sellers, where the following rules are applied:


Exchange (KMPEX). The results include the market clearing prices (MCPs) of this stage and bid matchings according to the submitted bids [35]. Orders with remaining unmatched volume will enter the second stage first with the same timestamp.


**Figure 1.** Process of the medium- and long-term electrical energy transactions in the Yunnan electricity market (YNEM).

The organizational process of the CBT is shown in Figure 2. The regular schedule of each stage listed in the figure may be adjusted and disclosed to market participants before the transaction is actually carried out.

**Figure 2.** Flowchart of the continuous bidirectional transaction (CBT).

#### **3. Two-Stage Clearing Model of the CBT**

In this paper, the expected total revenue of buyers and sellers is regarded as the whole social welfare (also denoted as 'surplus') from the auction [15,35,41]. The CBT is also an auction mechanism maximizing the whole social welfare, which is equivalent to maximizing the expected total revenue of sellers and buyers under the following restrictions. The market-clearing model for the CBT can be described as follows.
