# Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Cryptocurrency data retrieval

Contributed by: Anton Antonov

Cryptocurrency data retrieval using function signatures very similar to FinancialData.

To install this paclet in your Wolfram Language environment,
evaluate this code:

`PacletInstall["AntonAntonov/CryptocurrencyData"]`

To load the code after installation, evaluate this code:

`Needs["AntonAntonov`CryptocurrencyData`"]`

CryptocurencyData[*name*]

gives daily closing price data for the cryptocurrency *name*.

CryptocurencyData[*name*,*start*]

gives daily closing price data for the cryptocurrency *name* from *start* to current date.

CryptocurencyData[*name*,{*start*,*end*}]

gives daily closing price data for the cryptocurrency *name* from *start* to *end*.

CryptocurencyData[*name*,*prop*,{*start*,*end*}]

gives value of the specified property for the cryptocurrency *name* from *start* to *end*.

Generally speaking, CryptcurrencyData adheres to the signatures design of FinancialData, but there are a number of differences.

CryptocurrencyData caches the source-retrived-and-processed data in order to provide results faster.

Here are the options taken:

Currency | USD | currency |

LedgerStart | {2009, 1, 3} | ledger start date |

Quantities | False | wether quantity units to be used or not |

ResultType | TimeSeries | type of the result |

Source | YahooFinance | source for cryptocurrency data |

Here is time series for Bitcoin (BTC):

In[1]:= |

Out[1]= |

In[2]:= |

Out[2]= |

Here is trading volume time series for BTC since 2018:

In[3]:= |

Out[3]= |

Get trading volume data for Bitcoin (BTC) and Ether (ETH) since January 1st 2022:

In[4]:= |

Out[4]= |

Here is the corresponding plot:

In[5]:= |

Out[5]= |

Here are time series of different properties for Bitcoin (BTC) and Ether (ETH):

In[6]:= |

Out[6]= |

Instead of time series we can get Dataset objects instead:

In[7]:= |

Out[7]= |

Get the cryptocurrency summary data from Yahoo Finance:

In[8]:= |

Out[8]= |

Get all classes of metadata and show the corresponding metadata values:

In[9]:= |

Out[9]= |

Get Bitcoin (BTC) data from the exchange "coinbase":

In[10]:= |

Out[10]= |

Cryptocurrencies symbols and names:

In[11]:= |

Out[11]= |

Currencies that can be used CryptocurrencyData:

In[12]:= |

Out[12]= |

Exchanges that can be used in CryptocurrencyData with the option "Source" set to "DataBitcoinityOrg":

In[13]:= |

Out[13]= |

The option "Currency" specifies the currency of the results. It is expected to be one of:

In[14]:= |

Out[14]= |

Here are examples of opening prices of Ether (ETH) with different currencies:

In[15]:= |

Out[15]= |

The option "LedgerStart" specifies the start date of the cryptocurrency ledger. That start date is used when retrieval of all values is specified.

If the option "ResultType" is set to TimeSeries, then the option "Quantities" specifies weather the result time series should be with numeric values with quantity values.

Here we obtain Ether opening price time series:

In[16]:= |

Out[16]= |

Here from each time series the values are extracted:

In[17]:= |

Out[17]= |

QuantityArray is used in order to have faster data retrieval. After normalizing the results we see the actual quantities and values:

In[18]:= |

Out[18]= |

Note that for trading volume the unit "Items" is used, since there is not unit "Coins":

In[19]:= |

Out[19]= |

The option "ResultType" specifies the type of the results. It is expected to be Automatic, Dataset, or TimeSeries. Automatic is the same as TimeSeries. Here is are examples:

In[20]:= |

Out[20]= |

The option "Source" specifies the data source. It is expected to be Automatic, "YahooFinance", "YF", "DataBitcoinityOrg", or "DBO". The abbreviations "YF" and "DBO" correspond to the "YahooFinance" and "DataBitcoinityOrg" respectively. With "YahooFinance" data from the page https://finance.yahoo.com/cryptocurrencies is used. With "DataBitcoinityOrg" data from https://data.bitcoinity.org is used. Here are examples:

In[21]:= |

Out[21]= |

Find 100-day moving averages of a opening price of BTC:

In[22]:= |

Out[22]= |

Find the summary of the opening price daily differences for BTC for the passed two years:

In[23]:= |

Out[17]= |

Plot a histogram of the corresponding to log 10 of the absolute values:

In[24]:= |

Out[24]= |

Note the summary and plot above demonstrate the volatility of BTC.

Show the top eight "priciest" cryptocurrencies using data from the last two weeks:

In[25]:= |

Out[26]= |

Plot the opening prices of top cryptocurrencies since 2018:

In[27]:= |

Out[28]= |

FinancialData has ten of the cryptocurrencies for which CryptocurrencyData can provide data for (through Yahoo Finance.) Here are the cryptocurrencies FinancialData knows the prices of:

In[29]:= |

Out[29]= |

Here is a time series for ETH:

In[30]:= |

Out[30]= |

FinancialData does not provide cryptocurrency data other than price (e.g. trading volume, etc.) or data from different exchanges. Here are examples of a *failed* retrieval:

In[31]:= |

Out[31]= |

Also, FinancialData returns cryptocurrency results without units. See comparison with stocks:

In[32]:= |

Out[32]= |

Here is a 30 day moving average of the price of BTC with using FinancialData:

In[33]:= |

Out[33]= |

Here is a 30 day moving average of the price of BTC with using CryptocurrencyData:

In[34]:= |

Out[34]= |

Plot passed year opening prices and trading volumes of the top cryptocurrencies:

In[35]:= |

Out[32]= |

Compute correlations between the passed year time series of the top cryptocurrencies:

In[36]:= |

Out[37]= |