By using the following code, I import data from the stock exchange, the Petrobras Ibovespa Index and the US S & P 500 Index. However, the dates of the observations are not exactly matched
# Carregar pacote de importação de dados da bolsa
library(BatchGetSymbols)
# Inputs
# data inicial
first.date <- as.Date("2017-01-01")
#data final
last.date <- Sys.Date()
#frequencia das observações
freq.data <- 'daily'
# Ativos a serem baixados
tickers <- c("^BVSP","PETR4.SA","^GSPC")
#função que baixa ativos
ativos <- BatchGetSymbols(tickers = tickers,
first.date = first.date,
last.date = last.date,
freq.data = freq.data,
cache.folder = file.path(tempdir(),
'BGS_Cache') )
Someone would know how to temporarily pause the data, that is, have only date observations with values for the three assets, eliminating from the data those dates where there is observation for only one or two assets.