getMetals: Download Daily Metals Prices

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

Description

Download daily metals prices from oanda.

Usage

1
2
3
4
5
6
7
8
getMetals(Metals,
      from = Sys.Date() - 179,
      to = Sys.Date(),
      base.currency="USD",
      env = parent.frame(),
      verbose = FALSE,
      warning = TRUE,
      auto.assign = TRUE, ...)

Arguments

Metals

metals expressed in common name or symbol form

from

start date expressed in ISO CCYY-MM-DD format

to

end date expressed in ISO CCYY-MM-DD format

base.currency

which currency should the price be in

env

which environment should they be loaded into

verbose

be verbose

warning

show warnings

auto.assign

use auto.assign

...

additional parameters to be passed to getSymbols.oanda method

Details

A convenience wrapper to getSymbols(x,src='oanda').

The most useful aspect of getMetals is the ablity to specify the Metals in terms of underlying 3 character symbol or by name (e.g. XAU (gold) , XAG (silver), XPD (palladium), or XPT (platinum)).

There are unique aspects of any continuously traded commodity, and it is recommended that the user visit http://www.oanda.com for details on specific pricing issues.

See getSymbols and getSymbls.oanda for more detail.

Value

Data will be assigned automatically to the environment specified (parent by default). If auto.assign is set to FALSE, the data from a single metal request will simply be returned from the function call.

If auto.assign is used (the default) a vector of downloaded symbol names will be returned.

See getSymbols and getSymbols.oanda for more detail.

Author(s)

Jeffrey A. Ryan

References

Oanda.com http://www.oanda.com

See Also

getSymbols, getSymbols.oanda

Examples

1
2
3
4
5
6
7
## Not run: 

getFX(c("gold","XPD"))

getFX("plat",from="2005-01-01")

## End(Not run)

Example output

Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
[1] "gold" "XPD" 
Warning messages:
1: In getSymbols.oanda(Symbols = Currencies, from = from, to = to,  :
  incorrectly specified currency pair gold
2: In getSymbols.oanda(Symbols = Currencies, from = from, to = to,  :
  incorrectly specified currency pair XPD
[1] "plat"
Warning message:
In getSymbols.oanda(Symbols = Currencies, from = from, to = to,  :
  incorrectly specified currency pair plat

quantmod documentation built on April 13, 2018, 5:03 p.m.