Lab 6: 🪙 Crypto yield

Probability and Statistics

Input

We decided to analyze the yields of two cryptocurrencies. But before investing in one or the other currency, it is necessary to study the distributions of these yields.

Task

Important

We expect all the results to be interpreted in the task context.

Data

Gather data on two cryptocurrencies at the close of the stock exchange for the last few days. For each cryptocurrency, determine its yield per day.

Formula for calculating the yield:

\[ \text{Yield} = \frac{P_{t} - P_{t-1}}{P_{t-1}} \times 100\% = \log\left(\frac{P_{t}}{P_{t-1}}\right) \times 100\% \]

where \(P_{t}\) is the price of the cryptocurrency at time \(t\).

The cryptoQuotes package for R can be used as a data source. For example, the following code can be used to collect data on the bitcoin rate:

library(tidyverse)
library(cryptoQuotes)

BTC <- cryptoQuotes::get_quote(
1  ticker   = 'BTCUSDT',
2  source   = 'binance',
3  futures  = TRUE,
4  interval = '1d',
5  from     = Sys.Date() - 199
) %>% 
6  as_tibble()
1
‘ticker’ - a cryptocurrency ticker.
2
source - the exchange from which we receive data.
3
Futures - futures.
4
interval - data interval.
5
from - the date of the start of data collection (the Sys.Date() function returns the current date).
6
as_tibble() - converting data to the tibble format.
open high low close volume
58648.1 59820.0 55969.0 57511.0 360815.95
57511.1 59780.2 57062.1 58854.9 268756.53
58854.9 59690.2 58769.4 59468.5 77085.53
59468.5 60250.0 58352.0 58390.0 149660.26
58390.1 59585.4 57750.0 59398.5 214043.14
59398.4 61386.0 58501.1 58982.9 287049.13
Tips for using the cryptoQuotes package
  • available_tickers() - available tickers.
  • available_exchanges() - available exchanges.
  • available_intervals() - available intervals.

How to analyze the yield

  1. Collect data on the yield of two cryptocurrencies.
  2. Use statistical methods to analyze the yield distributions.
  3. Use visualizations to compare the yield distributions of the two cryptocurrencies.
  4. Check the normality of the yield distribution for each cryptocurrency1.
  5. Write conclusions based on the analysis of the yield distributions.
Note

You can further compare the average returns using appropriate hypotheses and tests.

Footnotes

  1. We expect you to use all the methods we learned in class to test the normality of a distribution.↩︎