The potential of end-users to modify their consumption pattern makes them an interesting resource for providing energy flexibility in energy communities. Thus, active end-users require sufficient incentives and automated trading and management schemes. In order to enable increased small-scale end-users participation for flexibility service provision, a new design for flexibility trading is required to model the behavior of different agents and their interactions in energy communities. The novelty of our work lies in proposing an iterative game-based approach in which all agents – consisting of the distribution system operator (DSO), aggregators, and customers– can determine their decision variables to optimize their own objective functions ...