0% found this document useful (0 votes)
30 views24 pages

Dio .Ne T: Trading Strategy Model Based On Dynamic Programming

This document presents a trading strategy model based on dynamic programming for trading volatile assets like gold and bitcoin. It includes data preprocessing, price prediction using the ARIMA model, and the establishment of optimal trading strategies for different trader types, demonstrating strong performance and robustness. The final results show significant profits and sensitivity analysis regarding transaction costs.

Uploaded by

xuma5668
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views24 pages

Dio .Ne T: Trading Strategy Model Based On Dynamic Programming

This document presents a trading strategy model based on dynamic programming for trading volatile assets like gold and bitcoin. It includes data preprocessing, price prediction using the ARIMA model, and the establishment of optimal trading strategies for different trader types, demonstrating strong performance and robustness. The final results show significant profits and sensitivity analysis regarding transaction costs.

Uploaded by

xuma5668
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Problem Chosen 2022 Team Control Number

MCM/ICM
C Summary Sheet
2203120

Trading Strategy Model Based on Dynamic


Programming
Summary

It is of great significance for traders to buy and sell volatile assets reasonably in market
transactions. Traders choose different trading strategies and get different benefits. This paper
studies the best trading strategies for different traders based on the daily prices of gold and bitcoin


in the past.
For problem 1, the original data is preprocessed firstly, including filling the missing value by
the daily price of gold in the past, and standardize all the original data. Following the processed

data, the ARIMA model is used to establish the price prediction model. Correlation coefficeents
between the prediction results and the price of gold and bitcoin are 0.8592 and 0.9304 respectively.

The effectiveness of our model is denoted. Thirdly, a dynamic programming model with largest
total assets and risk as the regular termis is established, with the constraints hit rate and transaction
volume limit. Lastly, the optimal daily trading strategy is solved with dynamic programming

t
method. Final profit is $ 132089.1078 on September 10, 2021.
ne
For problem 2, we prove our strategy is the best judged from the generalization ability,
robustness and benefit of the model. By adjusting the variable parameters in the model, the
io.
strategies suitable for three traders are formed, which are insurance type, common type and radical
type. The solution method of problem 1 is used to obtain the changes of each asset and the total
ad

earnings of the three trading strategies. Furthermore, the variable parameters in the model are
disturbed, and the total assets change within a certain range, indicating that the model has strong
anti-interference ability. Finally, the assets obtained by the three types of trading strategies are
m

$14312.6827, $50040.5474 and $132089.1078 respectively. It can be seen that our model yield
can resist inflation greatly.
w.

For problem 3, firstly, the sensitivity is defined as the change rate of transaction frequency.
By changing the transaction cost of gold and bitcoin, it is calculated that the sensitivity of gold
ww

transaction cost is 0.0422 and that of bitcoin transaction cost is 0.0658. It can be seen from
the comparison that the transaction strategy is more sensitive to the transaction cost of bitcoin.
Secondly, the impact of transaction cost on transaction frequency, asset return and asset risk are
analyzed. We find that when the transaction cost increases, the transaction frequency, asset return
and asset risk are decreases correspondingly.
For problem 4, we summarize the models and strategies established in the first three questions,
and introduce to traders in the form of memorandum how to simply use the trading strategy to trade
and the benefits brought by different trading strategies.
Keywords: quantitative investment; ARIMA model; dynamic programming
Contents

1 Introduction 2
1.1 Problem Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Restatement of the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Problem Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 General Assumptions and Notations 4


2.1 Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4


3 Problem 1: Prediction and Strategy in the Investment 4
3.1 Data Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2

Model Establishment of Problem 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Price Prediction Model . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Trading Strategy Model . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
5
8

3.3 Model Solving: Finding Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 Results and Model Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

t
3.4.1 Model Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
ne
3.4.2 Model Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
io.
4 Problem 2: Prove Optimization of the Strategy 12
4.1 Generalization Ability of the Model . . . . . . . . . . . . . . . . . . . . . . . . . 13
ad

4.2 Robustness of the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


4.3 Yield of the Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
m

5 Problem 3: Sensitivity of Strategy to Transaction Cost 16


w.

5.1 Sensitivity Difinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17


5.2 Impact of Transaction Costs on Strategy . . . . . . . . . . . . . . . . . . . . . . . 17
ww

6 Conclusion 18
6.1 Strengths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2 Possible Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

7 Memorandum 19

Appendices 23

Appendix A Changes of Various Types of Traders’ Assetes 23


Team # 2203120 Page 2 of 23

1 Introduction
1.1 Problem Background
Market traders buy and sell volatile assets frequently, with a goal to maximize their total return.
There is usually a commission for each purchase and sale. Two such assets are gold and bitcoin.The
price changes of bitcoin and gold from September 11, 2016 to September 10, 2021 are shown in
Figure 1. The source of gold daily prices is London Bullion Market Association and the source of
bitcoin daily prices is NASDAQ.


(a) Gold daily prices, U.S. dollars per troy ounce (b) Bitcoin daily prices, U.S. dollars per bitcoin

