Introduction

Getting cryptocurrency market data in R is now a simple process with the introduction of the cryptoQuotes-package. Its a high-level API-client that provides access to historical cryptocurrency market data, and sentiment indicators.

Getting Bitcoin market data in R

Below is an example of getting hourly Bitcoin (BTC) prices in R, using the getQuote()-function - in this example we use BitMart as the source.

Note: cryptoQuotes supports all major exchanges. See the availableExchanges()-function for an indepth overview.

## Get BTC prices
## from BitMart
BTC <- cryptoQuotes::getQuote(
  ticker = "BTCUSDT",
  source = "bitmart",
  interval = "1h"
)

Charting with Bollinger-Bands and MACD

The returned BTC is an xts-object, which can be passed directly into the quantmod::chartSeries()-function. See below,

## charting
## BTC with Bollinger Bands
quantmod::chartSeries(
  x = BTC,
  type = "candlesticks",
  theme = quantmod::chartTheme(theme = "white"),
  TA = c(quantmod::addBBands(), quantmod::addMACD())
)

Installation

Stable version

# install from CRAN
install.packages(
  pkgs = 'cryptoQuotes',
  dependencies = TRUE
)

Development version

# install from github
devtools::install_github(
  repo = 'https://github.com/serkor1/cryptoQuotes/',
  ref  = 'main'
)