The goal of establishing the model in this paper is to find the historical price patterns of gold and bitcoin according to the data provided. The purpose is to maximize returns under various market constraints and avoid loss risk as much as possible. Traders provide the best trading strategy. In this paper, two models are established: model 1: price prediction model based on ARIMA; Model 2: quantitative trading strategy model based on dynamic programming. For Model 1, a classical time series modeling approach based on stock forecasting was used: the ARIMA price forecasting model. The model's validity was demonstrated by analyzing the intrinsic trend of the data movements and verifying the smoothness. Next, historical data were used to fit the parameters of ARIMA, and the forecasting model was determined to be ARIMA (0, 1, 0) by the exhaustive method. Finally, the ARIMA predicts the up and down trends of gold as well as bitcoin, which provides the basis for the trading decision. For Model 2, to better quantify the relationship between investment risk and investment return, the Sharpe ratio is introduced, the Sharpe ratio's value is used as the main parameter of the trading strategy, and the corresponding planning equation is established. Then, based on the up and downtrend of the data predicted by the ARIMA model, the assets are allocated for investment. The model is optimized by a particle swarm algorithm, which accelerates the convergence of the model. Finally, this paper tests the model's accuracy to verify the correctness of the model. By adjusting the commission rate, it is found that the commission rate is negatively correlated with the number of large transactions of gold and bitcoin.