Course project for STA525 at Cal Poly Pomona.
Financial data is often to be a subject of time series analysis. Recently, cryptocurrency markets in the world have been rapidly increasing their presence enough to interact with legal currency markets. However, due to a relatively insufficient trading infrastructure and people’s understanding about cryptocurrencies when compared to legal currencies, occasionally some of cryptocurrency show a strong dependency on another currency in terms of their price. Given this, we tried to analyze the relationship between the price of Bitcoin in Japan and the one of Bitcoin Cash in the United States with ARMA (+GARCH) model and correlation analysis.
Paper work: https://www.slideshare.net/KeitaMakino/time-series-analysis-in-cryptocurrency-markets-the-bitcoin-brothers-paper-work
2. Cryptocurrency
• Bitcoin (BTC)
• Starts from 2009, originally introduced by “Satoshi
Nakamoto”
• Blockchain system enables us to make online
transactions without any third-party authorization
process
A→B
1.0BTC
B→C
3.0BTC
A→C
0.5BTC
Bitcoin Blockchain
New block in every 10 minutes
2
3. Dataset
• Price of BTC/JPY at coincheck.com
• Collected on 11/13/2017
• Data every 10 seconds → in total 8640 data points
3
4. Analysis
• Is this a Random Walk?
• Financial data is often said to be a random walk data
• ADF test to determine the probability where the data is
a R.W.[1]
[1] RでGARCHモデル - TokyoR #21
https://www.slideshare.net/horihorio/garch-by-r
4
5. Analysis
• Is this a Random Walk?
• Take a return to make it non R.W.
• 𝑦 𝑡 =
𝑥 𝑡
𝑥 𝑡−1
− 1
5
6. Analysis
• ACF and PACF
• Possibly (P,Q) = (2,0), (0,2), (5,0) or (0,5)?
Otherwise P,Q>0
6
8. Analysis
• sarima
• (P,Q) = (0,3) and (2,0) have a problem in p-values
• The others have some problem in variance and QQ
• Try GARCH model to reduce these issues
8
9. Analysis
• sarima
• (P,Q) = (0,3) and (2,0) have a problem in p-values
• The others have some problem in variance and QQ
• Try GARCH model to reduce these issues
9
10. Analysis
• GARCH
• What should be for GARCH(P,Q)?
• Difficult to find them → for loop[1]
• Determine the best model based on BIC.
[1] RでGARCHモデル - TokyoR #21
https://www.slideshare.net/horihorio/garch-by-r
10
11. Analysis
• GARCH
• Assume t distribution for the residual as it’s a financial
data[2]
not normal
[2]資産価格の実証分析/金融経済論 II
http://www.ier.hit-u.ac.jp/~iwaisako/class/Efinance2008/Efinance04_08dist.pdf
11
22. Cryptocurrencies
• Bitcoin Cash (BCH)
• Starts from August 1st, 2017, having been hard forked
from original BTC.
A→B
1.0BTC
B→C
3.0BTC
A→C
0.5BTC
Bitcoin Blockchain
A→D
1.5BCH
E→B
2.3BCH
Bitcoin Cash Blockchain
Fork on 08/01
22
27. Strategy
• Use a bias in the markets
• JPY has much less market share on BCH
Drastic change in BCH/USD price can trigger a negative
effect to BCH,/JPY but the other way would not be
happen
https://www.cryptocompare.com/coins/
27
28. Strategy
• Is that true?
• Let’s see the CCF
→The least CCF values appear at lag=2 and 3
28
30. Strategy
• Base Algorithm
Look at the high and low price of
BCH/USD in recent 10 minutes
Look at the average price of
BCH/USD in recent 30 seconds
Is that much higher/lower than the
average of past 30 seconds?
Is the difference high?
Buy/Sell BTC/JPY
F
T
T
F
30
34. Conclusion
• The price of bitcoin can be fit with ARMA + GARCH
model, assuming the residual follow a t distribution.
• However, it is virtually useless to forecast a market
trend.
• Comparison with another market can enable us to
predict a bias in the short time ahead if there is a
special condition, such as a currency is drastically
increasing its market share.
• To win in this field, it is most important to keep up
to latest trends and information.
34
This topic.
Have you ever heard about bitcoin recently?
Yes, cryptocurrency is a hot topic this year.
Bitcoin is a kind of currency, originally introduced by Satoshi Nakamoto and that is powered by a blockchain system.
Blockchain is a continuously growing set of records. People can view all the history of the records, but cannot edit it anymore.
Using this, we now able to make a online payment without any 3rd party authorization such as governments, banks, public companies and so forth.
Because it is regarded as a currency, there is a exchange of bitcoin.
So today’s objective is this time series. The records were collected via coincheck.com on 11/13/2017, showing the price of BTC in JPY, frequency is every 10 seconds thus the total amount is 8640 records.
Firstly, it is often said that financial data is actually behaves as a random walk.So let’s see if the data is so. Here we have a ADF-test and get these p-values, indicating that there are some possibility of being a random walk.
Then, taking a return of the price make it non-random walk data, as you see the p-values are now very small.
Next, look at ACF and PACF, it should be reasonable to consider these four, either AR or MA models, or otherwise ARMA model.
Using auto arima gives us some possibility of ARMA model here, ARMA 2,3 or 4,1 .
Then examine the diagnosis of these models. As you see, there is a problem in p-values when we select 0,3 or 2,0.
The others have a problem in residuals and QQ Plots. Then considering GARCH may help us at finding a better model.
However, it is difficult to say generally which P,Q for GARCH is good for this data. Therefore, we have create all the models with all possible combinations of P,Q from 1,1 to 4,3 and compared their BIC to find the best model.
At this procedure, we have assumed that the residual follows a t distribution. It is because in this dataset most of the records are very close to 0.
After the step of for loop, we indeed got P,Q = 1,1 for all ARMA models. This is 2,3 + 1,1.
4,1 + 1,1, looks good.
0,5 + 1,1. You see there is a fault here.
And 5,0 1,1. It has some problem here too.
So, our best model should be ARMA 4,1 + GARCH 1,1.
Then let’s see the diagnostics.
Residuals with and without GARCH look identical at a glance, but
Actually there is a difference. And… it probably make some positive effects for stabilize the variance.
QQ plot. Actually it is difficult to say something. Which one do you think better?
Histogram of the residuals. It is also hard to find a significance, but at least not too far from the distribution.
However, when it comes to prediction, we clearly see it says little about the future.
Yes, forecasting a price of bitcoin could never be so easy that we can do for the term project, unfortunately.
But, you know, there is another way.
Yes, there are more and more currencies than bitcoin in the world.
From now on, we’ll talk on this, bitcoin cash, a brother of the bitcoin.
Bitcoin cash is a relatively new cryptocurrency which was born in this august being hard forked from the original bitcoin. It means the blockchain of bitcoin cash has all the history of bitcoin blockchain before this july.
And because it is 8 years newer than bitcoin, its specification was greatly improved to endure increasing transactions in these days.
So, this younger brother is much better than the older one. Some people welcomed this currency and enthusiastically invested, then.
The price of BCH suddenly exploded in this November. The ratio between BTC and BCH radically increased up to 4 to 5 times in 48 hours.
And this is our second data, collected via bittrex.com and shows the price of BCH in USD. Does anybody notice something? So
These trends have a negative relationship.
And here is our strategy. This pie chart explains the currency share in the cryptocurrencies. You see now JPY has the greatest volume in trading BTC, but never appear in the right chart, the share in BCH. It indicates that changes in BCH market can trigger a following change in BTC market, but the other way would not be happen.
How to confirm this assumption? See this CCF in the prices.
The bottom, least values on the CCF lie around lag=2 or 3.
It proves that there is about 30 seconds delay in propagating BCH/USD effect to BTC/JPY market.
And this is the scatterplot of the prices with 30 seconds lag. Showing there are typically negative relations when BCH gets high or low price.
Then try this flow chart.
First look at relatively long trend in BCH, if it finds a high volatility, then see in shorter span and detect an abrupt change in the price of BCH to trade BTC.
So we improved this... And let it run on Microsoft Azure web app.
And here is the result. In the day, we made about 30 closed trades and succeeded in increasing the fund about 6%.
This chart illustrates how the system bought and sold. Although there might be some suggestion, overall sell point is relatively higher than buy point,
In conclusion, we have evaluated an ARMA + GARCH model that can explain the bitcoin price. However, it is not enough to predict the future trend.
Then, comparison between two currencies, especially either of them is drastically changing its price, would help us at finding the short-term prediction easily.
Therefore, you must be up-to-date if you want to win in this field.
The end?
Well, can you guess which one finally won this war?
[Okay, so imagine today we have a new currency USD Next, which doesn’t have any physical object and there is no store which accept it yet, but it is completely secure, easy to use on the web, high anonymity, brah brah brah...
Do you wanna investigate all your asset to this currency?]
Yes, the name value is much much overwhelming...