MyNixOS website logo
Description

A Streamlined Access to Cryptocurrency OHLC-V Market Data and Sentiment Indicators.

This high-level API client offers a streamlined access to public cryptocurrency market data and sentiment indicators. It features OHLC-V (Open, High, Low, Close, Volume) that comes with granularity ranging from seconds to months and essential sentiment indicators to develop and backtest trading strategies, or conduct detailed market analysis. By interacting directly with the major cryptocurrency exchanges this package ensures a reliable, and stable, flow of market information, eliminating the need for complex, low-level API interactions or webcrawlers.

cryptoQuotes: Open access to cryptocurrency market data cryptocurrency in R

CRANstatus CRAN RStudio mirrordownloads R-CMD-check codecov Lifecycle:stable GitHub last commit(branch)

:information_source: About

The cryptoQuotes-package is a high-level API client for accessing public market data endpoints on major cryptocurrency exchanges. It supports open, high, low, close and volume (OHLC-V) data and a variety of sentiment indicators; the market data is high quality and can be retrieved in intervals ranging from seconds to months. All the market data is accessed and processed without relying on crawlers, or API keys, ensuring an open, and reliable, access for researchers, traders and students alike. There are currently 5 supported cryptocurrency exchanges,

Supported exchanges
binance bitmart bybit kraken kucoin

All data is returned as xts-objects which enables seamless interaction with with quantmod and TTR, for developing and evaluating trading strategies or general purpose cryptocurrency market analysis with a historical or temporal perspective.

:information_source: Overview

The cryptoQuotes-package has two main features; retrieving cryptocurrency market data, and charting. The market data consists of OHLC-V data and sentiment indicators; including, but not limited to, cryptocurrency fear and greed index, long-short ratio and open interest. All market data is retrieved using the family of get_*-functions. To get a full overview of the package and functionality please see the documentation on pkgdown.

Note: Given the nature of crypotcurrency data and general legislative restrictions, some exchanges may not work in your geolocation.

Below is a quick overview of the package and basic usage examples on retrieving and charting Bitcoin (BTC) OHLC-V and long-short ratio in 30 minute intervals.

:information_source: Cryptocurrency market data

OHLC-V

All supported exchanges and markets are listed in the table below, alongside the available range of intervals available from the respective exchanges,

Supported exchanges, markets and intervals.
Exchange Spot Futures Available Intervals Smallest Interval Biggest Interval
Binance :white_check_mark: :white_check_mark: 16 1 second(s) 1 month(s)
Bitmart :white_check_mark: :white_check_mark: 13 1 minute(s) 1 week(s)
Bybit :white_check_mark: :white_check_mark: 13 1 minute(s) 1 month(s)
Kraken :white_check_mark: :white_check_mark: 10 1 minute(s) 2 week(s)
Kucoin :white_check_mark: :white_check_mark: 13 1 minute(s) 1 week(s)
Example: Bitcoin OHLC-V

Get USDT denominated Bitcoin (BTC) on the spot market from Binance in 30m-intervals using the get_quote()-function,

## BTC OHLC prices
## from Binance spot market
## in 30 minute intervals
BTC <- cryptoQuotes::get_quote(
  ticker   = 'BTCUSDT',
  source   = 'binance',
  futures  = FALSE,
  interval = '30m',
  from     = Sys.Date() - 1 
)
Bitcoin (BTC) OHLC-V data
index open high low close volume
2024-05-31 18:00:00 67215.58 67352.41 66670 67000.01 2093.77494
2024-05-31 18:30:00 67000.01 67221.53 66876.8 67200.01 788.25693
2024-05-31 19:00:00 67200.01 67459.66 67160.3 67417.98 598.68095
2024-05-31 19:30:00 67417.98 67455.93 67287.97 67342.77 287.26257
2024-05-31 20:00:00 67342.77 67444.47 67288.2 67305.5 383.04002
2024-05-31 20:30:00 67305.5 67427.68 67170 67400 468.98276

Sentiment indicators

The sentiment indicators available in the cryptoQuotes-package can be divided in two; derived indicators and market indicators. The former is calculated based on, for example, the price actions such as the Moving Average Convergence Divergence (MACD) indicator. The latter are public indicators such as the long-short ratio or fear and greed index; these are retrieved using the family of get_*-functions, while the derived indicators can be created using, for example, TTR.

In this overview we are focusing on market indicators made public by the cryptocurrency exchanges. For a full overview of sentiment indicators please refer to the documentation on pkgdown. All supported market indicators by exchange are listed in the table below,

Available sentiment indicators by exchange
Endpoint Binance Bitmart Bybit Kraken Kucoin
Long-Short Ratio :white_check_mark: :x: :white_check_mark: :white_check_mark: :x:
Open Interest :white_check_mark: :x: :white_check_mark: :white_check_mark: :x:
Funding Rate :white_check_mark: :x: :white_check_mark: :x: :white_check_mark:
Example: Bitcoin Long-Short Ratio

Get the long-short ratio on Bitcoin (BTC) using the get_lsratio()-function,

## BTC OHLC prices
## from Binance spot market
## in 30 minute intervals
BTC_LS <- cryptoQuotes::get_lsratio(
  ticker   = 'BTCUSDT',
  source   = 'binance',
  interval = '30m',
  from     = Sys.Date() - 1 
)
Long-Short Ratio on Bitcoin (BTC)
index long short ls_ratio
2024-05-31 18:00:00 0.679 0.321 2.114
2024-05-31 18:30:00 0.687 0.313 2.199
2024-05-31 19:00:00 0.696 0.304 2.289
2024-05-31 19:30:00 0.699 0.301 2.323
2024-05-31 20:00:00 0.696 0.304 2.288
2024-05-31 20:30:00 0.696 0.304 2.293

:information_source: Charting

Charting in the cryptoQuotes-package is built on plotly for interactivity. It supports light and dark themes, and accounts for color-deficiency via the options-argument in the chart()-function.

Charting with indicators

The OHLC-V data and the sentiment indicator can be charted using the chart()-function,

## Chart BTC
## using klines, SMA
## Bollinger Bands and
## long-short ratio
cryptoQuotes::chart(
  ticker = BTC,
  main   = cryptoQuotes::kline(),
  sub    = list(
    cryptoQuotes::lsr(ratio = BTC_LS),
    cryptoQuotes::volume()
  ),
  indicator = list(
    cryptoQuotes::sma(n = 7),
    cryptoQuotes::sma(n = 14),
    cryptoQuotes::sma(n = 21),
    cryptoQuotes::bollinger_bands()
  )
)
cryptocurrency charts in R
Colorblind friendly version

Charting with indicators (colorblind friendly)

## Chart BTC
## using klines, SMA
## Bollinger Bands and 
## ling-short ratio with color-deficiency
cryptoQuotes::chart(
  ticker = BTC,
  main   = cryptoQuotes::kline(),
  sub    = list(
    cryptoQuotes::lsr(ratio = BTC_LS),
    cryptoQuotes::volume()
  ),
  indicator = list(
    cryptoQuotes::sma(n = 7),
    cryptoQuotes::sma(n = 14),
    cryptoQuotes::sma(n = 21),
    cryptoQuotes::bollinger_bands()
  ),
  options = list(
    deficiency = TRUE
  )
)
cryptocurrency charts in R

:information_source: Installation

:shield: Stable version

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

:hammer_and_wrench: Development version

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

:information_source: Code of Conduct

Please note that the cryptoQuotes project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Metadata

Version

1.3.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows