Type: Package
Title: Download historical FX-data from 'Pacific Exchange Rate Service'
Version: 0.1-3
Date: 2018-09-04
Author: Enrico Schumann
Maintainer: Enrico Schumann <es@enricoschumann.net>
Description: Download historical FX-data from 'Pacific Exchange Rate Service'.
License: GPL-3
LazyLoad: yes
NeedsCompilation: no
Packaged: 2024-04-07 16:48:27 UTC; es19
Built: R 4.5.0; ; 2024-04-07 16:48:28 UTC; unix

Download historical FX data

Description

Download historical FX data from the PACIFIC Exchange Rate Service, run by Werner Antweiler at Sauder School of Business, University of British Columbia. Visit the homepage http://fx.sauder.ubc.ca/ to learn more.

Usage

fetchFX(baseCurrency = "USD", targetCurrencies = c("EUR", "JPY"),
        startDate = "2010-01-01",endDate,
        dataFrequency = "daily", notation = "volume")

Arguments

baseCurrency

base currency (eg, "EUR")

targetCurrencies

target currency; can be a vector like c("CHF", "USD")

startDate

a length-one vector of class Date, or a length-one vector of class character in ISO 8601 format (ie, YYYY-MM-DD)

endDate

a length-one vector of class Date, or a length-one vector of class character in ISO 8601 format (ie, YYYY-MM-DD). If missing, the current date is used.

dataFrequency

a length-one character vector: either "daily", "weekly" or "monthly"

notation

a length-one character vector: either "volume" or "price"

Details

The database is for academic purposes only. Please see the FAQ at http://fx.sauder.ubc.ca/FAQ.html for the terms of use.

There are two types of quoting convention, set through the argument notation. Volume notation: how many units of the targetCurrency do I have to give for one unit of the baseCurrency? Price notation: how many units of the baseCurrency do I have to give for one unit of the targetCurrency?

The web interface to the database restricts daily and weekly data to no more four calendar years per download. fetchFX will automatically loop in such cases (but will add a delay of one second in each iteration).

Value

The function returns a data.frame. Column "Jul.Dates" contains the Julian dates (see http://fx.sauder.ubc.ca/julian.html) in numeric form; column "Dates" the calendar dates (class Date); the following columns contain the exchange rates.

Note

In the FX markets, currencies are typically quoted as FX1FX2, which reads ‘How many units of FX2 do I have to give to get one unit of FX1?’ For instance, EURUSD means ‘how many dollars do I have to give for one euro?’ This is not how currencies are labelled in the PACIFIC Exchange Rate Service.

Author(s)

Enrico Schumann

Maintainer: Enrico Schumann <es@enricoschumann.net>

Examples

## Not run: 
x <- fetchFX("USD", targetCurrencies = c("EUR", "AUD"),
             startDate = as.Date("2006-01-01"),
             endDate   = as.Date("2011-10-01"),
             dataFrequency = "weekly",
             notation = "price")
head(x, 3L)
tail(x, 3L)
## End(Not run)

Download historical FX data

Description

Download historical FX data from the PACIFIC Exchange Rate Service, run by Werner Antweiler at Sauder School of Business, University of British Columbia. Visit the homepage http://fx.sauder.ubc.ca/ to learn more.

The database is for academic purposes only. Please see the FAQ at http://fx.sauder.ubc.ca/ for the conditions of use.

Author(s)

Enrico Schumann

Maintainer: Enrico Schumann <es@enricoschumann.net>