The prediction of financial market based on BP neural network is used to maximize the income of investment

. In the financial market, investors often buy and sell volatile assets to maximize returns. We can use statistical and mathematical tools, mathematical models and computer technology to trade and get excess return ratio. Firstly, we established a price prediction model based on BP neural network, trained the network through the trading prices of bitcoin and gold before 2016, and then predicted the price of the next day every day from September 11, 2016 to September 10, 2021. Through the comparison with the real value and the horizontal comparison of other models, the prediction effect of this model is good. Then, the programming model is used to maximize the benefits in the next day as the objective function, and the constraints are that the amount after the transaction cannot be negative and there is no gold trading in part of the time. Considering the risk in the final transaction model, the planning model is established to find the optimal investment scheme at this time. Finally, the daily investment plan and the final total value are $3886.8.


Introduction
The rise of virtual currency provides investors with new investment channels [1]. Bitcoin is a cryptocurrency based on decentralization, adopting point-to-point network and consensus initiative, opening the source code and taking blockchain as the underlying technology. Bitcoin is characterized by high risk and high rate of return. In recent years, it has become a hot industry in the trading market [2]. As a general equivalent, gold is a frequent customer in asset allocation. Gold has the characteristics of fixed and low-risk market. Quantitative trading is based on professional financial knowledge. With the help of statistical and mathematical tools, quantitative models are used to analyze and predict from the existing data, and considering the market risk, investors are given the optimal investment strategy and excess return ratio. In this topic, let's stand in the perspective of an investor, carry out asset allocation, and experience the stimulation and thrill of being a trader [3].

Data Processing
From the known data, there are only date and price features in the data. We need to use a series of engineering methods to screen better data features from the original data, or combine the existing features to create more relationship features, so as to improve the training effect of model prediction [4].Moreover, in order to make the structure and feature set of data set more reliable in the later prediction problems, the value of data exploratory analysis and visualization is necessary [5].Therefore, we use three indicators to describe the characteristics of the market.
(1) BIAS A In claim 1, we need to hold $1000 for investment from September 11, 2016 to September 10, 2021.Although we now know all the data during this period, we don't know the price of bitcoin and gold the next day when we invest. Therefore, this paper constructs two models: prediction model and planning model [6].The following is an introduction to model construction.
Step1: firstly, the BP neural network model is used to obtain the daily prices of gold and bitcoin in the five-year trading days from September 11, 2016 to September 10, 2021.
Step 2: build the BIAS index, bull market index and purchase risk index of gold and bitcoin through the predicted price.
Step 3: use the planning model to guide the daily operation.
Step4: output final market value (2) Bull market indicator B Bull market, refers to the securities market where the price has been rising for a long time.The general trend of price change is to keep rising, which is characterized by sharp rise and small fall, more buying and less selling.
The overall operation trend of the bull market is upward. Although there is a decline, it is higher and higher from wave to wave. Buyers outnumber sellers, demand exceeds supply, popularity continues to gather, investors have a strong desire to catch up, the number of new accounts is increasing, and new funds are pouring in. Investors in the long market should try to avoid frequent operations, and their holdings are waiting to rise.
In this paper, there are two investment products: gold and bitcoin. The bull market time of each product is different. Therefore, we have constructed the gold bull market index and bitcoin bull market index respectively, as follows: Gold bull market index (1) Bitcoin bull market index B 2 (2) The Figure   (3) Purchase risk indicator C Stock market risk refers to the fact that the stock cannot be sold at a price higher than the purchase price within a predetermined time after buying the stock, resulting in Book loss or selling the stock at a price lower than the purchase price, resulting in actual loss. When making investment, carefully consider the stocks with high investment risk. Gold purchase risk is shown as figure 3.Bitcoin purchase risk is shown as figure4.

