Provide Bitcoins Daily Optimal Trading Strategy B
Provide Bitcoins Daily Optimal Trading Strategy B
Volume 5 (2023)
Abstract. The purpose of this report is to develop a model that gives the best daily trading strategy
based only on the price data before the day. We want to provide traders with strategies that will
enable them to maximize their returns.we first utilize the LSTM time series neural network model
using the first 956 data sets are used for training , and the subsequent 300 test sets are used to
evaluate the model accuracy, calculate the prediction error and word comparison plots, and assess
the difference between the prediction performance of the model and the actual value,This method
has a better credibility. Finally, based on this model, we construct the optimal trading strategy model
with the maximum value of total assets held as the objective function, add constraints, and finally
arrive at an investment value of $1000.
Keywords: optimal trading strategy model; LSTM; BP; investment risk model.
1. Introduction
With the increase of per capital disposable income, people's financial awareness is growing, and
market traders often trade volatile assets to achieve the goal of maximizing total return, and how to
achieve this goal has been a key concern for people from all walks of life. As the application of
advanced mathematical theories and financial ideas has become more sophisticated, people have
gradually diversified their single trading capital, until now, the two main assets are gold and bitcoin.
According to statistics, 90% of day traders lose 90% of their capital within the first 90 days of
trading; 40% of traders will blow up their positions in less than 1 month, and only 13% will survive
after 3 years. As you can see, maximizing profit is not simple to achieve. Therefore, it is essential for
market traders, as the master of futures trading, to have a considerable strategy for analyzing price
fluctuations, buying and selling assets, and trading on a daily basis in order to make it possible to
maximize short-term profits. Therefore, it is particularly important to determine the trading strategy
to buy, hold or sell the trader's assets.
Give the best daily trading strategy and model based on the price data of the day, combine the
historical price float data and predict the future market trend. Considering the problems caused by
two different properties of capital, gold and bitcoin, for example, bitcoin can be traded daily but gold
can only be traded on days when the market is open, we have to make some adjustments to the trading
strategy.
we constructed a time prediction model to forecast two price series and make decisions about
trading based on future ups and downs by constructing a long and short term time series neural
network LSTM and a BP neural network time prediction to compare the prediction effect of both and
select the best strategy. We constructed and simulated a time prediction model of the stock closing
price direction based on the RBF neural network and time prediction model, and made some
adjustments using the BP neural network. With the adjusted model, we plotted the graphs of the
weighted average price of the five-day, ten-day, and twenty-day closing prices of the stock with the
help of the daily average manipulation method, which we used to predict the optimal way to trade
gold and bitcoin. Then, we initially determine whether to trade based on the distance between the
stock price and the five-day line, as there is a certain commission for each trade, and then substitute
the trading commission based on the model to finally give the best daily trading strategy. In contrast,
645
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
the long-short time series neural network LSTM forecasting model builds a nonlinear model that
allows for large nonlinear complex forecasting. Comparing the two, it is easy to see that the LSTM
possesses better prediction results, so we choose the LSTM model to determine the value of the initial
$1,000 investment on September 10, 2021.
2. Data pre-processing
The original data is integrated and cleaned, the missing data is completed, the bitcoin and gold
tables are combined, and the gold non-trading day data is completed, and the data is normalized.
As the data for Bitcoin and Gold are from the real world, there are inevitably a number of
anomalies, and by looking at the graph? Therefore, before constructing the LSTM prediction model,
we need to decompose the linear and nonlinear parts of the data, filter, smooth, and use the difference
method to deal with missing values and other operations, which will help to eliminate or repair the
outliers and improve the prediction accuracy of the model.
646
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
For the processed data we normalize and use the first 956 sets of data to construct the LSTM time
series neural network prediction model and participate in network training, and the second 300 test
sets are used to evaluate the model accuracy.
3. LSTM model
3.1. Data description
The LSTM model is a special recurrent neural network model (RNN) with good support for long-
term dependence, and the core of the model is the state of the cell and the gate structure in it. The cell
state refers to the horizontal line running through the top with only a few linear interactions, and the
information is easier to keep constant on top, which is also very beneficial for us to predict the closing
price of this question, while the gate structure refers to the ability to remove or add information to the
cell structure, containing the sigmoid layer and tanh layer, and this structure has an important role in
our prediction of the closing price, see the figure 6 below for the specific model structure. The general
flow of the model is that after the input is trained to obtain four states:
𝑍𝑓 = 𝜎(𝑊𝑓 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑓 )
𝑍𝑖 = 𝜎(𝑊𝑖 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑖 )
𝑍 = 𝑡𝑎𝑛ℎ( 𝑊[ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏)
𝑍𝑜 = 𝜎(𝑊𝑜 [ℎ𝑡−1 , 𝑥𝑡 ] + 𝑏𝑜 )
The output 𝑦𝑡 is obtained after the gate structure is operated,
𝑐𝑡 = 𝑍𝑓 ⊙ 𝐶𝑡−1 + 𝑍𝑖 ⊙ 𝑍
ℎ𝑡 = 𝑍𝑜 ⊙ 𝑡𝑎𝑛ℎ (𝑐𝑡 )
𝑦𝑡 = 𝜎(𝑊𝑦 ℎ𝑡 )
The flow is shown in figure 3 .
647
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
648
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
time dimension, providing a theoretical basis for the subsequent construction of the best strategy
model.
Using the results shown above can be seen, black is the original data, Figure 1 red is the test data,
Figure 2 red is the data after training and then prediction, we can see that our approximate trend is
very consistent, there are some places where the peak prediction is not enough, but the overall effect
is quite good, and can be used for gold and bitcoin future trend prediction.
649
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
𝑚𝑎𝑥𝑌𝑖 = 𝑊𝑖 × 𝜂𝑖 + 𝑄𝑖 × 𝛾𝑖
The constraint is as follows:
The daily investment amount should not be greater than the amount of all available investments,
the initial state is [1000,0,0], and the transaction cost per transaction (buy or sell) is a% of the
transaction amount, where gold a=1 and bitcoin a=2. Then for $1000, buy or sell, the only amount of
transactions we actually make is $940.
940, 𝑖=1
𝑍𝑖 = {
𝑌𝑖 , 𝑖 = 2,3,4. . .
The predicted tomorrow's gold price / today's gold price - 1 should be greater than 0.01 commission
(𝑥𝑖+1 /𝑥𝑖 ) − 1 > 0.01 × 𝑎%
Predicted tomorrow's bitcoin price / today's bitcoin price -1 to be greater than 0.01 commission
(𝑦𝑖+1 /𝑦𝑖 ) − 1 > 0.01 × 𝑎%
Based on the results in the table above, the value of the initial $1,000 investment on September 10,
2021 is derived as $80827.34.
650
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
5. Sensitivity analysis
We conducted sensitivity analysis on the MSE values and the gradient of the predicted data, and
from the figure, we can see that the training accuracy is very high during the 50,000 training sessions,
and the mean square error value shows a decreasing trend as the number of training sessions increases.
For the gradient plot, we can see that the training gradient reaches a very considerable level during
50,000 training sessions, which positively reflects the stability of the deep learning prediction data.
We set the initial gold value as N and the initial allocation value of bitcoin as 1000-N,iterate N
from 1 to 1000 with a step size of 10 to get the initial gold value in the third step, and use the line
graph of the initial gold value versus the total asset value after five years to observe why N is smoother
at times and analyze the transaction cost sensitivity of the trading best strategy model.
References
[1] Wang Huiying, HAO Yongtao. Modern Computers, 201,27(27):43-47+52.]
651
Highlights in Business, Economics and Management FTMM 2022
Volume 5 (2023)
[2] Yao Haixiang, Li Junwei, Xia Shenghao, Chen Shumin. Fuzzy Transaction Decision Based on Apriori
Algorithm and Neural Network [J]. Journal of Systems Science and Mathematics, 201,41(10):2868-2891.
[3] Liu Lijun, LIANG Guopeng, Wang Haitao. Research on quantitative Trading Strategy System Model [J].
Shanghai Commerce,2021(09):158-159.]
[4] Peng Yaqi. price prediction and option strategy of sse 50ETF based on ga-lstm [D]. Northwestern
University,2021.
[5] Li Y. Research on community division and quantitative trading strategy of securities business Department
based on trading public information [D]. University of Electronic Science and Technology of China,2021.
[6] Wang Mengtian. Research on Futures Price Trend Prediction and Quantitative Trading Strategy based on
Machine Learning [D]. Nanjing University of Finance and Economics,2021.
[7] Xian Jing. Quantitative Trading strategy of A-shares based on KNN algorithm [J]. Bohai sea economic
outlook, 2020 (01) : 153. DOI: 10.16457 / j.carol carroll nki HBHJJLW. 2020.01.105.
[8] wang tong. Research on Quantitative Trading Strategy based on EMV Index in China's A-share Market
[J]. Tax, 2020, 14 (01) : 199.
[9] Lin Fuquan, XUE Xinbei. A study on the application of a homeopathic moving average strategy in China
sse 50ETF index fund [J]. Journal of hubei university of economics (humanities and social
sciences),2019,16(12):31-36.
[10] Wang Chenyang. Research on the effectiveness of trend investment in Shanghai and Shenzhen A-share
market: Based on moving average strategy [J]. Commercial economy, 2019 (9) : 178-180. the DOI:
10.19905 / j.carol carroll nki syjj1982.2019.09.066.
[11] He Qi-xiang, Ma Yu-Tong. Under different trading strategies, the classification of commodity futures risk
premium research [J]. Journal of management engineering, 2019 (3) : 52-60. doi: 10.13587 / j.carol carroll
nki jieem. 2019.03.007.
652