Your instruments you store in FinancialInstrument no direct dependence with what data you collect with getSymbols
. You define and remove instruments as desired from the hidden .instrument
environment in FinancialInstrument as desired, ideally using the helper functions below. Note that you can use getSymbols
obviously to get data, but you still want to define the instrument using an appropriate helper like below.
This code should be self explanatory but may help you understand what is going on.
> ls_instruments()
NULL
> stock("AAPL", currency = "USD")
Error in instrument(primary_id = primary_id, currency = currency, multiplier = multiplier, :
currency USD must be defined first
> currency("USD")
[1] "USD"
> stock("AAPL", currency = "USD")
[1] "AAPL"
> ls_instruments()
[1] "AAPL" "USD"
> currency("JPY")
[1] "JPY"
> exchange_rate("USDJPY", currency = "JPY")
[1] "USDJPY"
> getInstrument("USDJPY")
primary_id :"USDJPY"
currency :"JPY"
multiplier :1
tick_size :0.01
identifiers : list()
type :"exchange_rate" "currency"
counter_currency:"USD"
> ls_instruments()
[1] "AAPL" "JPY" "USD" "USDJPY"
> rm_stocks("AAPL")
> ls_instruments()
[1] "JPY" "USD" "USDJPY"
> rm_exchange_rates("USDJPY")
> ls_instruments()
[1] "JPY" "USD"