| CurrencyPairMethods {fmbasics} | R Documentation |
CurrencyPair methods
Description
A collection of methods related to currency pairs.
Usage
is_t1(x)
to_spot(dates, x)
to_spot_next(dates, x)
to_forward(dates, tenor, x)
to_today(dates, x)
to_tomorrow(dates, x)
to_fx_value(dates, tenor, x)
invert(x)
Arguments
x |
a |
dates |
a vector of dates from which forward dates are calculated |
tenor |
the tenor of the value date which can be one of the following:
"spot", "spot_next", "today", "tomorrow" and the usual "forward" dates (e.g.
|
Details
The methods are summarised as follows:
-
is_t1: ReturnsTRUEif the currency pair settles one good day after trade. This includes the following currencies crossed with the USD: CAD, TRY, PHP, RUB, KZT and PKR -
to_spot: The spot dates are usually two non-NY good day after today.is_t1()identifies the pairs whose spot dates are conventionally one good non-NYC day after today. In both cases, if those dates are not a good NYC day, they are rolled to good NYC and non-NYC days using the Following convention. -
to_spot_next: The spot next dates are one good NYC and non-NYC day after spot rolled using the Following convention if necessary. -
to_forward: Forward dates are determined using the calendar'sshift()method rolling bad NYC and non-NYC days using the Following convention. The end-to-end convention applies. -
to_today: Today is simply dates which are good NYC and non-NYC days. Otherwise today is undefined and returnsNA. -
to_tomorrow: Tomorrow is one good NYC and non-NYC day except where that is on or after spot. In that case, is is undefined and returnsNA. -
to_value: Determine common value dates. The supported value datetenorsare: "spot", "spot_next", "today", "tomorrow" and the usual "forward" dates (e.g.lubridate::months(3)). -
invert: Inverts the currency pair and returns newCurrencyPairobject. -
is.CurrencyPair: ReturnsTRUEifxinherits from theCurrencyPairclass; otherwiseFALSE
Examples
library(lubridate)
is_t1(AUDUSD())
dts <- lubridate::ymd(20170101) + lubridate::days(0:30)
to_spot(dts, AUDUSD())
to_spot_next(dts, AUDUSD())
to_today(dts, AUDUSD())
to_tomorrow(dts, AUDUSD())
to_fx_value(dts, months(3), AUDUSD())