Я использую пакет R BatchGetSymbols
, чтобы получить цены акций на случайном подмножестве ниже. Я не понимаю, почему последняя дата, для которой он получает значения, - 1 мая 2020 года, тогда как текущая системная дата - 7 мая 2020 года. Вот мой воспроизводимый код.
library(BatchGetSymbols)
library(tidyverse)
# set dates
first.date <- Sys.Date() - 60
last.date <- Sys.Date()
freq.data <- 'daily'
# set tickers
tickers_test <- c("BXF.TO",
"CBH.TO",
"CBO.TO")
l.out <- BatchGetSymbols(tickers = tickers_test,
first.date = first.date,
last.date = last.date,
freq.data = freq.data)
Running BatchGetSymbols for:
tickers =BXF.TO, CBH.TO, CBO.TO
Downloading data for benchmark ticker
^GSPC | yahoo (1|1) | Found cache file
BXF.TO | yahoo (1|3) | Found cache file - Got 103% of valid prices | Looking good!
CBH.TO | yahoo (2|3) | Found cache file - Got 100% of valid prices | You got it!
CBO.TO | yahoo (3|3) | Found cache file - Got 100% of valid prices | Good stuff!>
df <- bind_rows(l.out$df.tickers, .id = "column_label")
p <-
ggplot(df, aes(x = ref.date, y = price.close))
p <- p +
geom_line(aes(group = ticker, colour = ticker)) +
theme(legend.position = "none")
p
max(df$ref.date)
[1] "2020-05-01"
last.date
[1] "2020-05-07"
Я пробовал добавление do.cache = FALSE, но с ошибкой ниже:
l.out <- BatchGetSymbols(tickers = tickers_test,
first.date = first.date,
last.date = last.date,
freq.data = freq.data,
cache.folder = my.temp.cache.folder, do.cache = FALSE)
Running BatchGetSymbols for:
tickers =BXF.TO, CBH.TO, CBO.TO
Downloading data for benchmark ticker
^GSPC | yahoo (1|1) - Error in download..
BXF.TO | yahoo (1|3) - Error in download..
CBH.TO | yahoo (2|3) - Error in download..
CBO.TO | yahoo (3|3) - Error in download..Warning messages:
1: Unknown or uninitialised column: `ticker`.
2: Unknown or uninitialised column: `threshold.decision`.
3: Unknown or uninitialised column: `ticker`.
4: Unknown or uninitialised column: `price.adjusted`.
5: Unknown or uninitialised column: `ticker`.
6: Unknown or uninitialised column: `price.close`.
7: Unknown or uninitialised column: `ticker`.