  With the proliferation of distributed generations, traditional passive
consumers in distribution networks are evolving into "prosumers", which can
both produce and consume energy. Energy trading with the main grid or between
prosumers is inevitable if the energy surplus and shortage exist. To this end,
this paper investigates the peer-to-peer (P2P) energy trading market, which is
formulated as a generalized Nash game. We first prove the existence and
uniqueness of the generalized Nash equilibrium (GNE). Then, an distributed
online algorithm is proposed to track the GNE in the time-varying environment.
Its regret is proved to be bounded by a sublinear function of learning time,
which indicates that the online algorithm has an acceptable accuracy in
practice. Finally, numerical results with six microgrids validate the
performance of the algorithm.
