We consider dynamical systems with a large number of agents that can store and trade a commodity such as electricity. We present a price-formation model consisting of constrained mean-field games where the price is a Lagrange multiplier for the supply vs. demand balance condition. We illustrate the model using real data of daily energy consumption in the UK. Then we present a Fourier approximation method for the solutions of first-order nonlocal mean-field games. We approximate the system by a simpler one that is equivalent to a convex optimization problem over a finite-dimensional subspace of continuous curves. Time permitting, we discuss possible applications to price formation problems where prices depend on state and time.