Hi there. In this technology/programming post, I talk about an add-on to my Quandl financial application tool. This add-on extracts Bitfinex Crypto price data from Quandl's API.
With this data users can obtain price data where the output is a data table and a price chart rendered with plotly in the R programming language.
The Quandl app can be found here. Look for the Bitfinex Crypto Price Data tab on the left side.
About The Page
This Bitfinex Crypto Price Data App is a single page from my Quandl financial application tool. There are four panels on this page. The top left panel is an information panel. A drop down list picker is on the top right. The user can choose a crypto trading pair from Bitfinex. Once a crypto trading pair is chosen from the drop down list, a table of prices is shown on the bottom left panel along with a price chart rendered by Plotly for R on the bottom right panel.
Cryptos Covered
In this app I did not cover all the available Bitfinex crypto trading pairs from Quandl. Some of the crypto trading pairs are either not popular or are discontinued for me to include.
Here is the list of trading pair tickers that I have in this app.
- BTCUSD
- BTCEUR
- BTCJPY
- ETHUSD
- ETHBTC
- XRPUSD
- XRPBTC
- LTCUSD
- LTCBTC
- DSHUSD (DASH priced in USD)
- DSHBTC (DASH in BTC)
- ETCUSD
- ETCBTC
- BTGUSD
- XMRUSD
- XMRBTC
- ZECUSD
- ZECBTC
- EOSUSD
- EOSBTC
- EOSETH
- NEOUSD
- NEOBTC
- NEOETH
- OMGUSD
- OMGBTC
- OMGETH
Short Notes About The Code
I do not want to show too much code here as this app is done in R and with the RShiny package. R is already niche enough and then add in RShiny for interactive apps in R would make this code even more niche. This code is not that easy to understand as there are lot of parts. I can show some code snippets. (R installation of Quandl can be found here)
The code that is used for rendering the data table and chart outputs is here. Outputs are dependent from the crypto pair that is chosen from the user in the drop down menu. The crypto pair input is from input$cryptopair.
output$bitfinex_plot <- renderPlotly({
# Obtain data based on input
crypto_code <- paste0("BITFINEX/", input$cryptopair)
crypto_df <- data.frame(Quandl(crypto_code))
#housing_cmhc_tidy % gather('Average', 'Median', key = "Measure", value = "Price")
# Plotting last prices
plot_ly(data = crypto_df, x = ~Date, y = ~Last) %>%
add_lines() %>%
layout(title = paste0("Crypto Prices For ", input$cryptopair, "\n"),
xaxis = list(title = "Date"),
yaxis = list (title = "Price"))
})
output$bitfinex_table <- renderDataTable({
df <- data.frame(Quandl(paste0("BITFINEX/", input$cryptopair)))
df
})
The crypto pair input is from the panel with the drop down menu. Partial R & RShiny code is shown below.
# Partial Code, not all crypto trading pairs listed
box(
status = "success", width = 6,
selectInput("cryptopair", label = h4("Select Crypto Pair"),
choices = list("Bitcoin / US Dollar (BTC/USD)" = "BTCUSD",
"Bitcoin / Euro (BTC/EUR)" = "BTCEUR",
"Bitcoin / Japanese Yen (BTC/JPY)" = "BTCJPY",
"Ethereum / US Dollar (ETH/USD)" = "ETHUSD",
"Ethereum / Bitcoin (ETH/BTC)" = "ETHBTC",
"Ripple / US Dollar (XRP/USD)" = "XRPUSD",
"Ripple / Bitcoin (XRP/BTC)" = "XRPBTC",
"Litecoin / US Dollar (LTC/USD)" = "LTCUSD",
"Litecoin / Bitcoin (LTC/BTC)" = "LTCBTC"),
selected = "BTCUSD",
width = '600px',
selectize = FALSE)
)
Future Works
I could update this app to include some technical indicators such as Relative Strength Index (RSI), MACD, moving averages and Bollinger bands. When I get to it I can update this app to include these technical indicators along with the price charts.