Skip to content

Commit e38b490

Browse files
committed
fix: cache filenames for stocks_hist
1 parent 7589501 commit e38b490

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: lares
22
Type: Package
33
Title: Analytics & Machine Learning Sidekick
4-
Version: 5.2.11.9002
4+
Version: 5.2.11.9003
55
Authors@R: c(
66
person("Bernardo", "Lares", , "laresbernardo@gmail.com", c("aut", "cre")))
77
Maintainer: Bernardo Lares <laresbernardo@gmail.com>

R/stocks.R

+1-7
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ stocks_hist <- function(symbols = c("VTI", "META"),
182182
cache = TRUE,
183183
quiet = FALSE,
184184
...) {
185-
cache_file <- c(
186-
as.character(Sys.Date()), "stocks_hist",
187-
symbols, sum(as.integer(as.Date(from)), as.integer(as.Date(to)))
188-
)
185+
cache_file <- c(as.character(Sys.Date()), "stocks_hist")
189186
if (cache_exists(cache_file) && cache) {
190187
results <- cache_read(cache_file, quiet = quiet)
191188
return(results)
@@ -1087,7 +1084,6 @@ etf_sector <- function(etf = "VTI", quiet = FALSE, cache = TRUE) {
10871084
if ("daily_stocks" %in% attr(etf, "type")) {
10881085
etf <- as.character(unique(etf$Symbol[etf$Date == max(etf$Date)]))
10891086
}
1090-
10911087
cache_file <- c(as.character(Sys.Date()), "etf_sector", etf)
10921088
if (cache_exists(cache_file) && cache) {
10931089
results <- cache_read(cache_file, quiet = quiet)
@@ -1156,9 +1152,7 @@ etf_sector <- function(etf = "VTI", quiet = FALSE, cache = TRUE) {
11561152
#' @rdname stocks_plots
11571153
splot_etf <- function(s, keep_all = FALSE, cache = TRUE, save = FALSE) {
11581154
check_attr(s, check = "daily_stocks")
1159-
11601155
if (!"Date" %in% colnames(s)) s$Date <- Sys.Date()
1161-
11621156
cache_file <- c(as.character(Sys.Date()), "splot_etf", s)
11631157
if (cache_exists(cache_file) && cache) {
11641158
etfs <- cache_read(cache_file, quiet = quiet)

0 commit comments

Comments
 (0)