knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of cryptoapi is to be a wrapper that imports and analyzes data from Binance, Binance US, Bitstamp, Bittrex, Coinbase, Coinbase Pro, Crypto.com, FTX, FTX US, Gemini, Huobi, Kraken, Kucoin, and Poloniex.
Use at your own risk.
You can install the development version of cryptoapi from GitHub with:
# install.packages("devtools") devtools::install_github("cstjohn810/cryptoapi")
library(cryptoapi) library(magrittr)
Can pull out the current ticker price of any asset from any exchange:
public_ticker_price(exchange = "binance", base_asset = "BTC", quote_asset = "USD")
Alternatively, get extra price information by toggling the price_only option:
public_ticker_price(exchange = "ftx", base_asset = "BTC", quote_asset = "USD", price_only = FALSE)
If necessary, find the available assets for any exchange:
public_asset_list(exchange = "crypto.com")
View order book for varying depths:
public_order_book(exchange = "coinbase-pro", level = 2)
View candle information (OHLC):
public_candles("gemini", time_frame = "1m")
View recent trades:
public_trades(exchange = "kraken")
View additional asset information:
public_asset_info("gemini")
Set API Keys as environment variables: In normal usage, do not set the key value in the initial function call. Leave it NULL and input the key into the askpass popup window. You may optionally specify a separate portfolio if you have multiple in a single exchange.
set_api_key(exchange = "binance", key_type = "test", portfolio = "default")
Get coin balance. Currently only coinbase-pro is supported. You may optionally specify a separate portfolio if you have multiple in a single exchange.
private_balance(exchange = "coinbase-pro", portfolio = "default")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.