Closed gabBelle closed 2 years ago
Exemples:
t_1y = '2020-07-01' t = '2021-07-01'
brl_usd <- get_currency('USD', t_1y, t) %>% select(-bid) %>% rename(brl_usd = 2)
brl_eur <- get_currency('EUR', t_1y, t) %>% select(-bid) %>% rename(brl_eur= 2)
brl_gbp <- get_currency('GBP', t_1y, t) %>% select(-bid) %>% rename(brl_libra = 2)
brl_cny <- get_currency('CNY', t_1y , t) %>% select(-bid) %>% rename(brl_cny = 2)
With reprex:
library(dplyr, warn.conflicts = FALSE)
library(rbcb)
t_1y = '2020-07-01'
t = '2021-07-01'
brl_usd <- get_currency('USD', t_1y, t) %>%
select(-bid) %>%
rename(brl_usd = 2)
#> Error in curl::curl_fetch_memory(url, handle = handle): Recv failure: Connection was reset
brl_eur <- get_currency('EUR', t_1y, t) %>%
select(-bid) %>%
rename(brl_eur= 2)
#> Error in curl::curl_fetch_memory(url, handle = handle): Recv failure: Connection was reset
brl_gbp <- get_currency('GBP', t_1y, t) %>%
select(-bid) %>%
rename(brl_libra = 2)
#> Error in curl::curl_fetch_memory(url, handle = handle): Recv failure: Connection was reset
brl_cny <- get_currency('CNY', t_1y , t) %>%
select(-bid) %>%
rename(brl_cny = 2)
#> Error in curl::curl_fetch_memory(url, handle = handle): Recv failure: Connection was reset
Created on 2021-07-02 by the reprex package (v2.0.0)
It seems the problem happens in rbcb:::http_getter()
.
The problem relies on the URL
http://www4.bcb.gov.br/Download/fechamento/M%s.csv
Used inside the function get_valid_currency_list
This URL is completely inaccessible, as I can see with PS Test-NetConnection
.
There is a new API to get access to currency data. I will try, in the next days, to port rbcb to this new API. For now, all we have to do is wait for BCB to reconnect its servers.
whenever I try to use the function get_currency all I can get is:
Error in curl::curl_fetch_memory(url, handle = handle) : Recv failure: Connection was reset