CompareInstrumentFiles {FinancialInstrument} | R Documentation |
Compare the .instrument environments of two files
CompareInstrumentFiles(file1, file2, ...)
file1 |
A file containing an instrument environment |
file2 |
Another file containing an instrument environment. If not
provided, |
... |
Arguments to pass to |
This will load two instrument files (created by
saveInstruments
) and find the differences between them. In
addition to returning a list of difference that are found, it will produce
messages indicating the number of instruments that were added, the number of
instruments that were removed, and the number of instruments that are
different.
A list that contains the names of all instruments that were added,
the names of all instruments that were removed, and the changes to all
instruments that were updated (per all.equal.instrument
).
Garrett See
saveInstruments
, all.equal.instrument
## Not run:
#backup current .instrument environment
bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
old.wd <- getwd()
tmpdir <- tempdir()
setwd(tmpdir)
rm_instruments(keep=FALSE)
# create some instruments and save
stock(c("SPY", "DIA", "GLD"), currency("USD"))
saveInstruments("MyInstruments1")
# make some changes
rm_stocks("GLD")
stock("QQQ", "USD")
instrument_attr("SPY", "description", "S&P ETF")
saveInstruments("MyInstruments2")
CompareInstrumentFiles("MyInstruments1", "MyInstruments2")
#Clean up
setwd(old.wd)
reloadInstruments(bak)
## End(Not run)