Figure 1: The prices of two assets

1.2 Restatement of the Problem

t
In this problem, we are asked by a trader to develop a model that uses only the past stream of
ne
daily prices to date to determine each day if the trader should buy, hold, or sell their assets in their
portfolio. We will start with $1000 on September 11, 2016 and use the five-year trading period,
io.
from September 11, 2016 to September 10, 2021. On each trading day, the trader will have a
portfolio consisting of cash, gold, and bitcoin [C, G, B] in U.S. dollars, troy ounces, and bitcoins,
respectively.We should only use these data to solve the following problems:
ad

• Develop a model that gives the best daily trading strategy based only on price data up to
m

that day. Use the model and strategy to predict the value of the initial $1000 investment on
September 10, 2021.
w.

• Present evidence that the model provides the best strategy.


ww

• Determine how sensitive the strategy is to transaction costs and how transaction costs affect
the strategy and results.

• Communicate the strategy, model, and results to the trader in a memorandum of at most two
pages.

1.3 Problem Analysis


For problem 1, The premise of formulating the strategy is to accurately predict the price trend of
gold and bitcoin in the future. Therefore, it is necessary to establish a price prediction model to lay
the foundation for formulating the strategy. Common time series prediction models include LSTM,
Team # 2203120 Page 3 of 23

BP neural network, RNN, encoder-decoder model, etc. In view of the simplicity and efficiency of
ARIMA model, which only needs endogenous variables rather than other exogenous variables, we
choose to use ARIMA model.
Next, establish a trading strategy model according to the established indicators, give the
trading strategy and calculate the final income. Intuitively, the price fluctuation of bitcoin is much
greater than that of gold, so we guess the risk is greater than that of gold. Therefore, the risk
of investment can be described by the variance of price change. This is essentially a dynamic
programming problem. We can quantify the return and risk, take the maximum benefit as the
objective function, find the constraints and establish the model.
With regard to problem 2, The optimization of the model can be proved from three aspects:
generalization ability, robustness and profit. The generalization ability of the model is reflected
in that changing the parameters in the model can make the model formulate different kinds of


strategies. Therefore, we divide the strategies into insurance type, common type and radical type.
The robustness of the model means that small changes in parameters will not affect the overall
strategy, and the anti-interference of the model is strong. It also shows that compared with other


investments, our strategy has a better rate of return.
As for problem 3, It is known that the transaction cost is the Commission. Intuitively, the

increase of commission should appropriately reduce the transactions. The decrease of commission
can increase the number of transactions. The ultimate goal is to maximize the income. Based on
the transaction strategy model established by the first question, by changing the cost α in the model

t
and observing the corresponding changes of transaction frequency, asset return and asset risk, we
ne
can get the sensitivity of three types of strategies to transaction cost.
io.
ad
m
w.
ww

Figure 2: Overall structure


Team # 2203120 Page 4 of 23

2 General Assumptions and Notations


2.1 Assumptions
To simplify our problems, we make the following basic assumptions, each of which is adequately
justified.

• All data are authentic.


• The investor is physically and mentally healthy and has no burden such as huge loans.
• Without considering inflation and other economic changes in recent years, only tabular data
are used.
• All transactions are conducted in US dollars. The commission is deducted from the amount


paid instead of being given separately.
• Since it is only US $1000, the minimum transaction unit of US dollar and bitcoin under


normal circumstances is not considered for the universality of the model.

2.2 Notations

In this work, we use the nomenclature in Table 1 in the model construction. Other none-
frequent-used symbols will be introduced once they are used.

t
ne Table 1: Notations
Symbols Descripition
io.
t1 = 3, t2 = 3 gold trading cycle (including holidays), bitcoin trading cycle
n number of cycles in five years
ad

DSgi , DSbi hit rate of training prediction model, i=2,3...n


Ri = [Ci Gi Bi ] asset distribution in the i-th cycle, R0 = [1000 0 0]
m

Ai total assets in the i-th cycle, A0 =1000


qi proportion of cash in total assets in the i-th cycle
ei , fi threshold of increase or decrease in the i-th cycle
w.

Xg(i) , Xb(i) forecast average price in the i-th cycle


Yg(i) , Yb(i) real average price of gold in the i-th cycle
ww

αg , αb proportion of commission of each transaction in the transaction amount


2 2
Rgi , Rbi decision coefficient of the trained model in the i-th cycle

3 Problem 1: Prediction and Strategy in the Investment


In this section, based on the existing data, we use ARIMA model to predict the price trend of
gold and bitcoin in the future, so as to establish a model and give the best daily trading strategy.
Dynamic programming is used to estimate the value of the initial $1000 investment by September
10, 2021.
Team # 2203120 Page 5 of 23

3.1 Data Preprocessing


Before data analysis, the availability of data must be guaranteed.

• Missing value processing. Unlike bitcoin, which is traded daily, gold is traded only on
trading days, so the data is not continuous. For the convenience of subsequent modeling, the
missing value is filled with the mean value before and after the day.

• Data standardization. In regression prediction, standardization gives eigenvalues equal


