In order to better link the stochastic diffusion stochastic differential equation with securities investment, this paper proposes a securities portfolio optimization method of the stochastic diffusion stochastic differential equation. In this paper, the stock Shanghai composite index is taken as the research object, and a new differential equation is obtained using dynamic programming method, and the optimal feedback control and optimal index of the system are obtained. By automatically adjusting the values of various types of parameters, the optimal portfolio of securities can be obtained, thereby providing more reasonable research and prediction for stock prices.