Model Establishment
BP neural network is a widely interconnected neural network composed of multiple neurons, which can simulate the interaction between biological nervous system, real world and objects Information processing by artificial neural network is to train the neural network through information samples to make it have the memory and identification ability of human brain and complete the information processing function of names and species. It can automatically summarize rules from existing data and obtain the internal laws of these data without any prior formula. It has good selflearning, adaptive and associative memory, The ability of parallel processing and nonlinear shape transformation is especially suitable for uncertain reasoning, judgment, recognition and classification with complex causality. For any one group of random and normal data, the artificial neural network algorithm can be used for statistical analysis, fitting and prediction [8].
Multiple layer feed forward network (abbreviated as BP network) based on error back propagation algorithm is the most successful and widely used artificial neural network at present(2) The basic principle of BP model can be learned, which consists of two processes: forward propagation of signal and reverse propagation of error. During forward propagation, the mode acts on the input layer. After being processed by the hidden layer, the output error is returned to the input layer by layer through the hidden layer according to a certain seed form, and "allocated" to all units of each layer, so as to obtain the reference error or error signal of each layer unit as the basis for modifying the weight of each unit. The process of constantly modifying weights is also the process of network learning. This process continues until the error level of network output is gradually reduced to an acceptable level or reaches the set number of learning times [9].BP network model includes its input and output model, action function model, error calculation model and self-learning model. BP network is a multilayer network composed of input layer, output layer and one or more hidden layer nodes. This structure enables the multilayer feedforward network to establish an appropriate linear or nonlinear relationship between input and output without limiting the network output between -1 and 1See Figure (1) BP algorithm obtains this input through the event of "training", and the appropriate linear or nonlinear relationship between outputs. The process of "training" can be divided into two stages: forward transmission and backward transmission [10]:

Forward transmission phase:
Take a sample P, Q from the sample set and input P. into the network; Calculate the error measure E and the actual output o, = E. (f (f (PW ") w...) W");③ Make -adjustments to the weight values W ", w... W. and repeat this cycle until > E<ε.
Backward propagation stage I error propagation stage: Calculate the actual output 0.Difference from ideal output Q, q; Adjust the weight matrix of the output layer with the error of the output layer; E;=;Z(Q,-0,)3; This error is used to estimate the error of the direct leading layer of the output layer, and then the error of the leading layer of the output layer is used to estimate the error of the previous layer. In this way, the error estimates of all other layers are obtained; These estimates are used to modify the weight matrix. It forms the process of transmitting the error shown by the output to the output step by step in the direction opposite to the output signal. BP network is shown as Figure 5.

Planning model
Investment problem is a very important kind of planning problem. Its main idea is that each time it is divided into two states: holding and holding cash. These two states can be maintained and changed from the previous day to the same day respectively.
To solve problem 1, this paper constructs the following planning model. The opening account is only US $1000. We judge whether to buy stocks through formula : When we decide to buy from the first day, we use 1000 yuan to buy a financial product. The subsequent decision-making model uses formula (2) to determine whether to sell.
Only when the profit from selling the next day is higher than the Commission will the trade goes.

FIBA 2022
Volume 26 (2022) As the market reaches a bull market, the probability of investors buying products will increase. At the same time, we should consider the recent purchase risk of products when buying products , and we should carefully consider the products with high risk. However, the bull market index and purchase risk are only the reference opinions of investors when investing, and the most important thing should be the price of products on that day and the Commission generated by buying and selling, Therefore, we set the coefficient between bull market index and purchase risk as 0.1.
The share is: (purchase amount -Commission) / price at the time of purchase. All available balances in the account will be used during each investment. If the above formula is true when judging the purchase of gold and bitcoin, we will choose the product with the largest income on that day, that is:Max = max (gold daily income, bitcoin daily income) When there are products in the account, we use the data of the next day in the forecast data. If we predict that the price of products in the account will rise tomorrow, we will not do any operation today. On the contrary, we also use it for judgment. If the result is greater than 1, we will continue to retain the products , otherwise we will sell all the products. Decision flow chart is shown as figure 6.
At this time, the money in the account includes:

Results
The yield curve is shown as figure 7, the final amount is 3886.7964137877357. The prediction error is shown as figure 8. Our team strives to achieve the accuracy of the prediction data, so we also use Arima, KNN, moving average and linear regression to make the prediction. The prediction results are shown in the Figureure. It can be seen that within the foreseeable range, BP neural network is the most accurate prediction model to predict the market.

The best trading strategy
Under our prediction model, we give the best trading strategy. At this time, we can get the best trading strategy we think. But how do we verify that this strategy is optimal under our assumptions? In the algorithm, we give a small random disturbance (5%) to the transaction amount, that is, we do not trade according to the best trading strategy we calculated. The following is some transaction information. It can be seen that after giving a small disturbance to the model, the return of investment is not as good as that before. Trading scheme within 5% fluction is shown as figure9.