A Financial Model for a Multi-Period Portfolio Optimization Problem with a variational formulation