Crypto Analysis PRJ
Crypto Analysis PRJ
… … … … … … … …
2023-01-09 1287.450806 1342.144165 1286.680786 1321.538940 1321.538940 7990438824 ETH-USD
2023-01-10 1321.395508 1342.757202 1318.527222 1336.586060 1336.586060 5830173253 ETH-USD
2023-01-11 1321.395508 1387.932739 1323.583130 1387.932739 1387.932739 6314904311 ETH-USD
2023-01-12 1405.351440 1432.281250 1378.422119 1417.938477 1417.938477 12230193038 ETH-USD
Open: The price of the stock when the market opens in the morning
Close: The price of the stock when the market closed in the evening
Adjclose: Adjusted close is the closing price after adjustments for all
applicable splits and dividend distributions.
High: Highest price the stock reached during that day
Low: Lowest price the stock is traded on that day
Volume: The total amount of stocks traded on that day
To further analyze market capitalization, we need to add a
“total_traded” column for each currency, for Daily Percentage Change we
should add “returns” column and for Comulative return - “comulative
return” column.
MATIC
LTC
XRP
DOGE
On these graphs, you can see the change in the price of each
currency, and which periods corresponded to the rise and fall of prices,
see the main trends.
Price comparison for all selected currencies
Сlose
Open
As we can see for both the ‘Open’ and ‘Close’ during all period of
time, BTC has been dominating the other currencies, we can see this by
the blue wave.
2) The volume of all these currencies
Let’s analyze the above plot, we see that BTC began to peak
somewhere between May - April 2022, what caused the spike? We will
use the iloc method for this. The iloc method is used when we want to
index at a certain point using Pandas.
4) Moving Average
A moving average is a technical indicator that market analysts and
investors may use to determine the direction of a trend. It sums up the
data points of a financial security over a specific time period and divides
the total by the number of data points to arrive at an average.
We want to read each currency separately as it seems at this
moment BTC is winning, but we need to analyze everything in order to
make informed decisions. We will just work with the Close for now.
We will begin by creating another new column and we will call it
moving average 60. The 60 represents the samples we will be analyzing,
60 dates, a two-month analysis is quite fair enough.
BTC
ETH
MATIC
LTC
XRP
DOGE
The larger the value of rt the better the price of t. But if we bought
a coin at day t-1 and we sold it for a lower price, then our ratio would be
less than 1 and rt would be negative. The smaller the value of rt, the more
loss we have experienced.
This is used mainly to analyze the volatility of the coin, if the daily
returns have a wide distribution, the coin is more volatile. We will be
calculating the percentage return and plot them on a histogram.
As we can see, DOGE is the most volatile coin. But because of it,
we can`t see the volatility of other coins. So to see it better we will
remove DOGE from the plot.
So, as we can see from the plot above, XRP is also a kind of
volatile coin.
7) Correlation matrix
The further away the correlation coefficient is from zero, the stronger the
relationship between the two variables.
The first entry is always $1 as you can see on the tables the values
are close to 1, so the cumulative return is always compared to 1 dollar.
Clearly, the graphs show for all coins except LTC, if we had invested in it
in 2021, we would be in profit right now.
10) Predicting BTC price
For this purpose we will create a neural network using the
tensorflow library. Our network will make predictions on the base of data
about previous BTC prices (data about 60 previous days) and on the exit
will give us the price of BTC on the next day.
We will use a sequential model. A Sequential model is appropriate
for a plain stack of layers where each layer has exactly one input tensor
and one output tensor.
Our network will contain 3 hidden LSTM layers and an output
layer. Every LSTM layer contains 50 neurons:
Let`s test our model. For this purpose we will take data for 4
previous years. We will try to predict the prices of the past 2 years based
on the previous prices.
As we can see from the plot above, our predicted prices are very
similar to real BTC prices. It means our model works!
Conclusions
To sum up, as a result of the work done, I can say that it was
investigated which tools can be used to analyze the prices of
cryptocurrencies. Also, based on these tools, price analysis of selected
cryptocurrencies was conducted using Python tools. The above analysis
can be used to understand a cryptocurrency’s short-term and long-term
behaviour.
As a result of this analysis, it can be briefly said that BTC still
dominates the market and the most volatile coin is DOGE. Also, if we
invested in one of these coins (except LTC) 2 years ago, we would be in
profit now. Moreover, during the project I created a model that can
predict the price of BTC based on previous prices.
Also, I can say that the Python tools for working with time series
and plotting are very powerful and easy to use. Working with them is
simple and interesting!