In this paper, based on the vector autoregressive algorithm, the conditional value-at-risk algorithm is used to compute the optimal portfolio, and the mean-CVaR model oriented to portfolio optimization is established based on the mean-variance model. To explain the volatility accumulation characteristics of financial asset return series, the autoregressive conditional heteroskedasticity model with CvaR is designed. After the design and optimization of the algorithm are completed, the daily closing price of a commodity futures contract, CSI 300 and the stock situation of different companies, and the daily closing index data of the financial index of a city are collected, and the three major groups of data are tested for the model of this paper. The results show that the maximum value of the CVaR-GARCH model at 95% and 90% confidence levels is generally 4000~6000, which is higher than that of the VaR model alone at 1000~2000. The difference between the actual loss and the loss predicted by the model in this paper is 88.618~279.181. The number of failures at 90% confidence level is 44. The number of failures at 95% confidence level is 31, while the number of failures at 99% confidence level is 1,000~1,000. The number of failures at 99% confidence level is 1,000~1,000. Number of times is 31. At a 99% confidence level, the number of failures is 11. This results in a generalized failure rate of 6.03%. Investors can make program adjustments with more accuracy due to the model in this paper’s ability to predict stock market risk.