Quantitative trading is based on professional financial knowledge. With the help of statistical and mathematical tools, the quantitative model is solidified from the data, and the transaction is simulated by computer technology to obtain excess returns. This paper uses data on a five-year trading period in the United States from 11 September 2016 to 10 September 2021. We first establish a time series model to predict the follow-up price of gold coins and gold, and then introduce the Sharp ratio to establish a risk model to simulate and predict the risk of the market, and then use the particle swarm optimization method to modify the parameters of the model. Finally, sensitivity tests and analysis are carried out to ensure that the profit is maximized under the model conditions. In the course of the analysis, we found that with the increase in fees, gold and bitcoin trading volume significantly reduced, the final value of the decline. With fees falling, gold and bitcoin's large trading volumes have increased dramatically, with final value rising. The scheme has good predictability, and the heuristic algorithm greatly accelerates the convergence speed of the model.