  We consider the mean-field game price formation model introduced by Gomes and
Sa\'ude. In this MFG model, agents trade a commodity whose supply can be
deterministic or stochastic. Agents maximize profit, taking into account
current and future prices. The balance between supply and demand determines the
price. We introduce a potential function that converts the MFG into a convex
variational problem. This variational formulation is particularly suitable for
machine learning approaches. Here, we use a recurrent neural network to solve
this problem. In the last section of the paper, we compare our results with
known analytical solutions.
