Due to the increased cost pressure on power generation and trading companies, caused by the operation in the free market for electrical energy, a cost-efficient management of the risks becomes more important. As a result of the liberalization of the power markets the companies are exposed to higher uncertainties within the power generation and trading planning, e.g. the volatility of the electrical energy prices. Additionally, bankruptcies of companies in the energy sector have shown that losing trading partners can cause a great disprofit, if not hedged appropriately. Together with risk management regulations the need for risk management is increasing. The goal of this work is the analysis of risks concerning the generation and trading planning maximizing the contribution margin while taking the risks into account. The system which needs to be considered for a generation and trading planning is presented. For each of the risks analyzed here possible hedging instruments for the companies in the energy sector are presented. A method and an interpretation of modeling the risk in an optimization are given. Exemplary investigations show that the risk can be controlled in a power generation and trading planning using a Lagrange relaxation.