The matching principle is: arrange all buy orders and sell orders according to the quotation level. If the number of buying orders above this price is equal to the number of selling orders below this price, then this price is the opening price.
The closing price of the last transaction before closing is the closing price.