Assessing Systemic Risk in the Bittrex Cryptocurrency Market

Michael Kane

Yale University

Outline

What is the Bittrex cryptocurrency exchange?

 

How do you access the exchange from R?

 

How diverse are the returns of trading pairs the exchange?

What's a cryptocurrency

A digital asset, maintained on a blockchain

 

Decentralized

 

Supply of assets can be limited

 

Some people want these assets (there's demand)

 

Most popular is Bitcoin ($127,787,600,969)

What can you buy with cryptocurrencies?

Counterfeit Watches

Fake IDs

Cocaine with a Viking Stamp

Recently more legitimate things

Greek Villas

https://cointelegraph.com/news/15-amazing-things-you-can-buy-with-bitcoin-today

Yachts

https://cointelegraph.com/news/15-amazing-things-you-can-buy-with-bitcoin-today

Others

https://cointelegraph.com/news/15-amazing-things-you-can-buy-with-bitcoin-today

Miniature submarines

 

Small islands

 

Morganite (expensive rocks)

Guides for the Uninitiated

What's the ratio of prices between two cryptocurrencies?

Top 10 Exchanges

https://cryptocoincharts.info/markets/info

Why Bittrex?

Lot's of cryptocurrency pairs (290)

 

Large exchange

 

RESTful API

The bittrex R package

Simple, low-level client to the Bittrex exchange

 

Supports the public and private API

 

Part of the ROpenSci project

Getting a market summary in a few lines of code

> library(bittrex)
> bt_getmarketsummary("BTC-ETH")
$success
[1] TRUE

$message
[1] ""

$result
  market_name       high   low   volume       last base_volume
1     BTC-ETH 0.07779196 0.076 8840.273 0.07637027    681.4346
           time_stamp        bid        ask open_buy_orders open_sell_orders
1 2018-06-01 18:18:33 0.07630321 0.07637027            3303             5164
    prev_day             created
1 0.07679785 2015-08-14 09:02:24

Getting an orderbook

# Visualize the usd/btc orderbook in R
library(bittrex)
library(dplyr)
library(ggplot2)

bt_getorderbook("usdt-btc")$result %>%
  filter(rate < 2.5e4, rate > 5e3) %>%
  ggplot(aes(x=rate, fill=type)) + 
    geom_histogram(bins = 40) +
    theme_minimal() +
    xlab("Price") +
    ylab("Total Order Size") +
    ggtitle("Price of BTC in USDT")

Systemic risk

Financial products are often correlated (cointegrated) and returns may be influenced by common, underlying factors.

 

A change in an underlying factor can affect many stocks.

 

The more cointegrated a set of products are, the more susceptible they are to changes in the underlying factor.

If you own 2 stocks whose returns have correlation 1, do you really have 2 stocks?

What if you have a cryptocurrency exchange with 290 cryptocurrency pairs? 

L(\lambda, d) = || X - \hat{X}_d ||_F + \lambda d
L(λ,d)=XX^dF+λdL(\lambda, d) = || X - \hat{X}_d ||_F + \lambda d

Penalizing the Dimension in the SVD

Scale the returns, call it \( X \in \mathcal{R}^{n \times p} \)

 

Offset increase in approximation accuracy with the cost of adding a dimension

 

What should \( \hat{X} \) and \( \lambda \) be?

L(\lambda, d) = || X - U_d \Sigma_d V_d^T ||_F + \frac{d}{\sqrt{p}}
L(λ,d)=XUdΣdVdTF+dpL(\lambda, d) = || X - U_d \Sigma_d V_d^T ||_F + \frac{d}{\sqrt{p}}

Penalizing the Dimension in the SVD

The d-dimensional SVD approximation of X.

 

The square root of one over the number of columns of X.

Two virtual stock in a market of size 290 

The corresponding scree plot

What has the range of dimensions been for 2018 so far?

 

290 trading pairs.

1 - 4

Despite the variety of cryptos, returns are not well-differentiated

See me afterward if you are interested in

 

- 30-second data from Bittrex

 

- an R interface to the Ethereum blockchain

Thanks

Assessing Systemic Risk in the Bittrex Cryptocurrency Market

By Michael Kane

Assessing Systemic Risk in the Bittrex Cryptocurrency Market

My R Finance 2018 talk

  • 2,150