Skip to content

An R Package for the BitCoinCharts.com API which includes functions to acquire historic trade data, weighted prices, and market data.

Notifications You must be signed in to change notification settings

thospfuller/rbitcoinchartsapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn Twitter GitHub Email Coherent Logic Limited

rbitcoinchartsapi: An R Package for the Bitcoincharts.com API

Installing the rbitcoinchartsapi package from Drat

The following example demonstrates how to install the rbitcoinchartsapi from the Drat repository located on GitHub.

install.packages(c("drat", "logging", "RJSONIO", "RCurl"))
drat::addRepo("thospfuller")
install.packages("rbitcoinchartsapi", type = "source")

Next we'll explore several examples that demonstrate how to use the various functions available in this package.

Example 1: Introduction to the GetHistoricTradeData function

The GetHistoricTradeData function will return the 2000 most recent trades which are delayed by approximately 15 minutes.

The symbols that are available can be found here.

Calling this function with invalid parameters will result in an empty data frame.

library(rbitcoinchartsapi)
params <- list (symbol="bitstampUSD")
historicTradeData <- GetHistoricTradeData (params)
with(historicTradeData, plot(unixtime, price))
head(historicTradeData)

The rbitcoinchartsapi GetHistoricTradeData function in action!

Example 2: Introduction to the GetWeightedPrices function

The GetWeightedPrices function returns the weighted prices.

Bitcoincharts.com offers weighted prices for several currencies that can be used, for example, to price goods and services in Bitcoins -- this will yield much lower fluctuations than using a single market's latest price.

Weighted prices are calculated for the last 24 hours, 7 days and 30 days; if there are no trades during an interval, such as no trade within 24 hours, then no value will be returned.

weightedPrices <- GetWeightedPrices ()
head(weightedPrices)

The rbitcoinchartsapi GetWeightedPrices function in action!

Example 3: Introduction to the GetMarketData function

The GetMarketData function will return an array with elements for each market.

The symbols that are available can be found here.

params <- list (currency="USD")
usd <- GetMarketData (params)
head(usd)

The rbitcoinchartsapi GetMarketData function in action!