We propose and analyse a method based on the Riccati transformation for solving the evolutionary Hamilton–Jacobi–Bellman equation arising from the dynamic stochastic optimal allocation problem. We show how the fully nonlinear Hamilton–Jacobi–Bellman equation can be transformed into a quasilinear parabolic equation whose diffusion function is obtained as the value function of a certain parametric convex optimization problem. Although the diffusion function need not be sufficiently smooth, we are able to prove existence and uniqueness and derive useful bounds of classical Hölder smooth solutions. Furthermore, we construct a fully implicit iterative numerical scheme based on finite volume approximation of the governing equation. A numerical solution is compared to a semi-explicit travelling wave solution by means of the convergence ratio of the method. We compute optimal strategies for a portfolio investment problem motivated by the German DAX 30 index as an example of the application of the method.