redenominate: Redenominate (change the base of) an instrument

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Redenominate (change the base of) an instrument

Usage

1
2
redenominate(x, new_base = "USD", old_base = NULL, EOD_time = "15:00:00",
  env = .GlobalEnv, silent = FALSE)

Arguments

x

can be either an xts object or the name of an instrument.

new_base

change the denomination to this; usually a currency.

old_base

what is the current denomination?

EOD_time

If data need to be converted to daily, this is the time of day to take the observation.

env

environment that holds the data

silent

silence warnings?

Details

If old_base is not provided, x must be the name of an instrument (or an object with the name of a defined instrument) so that the currency attribute of the instrument can be used. Otherwise, old_base must be provided.

If you want to convert to JPY something that is denominated in EUR, you must have data for the EURJPY (or JPYEUR) exchange rate. If you don't have data for EURJPY, but you do have data for EURUSD and USDJPY, you could redenominate to USD, then redenominate to EUR, but this function is not yet smart enough to do that for you.

See the help for buildRatio also.

Value

xts object, with as many columns as practicable, that represents the value of an instrument in a different currency (base).

Note

this does not yet define any instruments or assign anything.

Author(s)

Garrett See

See Also

buildRatio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
require(quantmod)
EURUSD <- getSymbols("EURUSD=x",src='yahoo',auto.assign=FALSE)
GLD <- getSymbols("GLD", src='yahoo', auto.assign=FALSE)
GLD.EUR <- redenominate(GLD,"EUR","USD") #can call with xts object

currency("USD")
stock("GLD","USD")
GLD.EUR <- redenominate('GLD','EUR') #can also call with instrument name

## End(Not run)

FinancialInstrument documentation built on May 2, 2019, 3:41 a.m.