weight. Since we predict by period, we process the data by period. Calculate the mean(x̄)
and standard deviation(SD) of data(x), then the processed data x′ = (x−x̄)
SD
.

3.2 Model Establishment of Problem 1


3.2.1 Price Prediction Model
Improving forecasting especially time series forecasting accuracy is an important yet often


difficult task facing decision makers in many areas. Autoregressive integrated moving average
(ARIMA) models are one of the most popular linear models in time series forecasting, which have
been widely applied in order to construct more accurate hybrid models during the past decade [2].

ARIMA model combines three basic methods:

t
• Autoregressive(AR). Describe the relationship between the current value and the historical
ne
value, and use the historical time data of the variable to predict itself. The order of AR model
is recorded as p value.The formula is as follows:
io.
yt = α0 + α1 yt−1 + α2 yt−2 + · · · + αp yt−p + ϵt (1)
ad

where, and α is the coefficient, ϵt stands for error.

• Integrated(I). When the time series becomes stationary, the difference needs to be made,
m

and the order of the difference is recorded as d value. Generally, first order is enough.
w.

• Moving average(MA). Moving average model focuses on the accumulation of error terms
in autoregressive model. The order of MA model is recorded as q value.The formula is as
ww

follows:
yt = c + ϵt + θ1 ϵt−1 + θ2 ϵt−2 + · · · + θq ϵt−q (2)
where, c represents the constant term, ϵt is the white noise process of variance, and θ is the
coefficient.

The model is called ARIMA (p, d, q), as shown in the figure3, where p is the autoregressive
term, q is the moving average term, and D is the number of differences. We will follow the steps
listed below to build and solve our model.
Team # 2203120 Page 6 of 23

Figure 3: Structure of ARIMA model

step1 Stabilization
To use ARIMA model, the time series must be stationary. We use the Augmented Dickey-


fuller unit root test to test the stationarity. If the P value obtained from ADF test is less than
0.05, it is a stable time series. If it is unstable, we convert the non-stationary process into a


stationary process by difference method. It can be seen from the table 2 that the time series
becomes stable after the first-order difference.

Table 2: P value of gold and bitcoin time series before and after difference
P value before difference P value after difference

t
gold
bitcoin
ne 0.6734
0.9921
0.0043
0.0000
io.
step2 Selection of p and q
ad

Use autocorrelation function(ACF) and partial autocorrelation function(PACF) to determine


the values of p and q. the confirmation method is shown in the table 3.
m

Table 3: Confirmation method of p value and q value


w.

Model ACF PACF


AR(P ) attenuation tends to 0 truncation after p-order
ww

M A(q) truncation after q-order attenuation tends to 0


ARM A(p, q) attenuation tends to 0 after q-order attenuation tends to 0 after p-order

NOTE: Truncation means falling within the confidence interval (95% of the points comply with
the rule)

Figure 4 (a) shows the truncation of gold data using level 2 ACF and level 1 PACF, and
Figure 4 (b) shows the truncation of bitcoin data using level 2 ACF and level 2 PACF. From
this, we can determine the p value and q value respectively.
Team # 2203120 Page 7 of 23

(a) ACF chart and PACF chart of gold (b) ACF chart and PACF chart of bitcoin

Figure 4: ACF chart and PACF chart


step3 White noise test


If the white noise is obtained, it means that the useful information in the time series has been
extracted, and the rest are all random disturbances, which cannot be predicted and used.[9]

If the residual sequence passes the white noise test, the modeling can be terminated, because
there is no information to continue to extract.
The ARIMA model of gold is ARIMA(2,1,1) and bitcoin is ARIMA(2,1,2). The p value

t
of the white noise test output of this model is very close to 0, indicating that it follows the
ne
normal distribution with the mean value of 0, that is, it is a white noise.

step4 Prediction
io.
In order to predict the future market timely and accurately, we use the data of 30 consecutive
days as the training set and the data of the next 3 days as the test set. The moving step of
ad

the training set is 3. The prediction results of one cycle are shown in the figure 5. The
correlation coefficient R2 of gold is 0.8592 and that of bitcoin is 0.9304. The prediction
m

results of the model are relatively successful and can be used.


w.
ww

(a) Forecast chart of gold in one cycle (b) Forecast chart of bitcoin in one cycle

Figure 5: Forecast charts in one cycle


Team # 2203120 Page 8 of 23

3.2.2 Trading Strategy Model


The best daily trading strategy is given only according to the price data. We need to judge
the forecast data and give the strategy according to the forecast. Therefore, we define variable
parameters as shown in the table 4 to quantify the strategy.

Table 4: Variable parameters


Symbols Descripition
β, γ proportion of increase or decrease
DS hit rate
wH , w L purchase proportion, H/L stands for a higher/lower proportion
m selling proportion
R2 threshold of Decision coefficient Ri2


q cash retention ratio


Decision coefficient(R2 ): it is used to evaluate the volatility predicted by the model. The closer

the index value is to 1, the higher the fitting performance of the model.
Pt 2
x i,j − Y (i)

