Compare Instrument Files

Description

Compare the .instrument environments of two files

Usage

1
CompareInstrumentFiles(file1, file2, ...)

Arguments

file1

A file containing an instrument environment

file2

Another file containing an instrument environment. If not provided, file1 will be compared against the currently loaded instrument environment.

...

Arguments to pass to all.equal.instrument

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.