| saveSymbols.days | R Documentation |
Save data to disk the way that getSymbols.FI
expects it to be saved.
saveSymbols.days(Symbols, base_dir = "", extension = "rda", env = .GlobalEnv)
saveSymbols.common(Symbols, base_dir = "", extension = "rda", env = .GlobalEnv)
Symbols |
character vector of names of objects to be saved |
base_dir |
character. directory in which to store data. |
extension |
file extension (“rda”) |
env |
environment that holds the data to be saved (.GlobalEnv by default) |
If they do not already exist, subdirectories will be created for each of the
Symbols. saveSymbols.common will save a single ‘rda’
file for each of the Symbols in that symbol's subdirectory.
saveSymbols.days will split the data up into days and save a separate
‘rda’ file for each day in that symbol's subdirectory.
called for side-effect.
getSymbols.FI
example_dir <- tempfile("fi-symbol-data-")
dir.create(example_dir)
example_env <- new.env()
example_env$SPY <- xts::xts(
matrix(
1:8,
ncol = 2L,
dimnames = list(
NULL,
c("Close", "Volume")
)
),
order.by = as.Date("2020-01-01") + 0:3
)
tryCatch(
{
saveSymbols.common(
"SPY",
base_dir = example_dir,
env = example_env
)
list.files(
example_dir,
recursive = TRUE
)
},
finally = {
unlink(example_dir, recursive = TRUE)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.