0% found this document useful (0 votes)
38 views

Crypto Analysis PRJ

The document analyzes cryptocurrency price data over a two-year period using time series analysis and Python tools. Key analyses included: 1) Graphing price changes which showed rise and fall periods for each currency. BTC dominated the others. 2) Volume analysis found BTC peaked in May 2022 when prices decreased and people sold assets. 3) Moving averages and candlestick charts visualized price trends and volatility over time. 4) Metrics like daily returns and correlation showed DOGE and XRP were highly volatile, while coins were generally correlated with BTC most correlated to LTC.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Crypto Analysis PRJ

The document analyzes cryptocurrency price data over a two-year period using time series analysis and Python tools. Key analyses included: 1) Graphing price changes which showed rise and fall periods for each currency. BTC dominated the others. 2) Volume analysis found BTC peaked in May 2022 when prices decreased and people sold assets. 3) Moving averages and candlestick charts visualized price trends and volatility over time. 4) Metrics like daily returns and correlation showed DOGE and XRP were highly volatile, while coins were generally correlated with BTC most correlated to LTC.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Topic: Cryptocurrencies price analysis based on time series analysis.

The purpose of the project: Research price changes of selected


cryptocurrencies. Make a brief analysis of them and present the data in
the form of graphs for a visual demonstration. Also explore Python tools
that can be used to analyze price changes.

A time series is a sequence of digital data obtained at successive equal


time intervals. In the field of finance, such series are used to track price
movements over a certain period of time, recorded at equal intervals.
Tools based on which we can analyze cryptocurrencies:

 Graphs of price changes


 Volume
 The Market Cap
 Moving Average
 Candle Stick Charts
 Daily Percentage Change
 Correlation matrix
 Box Plots
 Cumulative return
Python tools used in this project:
Yahoo Finance To download stock data
Pandas To handle data frames in python
Numpy Numerical Python
Matplotlib Plotting graphs
To create Correlation matrix
Seaborn

Tensorflow To create Neural Network


Mplfinance To create Candle Stick Charts
І. Data Processing
Data for further analysis was obtained from the following link:
https://finance.yahoo.com
To work with this data source in Python, there is a Yahoo_fin
library that provides fast and convenient data parsing. We take data in US
dollars for the last two years for the following cryptocurrencies: Bitcoin
(BTC), Ethereum (ETH), Polygon (MATIC), Litecoin (LTC), XRP
(XRP), Dogecoin (DOGE).
An example of the data we can get for each currency:

date open high low close adjclose volume ticker


2021-01-13 1043.740967 1134.338501 994.549072 1130.739380 1130.739380 30109792795 ETH-USD
2021-01-14 1130.231201 1244.163086 1093.060791 1218.453003 1218.453003 33410915929 ETH-USD
2021-01-15 1221.877197 1250.505859 1090.721069 1171.834595 1171.834595 35972039310 ETH-USD
2021-01-16 1171.443115 1290.053589 1157.623779 1233.537598 1233.537598 32319240157 ETH-USD
2021-01-17 1233.453369 1265.644653 1174.388550 1230.172241 1230.172241 29258032819 ETH-USD

… … … … … … … …
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.

Formula: total_traded = open_price ∙ volume

The daily percentage change can be represented by the following


formulae: rt =Pt/Pt-1 -1, where

rt is the return at sub t,

Pt is the Price at time T,

Pt-1 is the price at time T-1.

The formulae goes as follows: it = (1 + rt)it-1, this is a recursive


formula, hence we have the name cumulative return.
Here's what the data looks like for BTC now:

We do the same for each currency.

In order to analyze the correlation of currency prices, it is necessary to


create a new dataset from the received data for each currency. For this we
will be using the Adjclose field.

Using the pandas library, we make a DataFrame:

date btc eth matic ltc xrp doge


2021-01-14 39187.328125 1218.453003 0.032831 152.084579 0.295438 0.009397
2021-01-15 36825.367188 1171.834595 0.034014 144.237549 0.280406 0.009369
2021-01-16 36178.140625 1233.537598 0.032768 144.265427 0.280188 0.009265
2021-01-17 35791.277344 1230.172241 0.034020 142.430817 0.277384 0.009067
2021-01-18 36630.074219 1257.279541 0.036053 152.144089 0.284769 0.009171
… … … … …. … …
2023-01-09 17196.554688 1321.538940 0.844234 81.747314 0.349340 0.075784
2023-01-10 17446.292969 1336.586060 0.858464 80.887520 0.351241 0.077729
2023-01-11 17934.896484 1387.932739 0.893428 84.070312 0.374158 0.078153
2023-01-12 18869.587891 1417.938477 0.916289 85.964226 0.375197 0.080286

II. Data analysis


1) Graphs of price changes for each currency
BTC
ETH

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.

So as we can see the volumes increased, when the currency price


decreased. And and everyone started selling their assets dramatically.

3) Analyzing The Market Cap


The time series graph shows us that there was a huge amount of Total
Traded for BTC in May. So we want the position of that spike.

The peak happened on February the 26th 2021

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

5) Candle Stick Charts


We now want to plot candlestick charts, with these glamourous
charts we can see the open, close, high and low all in one chart. We will
start by bringing in the mplfinance library.
6) Daily Percentage Change
The daily percentage change can be represented by the following
formulae: rt =Pt/Pt-1 -1.

What the rt value report is a percentage gain or loss. Say we bought


the coin on day t-1 and we sold it at day t. If we gained then Pt should be
grater than Pt-1. So the ratio should be greater than 1 and hence rt would
be positive.

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

One way to quantify this relationship is to use the Pearson


correlation coefficient, which is a measure of the linear association
between two variables. It has a value between -1 and 1 where:

 -1 indicates a perfectly negative linear correlation between two


variables
 0 indicates no linear correlation between two variables
 1 indicates a perfectly positive linear correlation between two
variables

The further away the correlation coefficient is from zero, the stronger the
relationship between the two variables.

We adjusted value vmin=0.5 according to values in results to have a nice


plot.
As we can see from picture above, all our coins correlate with each
other. The biggest correlation exist between BTC and LTC. The lowest
correlation has MATIC and all other coins.
8) Box Plots
Also another useful tool you can use for information
representation. We will call the pandas box method.

The daily percentage change of DOGE, MATIC and XRP is taller


than the others, this means those coins are more volatile.
9) Cumulative return
The formulae for this goes as follows; it = (1 + rt)it-1, this is a
recursive formula, hence we have the name cumulative return.

We multiply ‘it-1’ with the factor of ‘1+rt’, rt was used earlier on


and it is called the daily percentage change. Cumulative returns are the
answer to the question all investors ask.
Cumulative return is computed the day investment was made, if the
cumulative return is above 1, then you are making profit.

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!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy