CompareInstrumentFiles {FinancialInstrument} | R Documentation |
Compare Instrument Files
Description
Compare the .instrument environments of two files
Usage
CompareInstrumentFiles(file1, file2, ...)
Arguments
file1 |
A file containing an instrument environment |
file2 |
Another file containing an instrument environment. If not
provided, |
... |
Arguments to pass to |
Details
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.
Value
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
).
Author(s)
Garrett See
See Also
saveInstruments
, all.equal.instrument
Examples
## 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)