This paper presents an approach to the power management of nanogrid clusters assisted by a novel form of peer-to-peer (P2P) electricity trading. DC nanogrids have lower power loss in real time and are suitable for P2P trading. Here, cost of electricity for clusters involving different kinds of photovoltaic (PV) power production (as a secondary source) is reduced by a newly proposed P2P trading scheme. For power management of individual clusters, multi-objective optimization is applied to minimize simultaneously total power consumption, grid power consumption, and total delay incurred locally by scheduling. The temporal surplus of self-supplied PV power of a cluster can be sold through P2P trading to another cluster subjected to a temporal power shortage. In P2P trading, a cooperative game model is used for buyers and sellers to maximize their welfare. To increase P2P trading efficiency, prediction of load demand and PV power production is considered for power management of each cluster to resolve instantaneous imbalances between load demand and PV power production. A gated recurrent unit network is used to forecast future load demand and PV power production in nanogrid cluster could reduce electricity cost by 29.2%.