j=1
Ri2 = Pt 2 (3)

t
ne j=1 y i,j − Y(i)

where xi,j represents the predicted value of day j in cycle i and yi,j represents the actual value of
io.
day j in cycle iand Y(i) represents the mean of the true value in cycle i.
Hit rate(DS): it is used to evaluate the accuracy of the model in predicting the rise and fall, so
ad

as to evaluate the prediction of the long-term trend of the model.


(
1 Xt 1 , (xi,j+1 − xi,j ) (yi,j+1 − yi,j ) ⩾ 0
m

DSi = dj × 100% ; dj = j = 1, 2, 3 (4)


t j=1 0 , else
w.

where di represents the predicted rise and fall in cycle i. If the rise and fall of the real value is the
same as that of the predicted value, it is 1, on the contrary, it is 0.
ww

In addition, we make the following assumptions:

• The period from September 11, 2016 to November 11, 2016 is the zero cycle, and no
transaction is conducted as the experience accumulation period. Since November 12, 2016
is the first cycle, the number of cycles is n = 588.

• If the transaction starts from the second cycle, the asset situation in the first week is the same
as that in the zero cycle.

• Since gold is not traded during holidays, when the predicted value of gold price in a certain
period is empty, it means that gold is not traded in that period.
Team # 2203120 Page 9 of 23

• The Commission is deducted from the amount paid instead of being given separately.

We use i to record the cycle, in which cycle 0 is the experience accumulation period, which
only predicts and does not trade. 3 days is a cycle. We use j to record the day. The total number of
cycles is 588. Pay attention to the difference between trading days of gold and bitcoin.
To build a strategy model, we need to find the objective function and constraints. To make more
profits, we need to make the risk as small as possible and the profit as much as possible. Firstly,
we quantify the risk and set the standard deviation of assets owned in the transaction process as the
risk index S: v
u  ∑i−1 2
u Pi−1
u j=i−30 Ai − j=i−30 Ai
t 30
Sj = (5)
30


Calculate the amount of cash:
(
Ci−1 − Gi × wg , Xg(i) − Yg(i−1) > βg × Ai−1
Ci =

(

Ci−1 + Gi × mg × (1 − αg ) × Yg(i+1) , Yg(i−1) − Xg(i) > γg × Ai−1
(6)

Ci−1 − Bi × wb , Xb(i) − Yb(i−1) > βb × Ai−1
Ci =
Ci−1 + Bi × mb × (1 − αb ) × Yb(i+1) , Yb(i−1) − Xb(i−1) > γb × Ai−1

t
ne
Calculate the amount of gold and bitcoin:
(
Gi−1 + Ci × wg × (1 − αg )
io.
Gi = (7)
Gi−1 − Gi−1 × mg
(
ad

Gi−1 + Bi × wb × (1 − αb )
Bi =
Gi−1 − Gi−1 × mb
m

Then the total asset formula is:


w.

Ai = Ci + Gi × Yg(i) + Bi × Yb(i) (8)


ww

Finally, the objective function and constraints are determined, and the trading strategy model
is obtained:
max Aj − λ × Sj (9)
wj ,mj


 Cj , G j , B j , A j ⩾ 0




DSj ⩾ 0.5
s.t. Cj ⩾ Aj × q



 αg = 1%, αb = 2%


A = 1000, C = C = 1000, G = G = B = B = 0
0 0 1 0 1 0 1
Team # 2203120 Page 10 of 23

where, Wj represents the roportion of gold and bitcoin bought on day j, mj represents the roportion
of gold and bitcoin sought on day j, Aj represents the total assets on day j, λ represents the
coefficient of regular term, which is used to control risk and return, Sj represents the current day
risk. The first constraint indicates that all assets are positive, the second constraint indicates that the
accuracy of the model is greater than 0.5, the third constraint indicates that the remaining capital
of the transaction is greater than q times of the total assets, and α indicates the transaction cost,
A0 , C0 , G0 , B0 represents the total assets, cash, gold and bitcoin before the first day of trading,
C1 , G1 , B1 represents the amount of cash, gold and bitcoin before trading on day 2.

3.3 Model Solving: Finding Strategies


After the trading strategy model is established, we need to solve the model. The specific steps
are as follows:


step1 Data initialization. Set i = 1, know αg = 1%, set parameter βg , γg , ds, R2 , wHg , wLg , mg , q,
initial asset distributionR1 = R0 = [1000 0 0], total assets r1 = r0 = 1000.


step2 Calculate hit rate (DS). The prediction model hit rate(Formula 4) can evaluate the accuracy
of the trained model in predicting the rise and fall. When the accuracy is high enough, you
can continue to follow the next steps.

step3 Determine whether to trade. Firstly, due to the cost in the transaction, in order to avoid
excessive cost caused by frequent transaction, the transaction is carried out only when the

t
increase and decrease reach a certain threshold. Secondly, in order to avoid too little cash left
ne
in the transaction, the transaction can be carried out only when the cash meets the reserved
amount. The specific process is shown in the figure 6.
io.
ad
m
w.
ww

Figure 6: The process of determining whether to trade

where,
eg(i+1) = βg × Ai (10)
fg(i+1) = γg × Ai (11)
Ci
qi = (12)
Ci + Gi × Yg(i) + Bi × Yb(i)
in the formula, βg , γg represents the proportion of increase or decrease.
Team # 2203120 Page 11 of 23

2
step4 Determine the number of transactions. Prediction model discrimination coefficient Rgi
can evaluate the volatility predicted by the trained model. The smaller the variable, the more
stable the model is, and the proportion of buying gold during trading can be increased. The
specific process is shown in the figure 7.



Figure 7: The process of determining the number of transactions

Where, the formula for total assets is

Ai+1 = Ci+1 + Gi+1 × Yg(i+1) + Bi+1 × Yb(i+1) (13)


t
distribution is
ne
When proportions WHg , WLg and mg are used respectively, the formula for calculating asset

Ci+1 = Ci − Ci × wLg

io.
C ×w ×(1−αg )
RWHg = Gi+1 = Gi + i YLg (14)


g(i+1)

Bi+1 = Bi
ad


Ci+1 = Ci − Ci × wHg

C ×w ×(1−αg )
RWLg = Gi+1 = Gi + i YHg
m

(15)


g(i+1)

Bi+1 = Bi

w.

Ci+1 = Ci − Ci × wLg

C ×w ×(1−αg )
Rmg = Gi+1 = Gi + i YLg (16)
ww



g(i+1)

Bi+1 = Bi
In the formula, Yg(i+1) represents the real average price of gold on (i+1) day.

3.4 Results and Model Evaluation


3.4.1 Model Results
Using Python Programming and our model, set variable parameters: βb = 0, βg = 0.5, γb =
0.3, γg = 0.3, wHg = 0.8, wHb = 0.4, q = 0.01, the initial investment value of $1000 will be
$132089.11 by September 10, 2021. The number of transactions is 9, and the final asset distribution
Team # 2203120 Page 12 of 23

[C,G,B]=[22.31, 0.16, 2.84]. The changes of assets during the five-year period are shown in the
figure below.



Figure 8: The changes of total assets during the five-year period

3.4.2 Model Evaluation
This result is obtained using two models. Firstly, ARIMA model is used for prediction, and

we get good results: The correlation coefficient R2 of gold is 0.8592 and that of bitcoin is 0.9304.

t
ne
They are close to 1, indicating that the predicted value is highly correlated with the real value.
Through the trading strategy model, we get specific benefits. The strategy model has high
availability:
io.
• The model is only based on the price changes of gold and bitcoin in recent five years, so the
ad

model has low requirements for data.


m

• Our model puts forward variable parameters such as β, γ, wH , wL , m, q to form a parameter


list. By changing the parameters in the list, we can achieve different income results. In the
future, we can form an investment prediction software according to the model. We only need
w.

to understand the meaning of relevant parameters to realize asset management. Therefore,


our model is relatively simple and easy to understand.
ww

• The parameters in the model have a large variable range and are more flexible.

These ensures the reliability of the results.

4 Problem 2: Prove Optimization of the Strategy


Our model proposes multiple variable parameters, which can achieve different benefits by
changing parameters, so the model has good generalization ability. At the same time, the small
change of parameters will not affect the overall strategy, and the model is robust. Compared
with other investments, our strategy has a better rate of return. The following will explain the
Team # 2203120 Page 13 of 23

generalization ability, robustness and profit margin of the model to prove the optimization of
the strategy.

4.1 Generalization Ability of the Model


Successful investment comes from two factors: one is traders’ correct understanding of the
market, and the other is trading rationality. According to the reference materials[7], we divide
traders into the following three types:

• Insurance-type. The purpose of such traders’ investment behavior is mainly to obtain long-
term capital income, that is, they hope to obtain investment income regularly, and also hope
to obtain differential profits through the change of capital price in a longer term. At the
same time, before investing, traders should generally master sufficient information and make
a rational analysis of the expected profits and risks of the target assets.


• Common-type. The purpose of such traders is mainly to obtain large profits in a short
period of time and are willing to bear some risks. Its way mainly depends on the short-term


price fluctuation difference to obtain profits. They take technical analysis as the main means
and make speculative decisions based on historical price fluctuation experience. Generally
speaking, the probability of success of Common-type investors is not low, but the probability

of failure is also high. Its behavior has strong subjective initiative, and the probability of
success depends on its accuracy in predicting market fluctuations.

t
ne
• Radical-type. The characteristics of radical traders’ behavior are based on luck and oppor-
tunity, trading in the market with luck and hoping to make huge profits in the short term.
Generally speaking, the risk is very high. Unless they need money urgently, have the psy-
io.
chology of gamblers or have the ability to take risks, most people will not use this investment
method.
ad

In the model, for three types of traders, the corresponding parameters are adjusted as shown in the
table 5:
m

Table 5: Adjustment of variable parameters


w.

variable parameters Insurance-type Common-type Radical-type


ww

βb 0.35 0.10 0
βg 0.50 0.50 0.50
γg 0.10 0.20 0.30
γb 0.10 0.20 0.30
wHg 0.95 0.80 0.80
wHb 0.15 0.30 0.40
q 0.15 0.05 0.01

Solve the model according to different parameters adjustments and get the changes of various
Team # 2203120 Page 14 of 23

types of traders’ assets. The figure 9 shows the changes of various assets of insurance-type traders
in five years. See the Appendix A for the figures of the other two types.

(a) Changes of cash (b) Changes of gold (c) Changes of bitcoin


Figure 9: Changes of various assets of insurance-type traders


The changes of total assets of three types of traders are shown in the figure 10:



t
ne
(a) Insurance-type (b) Common-type (c) Radical-type
io.
Figure 10: Changes in total assets of three types of traderss
ad
m

Table 6: Results of three types of strategies


Insurance-type Common-type Radical-type
w.

T otal assets 14312.68 50040.55 132089.11


[C, G, B] [11474.39, 1.59, 1.07] [421.14, 0.61, 1.05] [22.31, 0.16, 2.84]
ww

N umber of transactions 85 58 9
SD 3861.73 15501.99 40067.35
Rg2 0.94 0.27 0.24
Rb2 0.41 0.98 0.99

NOTE: Rg2 /Rb2 represent correlation between gold/bitcoin purchase and actual fluctuation, SD
represent standard deviation of 5-year assets.

Reading the data in the table 8, although radical investors have more returns, the value of SD
is very large, that is, assets change greatly, so they have to bear corresponding risks. It can be
Team # 2203120 Page 15 of 23

seen from the number of transactions that any disturbance in the market may disturb insurance
investors. From R2 , we can find that the more traders tend to venture capital, the more they will
buy bitcoin; Gold symbolizes stable and conservative investment. Thus, our model gives a variety
of practical and feasible strategies.

4.2 Robustness of the Model


In practical problems, the perturbation of system characteristics or parameters is often inevitable.
The good robustness of the model means that the model has strong anti-interference ability, which
means that the system has the ability to maintain a certain performance under the disturbance of
uncertainty. As shown in the figure 11, figure 12, figure 13, they show the changes of total assets
when disturbing the WH , WL and M parameters of gold and bitcoin respectively.




t
(a) gold (b) bitcoin
ne
Figure 11: The impact of wL on total assets
io.
ad
m
w.
ww

(a) gold (b) bitcoin

Figure 12: The impact of wH on total assets


Team # 2203120 Page 16 of 23

(a) gold (b) bitcoin

Figure 13: The impact of m on total assets


As can be seen from the figure above, if these variables are disturbed, the final income of the
model is stable within a certain range. In fact, if the other parameters β, γ, q are disturbed, the


final return and investment risk of the model are stable within a certain range. The model has good
robustness, so it is proved that the strategy we give is the best.

4.3 Yield of the Strategy
In the real economic market, because the issue of paper money sometimes exceeds the actual

amount needed in circulation, there is often inflationso we need to manage money.Under different

t
ne
levels of inflation, the portfolio is diverse.In reality, money, stocks and bonds are generally used as
investment representatives.The portfolio in this question only includes gold ,bitcoin and cash.
Set the bank deposit interest rate as r, inflation rate as I,deposit amount as a, Then the actual
io.
value of the deposit after five years is
ad

5
A = a(1+r−I) (17)
m

Where A represents the actual value of the money after five years of deposit in the bank.
It can be seen from the data, from 2016 to 2021,the inflation rate was 7%, the bank deposit
w.

interest rate was 0.5%, so the actual value of $1000 after five years is $139.2436.In contrast, with
our portfolio, our total assets are $14312.6827, $50040.5474 and $132089.1078 respectively when
we choose insurance, common and radical investments. The results obtained by our model are
ww

several times higher than the more conservative financial behavior, so our model has higher income
and can resist inflation.

5 Problem 3: Sensitivity of Strategy to Transaction Cost


Based on the transaction strategy model established by the first question, we can get the
sensitivity of the strategy to the transaction cost by changing the cost α in the model and observing
the corresponding changes of transaction frequency, asset return and asset risk.
Team # 2203120 Page 17 of 23

5.1 Sensitivity Difinition


Set initial variable α by α0 , the initial transaction frequency h is h0 . After changing K(k =
1, 2, ..., 10) times, the variable α by αk . The corresponding transaction frequency h is hk .Sensitivity
is defined as: P10 |hk −hk−1 |
k=1 hk−1
× 100%
(18)
10
This indicator reflects the change rate of transaction frequency.

5.2 Impact of Transaction Costs on Strategy


In question 2, we divide the strategy model into insurance type, common type and radical type.
When exploring the impact of cost on strategy, we should also consider these three aspects. Let’s
take the common type as an example to explore the impact of various changes of α on the strategy.


We mainly explore through transaction frequency, asset return and asset risk, in which asset
risk is characterized by the variance of return. Specifically, it is investigated through the changes
of the following four costs.

a. αg fell 0.1% each time and αb remained unchanged.

b. αg remained unchanged and αb fell 0.2% each time.

c. αg rise 1% each time and αb remained unchanged.

t
ne
d. αg remained unchanged and αb rise 2% each time.
io.
Figure 14 shows the change of strategy in case a. It can be seen from the figure that a small
change in the cost of gold will not have an impact on traders’ decisions.
ad
m
w.
ww

(a) Changes of transaction frequency (b) Changes of return (c) Changes of risk
Figure 14: Change of strategy in case a

The result of case c is shown in the figure 15. In this case, we increase the transaction cost of
gold by 0.1% each time. After reading the picture, it is found that:

1. If the cost increases to a certain extent, it will reduce the number of transactions and the total
income.
Team # 2203120 Page 18 of 23

2. The cost increases, the transactions become less, and the possible risks are reduced.

3. The changes of the three indicators are synchronous and consistent.

It can be seen that in the face of the continuous rise in the cost of gold, our model has not
ignored, keenly felt this signal, and the change direction is in line with the reality. The strategy is
relatively sensitive to transaction costs.


(a) Changes of transaction frequency (b) Changes of return (c) Changes of risk

Figure 15: Change of strategy in case c

Table 7 lists the sensitivity of the strategies of the three transaction types to the cost of gold and
bitcoin respectively.

t
ne
Table 7: The sensitivity of three types of strategies to two costs
Insurance-type Common-type Radical-type
io.
αg 0.0267 0.0422 0
αb 0.2308 0.0658 0.0123
ad
m

Through the data in the table, we can find that:


w.

• The sensitivity of trading strategy to the cost of bitcoin is higher than that to the cost of gold.
ww

• The insurance-type strategy is more sensitive to the cost of bitcoin, and the common-type
strategy is more sensitive to the cost of gold.

• The sensitivity of radical-tupe strategy to cost is generally low.

6 Conclusion
6.1 Strengths
• Our model puts forward variable parameters to form a parameter list. By changing the
parameters in the list, we can achieve different income results. In the future, we can form
Team # 2203120 Page 19 of 23

an investment prediction software according to the model. We only need to understand


the meaning of relevant parameters to realize asset management. Therefore, our model is
relatively simple and easy to understand.

• The parameters in the model have a large variable range and are more flexible.

• The model is only based on the price changes of gold and bitcoin in recent five years, so the
model has low requirements for data.

6.2 Possible Improvements


• In the process of solving the model, the mixed purchase strategy of gold and bitcoin is not
well considered, which needs to be improved.


• Due to the lack of financial knowledge, the establishment of the model is not necessarily
perfect.

7 Memorandum 中

Memorandum

t
To: traders

From: Team #2203120


ne
io.
Subject: Investment model, Trading Strategy and Results of Bitcoin and Gold

Date: February 22, 2022


ad
m
w.

With the development of economy and the popularization of financial management concept,
more and more people have joined the ranks of investment. In addition to the traditional treasury
bonds, funds, stocks, gold and so on, virtual currency has increasingly appeared in people’s vision,
ww

setting off a "currency speculation fever". Investment involves both returns and risks. In order to
explore the best trading strategy, our team has established a trading strategy model based on the
price trend of gold and bitcoin in the past five years to help you better invest.

STRATEGY

The strategy we designed mainly focuses on three questions: when to trade, what kind of assets
to trade and how much to trade.
Team # 2203120 Page 20 of 23

Figure 16: Structure of transaction strategy model

• When to trade. We measured the hit rate of the current model, the rise and fall of gold
and bitcoin, and the proportion of cash after trading. Only when the three indicators meet
the trading conditions at the same time can the transaction be carried out, and it is decided
whether to buy or sell. On the contrary, if the trading conditions are not met, wait until the
next cycle for judgment


• Deal what. By setting the threshold of increase and decrease, compare the rise and fall range


of gold and bitcoin, measure the risk and return of trading bitcoin and gold, and decide to
trade gold or bitcoin.

• How much is the deal. If we decide to buy, we will use the decision coefficient of the current
model to decide how much to buy. When the judgment coefficient is small, it means that the
model we currently use is relatively stable and the risk is small. Therefore, when purchasing,

we can appropriately increase the purchase proportion, on the contrary, reduce the purchase

t
ne
proportion; If we decide to sell, we will sell according to the preset proportion.
io.
For the above strategies, by changing the variable parameters in the strategy, three strategies
can be formed: insurance type, common type and radical type, which are suitable for different
traders and have good generalization ability. Secondly, when the variable parameters in the strategy
ad

are disturbed, the results show that the total assets change within a certain range, indicating that
the anti-interference ability of the model is strong. Finally, by comparing the benefits of $1000
m

deposited in the bank for five years and the five-year trading of this strategy, it can be seen that our
strategy can resist inflation to a certain extent.
w.

MODEL
ww

The strategy is based on the prediction of the future. In view of the simplicity and efficiency of
ARIMA model, which only needs endogenous variables rather than other exogenous variables, we
choose ARIMA model as the price prediction model. In order to predict the future market timely
and accurately, we use the data of 30 consecutive days as the training set and the data of the next
3 days as the test set. The correlation coefficient R2 between gold’s prediction result and the real
value is 0.8591, and bitcoin’s R2 is 0.9304, which are close to 1, indicating that the correlation
between the predicted value and the real value is strong and the prediction accuracy is high. Such
prediction lays a solid foundation for follow-up work.
Team # 2203120 Page 21 of 23

The determination of trading strategy is essentially a dynamic programming problem. We


need to maximize the return while taking into account the risk. Therefore, establish the objective
function:
max Aj − λ × Sj
wj ,mj

where, Wj represents the roportion of gold and bitcoin bought on day j, mj represents the roportion
of gold and bitcoin sought on day j, Aj represents the total assets on day j, λ represents the coefficient
of regular term, which is used to control risk and return, Si represents the current day risk.
By changing the coefficient of the regular term λ, the risk can be adjusted and divided into three
investment strategies: steady investment, common investment and radical investment.

RESULTS


Through the training of parameters, we have obtained models for three different populations.
The best returns and some transaction information of the three models are shown in the table below:


Table 8: Results of three types of strategies

Insurance-type Common-type Radical-type
T otal assets 14312.68 50040.55 132089.11

[C, G, B] [11474.39, 1.59, 1.07] [421.14, 0.61, 1.05] [22.31, 0.16, 2.84]

t
N umber of transactions
SD
ne 85
3861.73
58
15501.99
9
40067.35
io.
ad

Through the analysis of the results, we can see that:

• The amount of investment is mainly bitcoin.


m

• Insurance investment tends to trade many times and is vulnerable to market influence. Ag-
w.

gressive investments make fewer transactions.


ww
Team # 2203120 Page 22 of 23

References
[1] Conlon. T and McGee. R. Safe haven or risky hazard? Bitcoin during the Covid-19 bear
market. FINANCE RESEARCH LETTERS, 35, 2020.

[2] Khashei. M and Bijari. M. A novel hybridization of artificial neural networks and ARIMA
models for time series forecasting. APPLIED SOFT COMPUTING, 11(2):2664-2675, 2011.

[3] Aasim, Singh. SN and Mohapatra. A. Repeated wavelet transform based ARIMA model for
very short-term wind speed forecasting. RENEWABLE ENERGY, 136:758-768, 2019.

[4] Valipour. M, Banihabib. ME and Behbahani. SMR. Comparison of the ARMA, ARIMA, and
the autoregressive artificial neural network models in forecasting the monthly inflow of Dez
dam reservoir. JOURNAL OF HYDROLOGY, 476:433-441, 2013.


[5] Mahjoub. C, Bellanger. JJ, Kachouri. A and Jeannes. RL. On the performance of temporal
Granger causality measurements on time series: a comparative study. SIGNAL IMAGE AND
VIDEO PROCESSING, 14(5):955-963, 2020.

[6] Chen. JS, Hou. JL, Wu. SM and Chang-Chien. YW. Constructing investment strategy
portfolios by combination genetic algorithms. EXPERT SYSTEMS WITH APPLICATIONS,

36(2):3824-3828, 2009.

[7] Wang. S, Wang. XG, Meng. FL, Yang. RJ, Zhao. YJ. Investor behaviour monitoring based on

t
deep learning. BEHAVIOUR & INFORMATION TECHNOLOGY, 40 (9):XLII-LIII, 2021.
ne
[8] Michael. SC. Can information technology enable profitable diversification? An empiri-
cal examination. JOURNAL OF ENGINEERING AND TECHNOLOGY MANAGEMENT,
io.
24(3):167-185, 2007.
ad

[9] Mitic. P. Is a Reputation Time Series White Noise? INTELLIGENT DATA ENGINEERING
AND AUTOMATED LEARNING - IDEAL 2017, 10585:543-550, 2017.
m

[10] Daigle. CL and Ridge. EE, Investing in stockpeople is an investment in animal welfare and
agricultural sustainability. ANIMAL FRONTIERS, 8(3):53-59, 2018.
w.

[11] Mariana. CD, Ekaputra. IA and Husodo. ZA. Are Bitcoin and Ethereum safe-havens for stocks
during the COVID-19 pandemic? FINANCE RESEARCH LETTERS, 38, 2021.
ww

[12] Conlon. T, Corbet. S and Mcgee. RJ. Are cryptocurrencies a safe haven for equity markets? An
international perspective from the COVID-19 pandemic. RESEARCH IN INTERNATIONAL
BUSINESS AND FINANCE, 54, 2020.
Team # 2203120 Page 23 of 23

Appendices
Appendix A Changes of Various Types of Traders’ Assetes


(a) Changes of cash (b) Changes of gold (c) Changes of bitcoin
Figure 17: Changes of various assets of common-type traders



t
ne
io.
(a) Changes of cash (b) Changes of gold (c) Changes of bitcoin
Figure 18: Changes of various assets of radical-type traders
ad
m
w.
ww

You might also like