Skip to content

Instantly share code, notes, and snippets.

@darh78
Created October 18, 2017 22:28
Show Gist options
  • Save darh78/c7a8ced86263d72389de96ab69f19730 to your computer and use it in GitHub Desktop.
Save darh78/c7a8ced86263d72389de96ab69f19730 to your computer and use it in GitHub Desktop.
EURIBOR 12 months
# Load required packages
library(Quandl)
library(dplyr, warn.conflicts = FALSE)
library(highcharter)
# Descarregar data de Quandl de Euribor a 12 meses
# https://www.quandl.com/data/BOF/QS_D_IEUTIO1A-EURIBOR-12-Months-Daily
EUR_12 <- tbl_df(Quandl("BOF/QS_D_IEUTIO1A", start_date = "2017-01-13"))
# Criar gráfico com cotações diarias do EURIBOR 12 meses
hchart(EUR_12, "line", hcaes(x = Date, y = Value)) %>%
hc_title(text = "EURIBOR a 12 meses - Diario") %>%
hc_subtitle(text = "Desde 13/01/2017") %>%
hc_credits(enabled = TRUE, # add credits
text = "Fonte: 'Quandl' R package") %>%
hc_yAxis(title = list(text = "%"),
plotLines = list( # adding an horizontal line
list(label = list(text = paste("Media:",
format(mean(EUR_12$Value),
digits = 3))),
color = "#0a7f2d",
width = 1,
value = mean(EUR_12$Value)))) %>%
hc_xAxis(title = list(text = "Data")) %>%
hc_add_theme(hc_theme_smpl()) %>%
hc_tooltip(valueDecimals = 3, # round the value to the thousandth
pointFormat = "<b>EUR12:</b> {point.y}% }", # title of the value
backgroundColor = "#fcf68a") # background of the tooltip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment