A contract for difference is a medium and long-term financial contract, which can be used in the electricity market to lock the electricity price in advance and avoid the risk of electricity price fluctuations in the spot market. The construction of the domestic power spot market has just started. With the release of relevant policies and the gradual improvement of the market structure, it is urgent to design a corresponding trading mechanism to ensure the smooth transition of the market. The current day-ahead transactions, real-time transactions and other short-term transactions for distributed power generation, on the one hand power load forecasting, electricity price demand response and other related technologies need to be further improved, on the other hand due to the randomness and uncertainty of distributed energy, participating in the short-term spot market has large price fluctuations, which is not conducive to the stability of the electricity market, and it is also not conducive to the consumption of distributed energy. Aiming at the above problems, this paper uses the characteristics of CFDs to restrain market power to design a distributed energy trading mechanism to achieve the purpose of energy saving and emission reduction.