Skip to content
Prev 10759 / 15274 Next

Removing instruments...

Hi Worik,

Either of these will do it
    rm_exchange_rates("AUDCAD")
    rm_instruments("AUDCAD", keep.currencies=FALSE)

The reason rm_instruments has a keep.currencies argument is because I
was frustrated that currencies have to be defined before anything
else.  So, I made it a little more work to delete them.  exchange_rate
instruments get treated like currencies because they inherit the
'currency' class (although, personally, I don't think they should).

You could also backup your .instrument environment before
experimenting, then reload it.

You could either back it up by saving it via saveInstruments(), or,
simply convert it to a list and assign it to something.

    tmppdir <- tempdir()
    saveInstruments("test", dir=tmpdir)

    bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)

Now, you can revert to a backed up version like this

    reloadInstruments('test', dir=tmpdir)

or

    reloadInstruments(bak)


reloadInstruments(bak) is equivalent to
    rm_instruments(keep=FALSE)
    loadInstruments(bak)

HTH,
Garrett
On Mon, Sep 17, 2012 at 11:09 PM, Worik Stanton <worik.stanton at gmail.com> wrote: