This is my first R script ever. It's working to pull in stock quote data for some specific ticker symbols. Since data is only available for week days I don't have continuous dates in my output. How can I add Saturday and Sunday to my data and fill in the nulls with data from the prior friday?
library(BatchGetSymbols)
#df.SP500 <- GetSP500Stocks()
tickers <- c('AAPL','AMZN','ARLO','AUY','BP','CCL','CNK','CVX','DAL','DFS','DIS','EADSY','ENB','FB','GOOGL','HD','INTC','JNJ','JPM','KHC','KO','LUV','MRNA','MSFT','NET','NFLX','NVDA','PCG','PLAY','QCOM','RCL','RDS-B','RTX','SCHB','SCHH','SHV','SIX','SO','SPHD','SPLV','SPY','SPYD','T','TGT','TSLA','VNQ','VOO','VTI','VYM','VYMI','WFC','XBI','XOM')
# set dates
#first_date <- Sys.Date()-5*365
first_date <- Sys.Date()-365
last_date <- Sys.Date()
thresh_bad_data <- 0.95 # sets percent threshold for bad data
bench_ticker <- '^GSPC' # set benchmark as ibovespa
l_out <- BatchGetSymbols(tickers = tickers,
first.date = first_date,
last.date = last_date,
bench.ticker = bench_ticker,
thresh.bad.data = thresh_bad_data,
do.cache=FALSE)
result <- as.data.frame(l_out$df.tickers)
glimpse(l_out$df.tickers)