## 3 P2P Trading Platform
### Trading Strategies and Determination of Optimal Quantities
#### 3.1.1 Strategy I: Rule-Based Zero Intelligent Strategy  
The zero intelligent (ZI) strategy models the behavior of the market participants as \"zero intelligent\" by using a random criterion to generate the bid values. The main intuition behind using the ZI strategy is to generate the bid/ask signals within the limits of the utility values. The major advantage of using such a strategy is its constrained nature between the utility price and the FIT. Each prosumer will initialize the ask value, which cannot be higher than the utility tariff. Similarly, each customer will place a bid value that is greater than or equal to the FIT. This ensures a positive welfare for the participating customers/prosumers [11]. Mathematically, for any interval \(\Delta t_{i}\), the price signals generated using the ZI strategy are given as follows:  
\[B_{i\Delta t_{i}} =U[F_{\Delta t_{i}},R_{\Delta t_{i}}] \tag{8}\] \[A_{i\Delta t_{i}} =U[F_{\Delta t_{i}},R_{\Delta t_{i}}] \tag{9}\]  
Figure 5: Heat map for the power of the PV system for varying irradiance and temperature levels.  
where \(B_{i,\Delta t_{i}}\) and \(A_{j,\Delta t_{i}}\) represent the bid and ask price of the \(i\)th customer, and \(j\)th prosumer, respectively, for the \(\Delta t_{i}\) market interval, \(F_{\Delta t_{i}}\) and \(R_{\Delta t_{i}}\) are the FIT and retail values for the interval \(\Delta t_{i}\), respectively, and \(U\) represents a uniform random number in the \([0,1]\) range.  
Figure 6 shows the initialization of the bids using the ZI strategy. From the figure, it is evident that the prosumers cannot put an ask price that is higher than the retail tariff. Similarly, the customers will initialize a bid value that is greater than the FIT. This ensures that, for the matched orders, the participants will get a better price compared to the utility value. After receiving the bid values for each customer, the next step is to use a matching mechanism for the proposed strategy. For finding the matched orders, equilibrium matching (EM) is proposed in this research.  
* _Equilibrium matching:_ EM sorts the bid values of the customers in descending order, whereas the ask prices for the prosumers are arranged in an ascending manner. P2P orders will be matched if the bid value is greater than or equal to the ask price [28]. This process will continue for all the P2P orders until the market interval terminates. Once the matched orders are determined using EM, the next part is to determine the trading price and quantity for each matched order.
* _Determination of the price and traded quantity:_ Once an order is matched using EM, the rule-based ZI strategy determines the P2P price as follows: \[p_{ij}=\begin{cases}\dfrac{1}{2}(B_{i,\Delta t_{i}}+A_{j,\Delta t_{i}})&\text {if }B_{i,\Delta t_{i}}\geq A_{j,\Delta t_{i}}\\ 0,&\text{if }B_{i,\Delta t_{i}}<A_{j,\Delta t_{i}}.\end{cases}\] (10) where \(p_{ij}\) represents the P2P price for the matched orders. The traded quantity can be determined based on the demand \(D_{i}\) and the excess renewable power \(G_{j}\) of the \(j\)th prosumer, which is defined as follows: \[t_{ij}=\begin{cases}\min(D_{i,\Delta t_{i}},G_{j,\Delta t_{i}})&\text{if }B_{i,\Delta t_{i}}\geq A_{j,\Delta t_{i}}\\ 0,&\text{if }B_{i,\Delta t_{i}}<A_{j,\Delta t_{i}},\end{cases}\] (11) where \(t_{ij}\) represents the traded quantity between \(i\)th customer and \(j\)th prosumer. Rule-based determination for the ZI strategy is a simple yet effective way of determining the optimal set of quantities for the matched contracts. However, it neglects the individual preference of the prosumers/ customers towards determining the P2P price and amount of energy traded. This can impair the performance of the P2P network, especially under the constrained environment. The second strategy, a GT approach, provides an alternative to the simple rule-based determination to incorporate the individual preference of the market participants.  
Figure 6: Initialization of the bid/ask values using the ZI strategy.