Description Usage Arguments Details Value Author(s) See Also Examples
Saves (loads) the .instrument environment to (from) disk.
1 2 3 4 5 | saveInstruments(file_name = "MyInstruments", dir = "", compress = "gzip")
loadInstruments(file_name = "MyInstruments", dir = "")
reloadInstruments(file_name = "MyInstruments", dir = "")
|
file_name |
name of file. e.g. “MyInstruments.RData”.
As an experimental feature, a |
dir |
Directory of file (defaults to current working directory. ie. "") |
compress |
argument passed to |
After you have defined some instruments, you can use saveInstruments
to save the entire .instrument environment to disk.
loadInstruments
will read a file that contains instruments and add
those instrument definitions to your .instrument environment.
reloadInstruments
will remove all instruments in the current
.instrument environment before loading instruments from disk.
The file_name
should have a file extension of “RData”,
“rda”, “R”, or “txt”. If the file_name
does not
end with one of those, “.RData” will be appended to the
file_name
If the file extension is “R” or “txt”, saveInstruments
will create a text file of R code that can be source
d to
load instruments back into the .instrument environment.
Called for side-effect
Garrett See
save, load load.instrument define_stocks, define_futures, define_options (option_series.yahoo)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
stock("SPY", currency("USD"), 1)
tmpdir <- tempdir()
saveInstruments("MyInstruments.RData", dir=tmpdir)
rm_instruments(keep.currencies=FALSE)
loadInstruments("MyInstruments.RData", dir=tmpdir)
# write .R file that can be sourced
saveInstruments("MyInstruments.R", dir=tmpdir)
rm_instruments(keep.currencies=FALSE)
loadInstruments("MyInstruments.R", dir=tmpdir)
#source(file=paste(tmpdir, "MyInstruments.R", sep="/")) # same
unlink(tmpdir, recursive=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.