exchange_rate class constructor

Share:

Description

Quickly define several exhange rate instruments.

Usage

1
2
define_FX(pairs, counter_currencies = NULL, second_currencies = NULL,
  use.IB = TRUE, verbose = FALSE)

Arguments

pairs

chr names of currency pairs to be defined. Each currency pair name should be the base currency and base currency, separated by a period e.g. EUR.USD Optional.

counter_currencies

chr names of first currencies of pairs to define. Optional

second_currencies

chr names of second currencies of pairs to define. Optional

use.IB

call update_instruments.IB ?

verbose

if TRUE, it will print to screen every currency and exchange_rate that it defines.

Details

If nothing is given, 11 currency pairs will be defined: "EUR.USD", "USD.JPY", "GBP.USD", "USD.CHF", "AUD.USD", "USD.CAD", "NZD.USD", "USD.HKD", "USD.SGD", "GBP.JPY", "EUR.JPY" If pairs is given, it should be a vector of pair names formatted in the same manner as above. If pairs is not given, but base_currencies and quote_currencies are, then it will make all base/quote pairs possible using those. If only counter_currencies are given, then if only one currency exists in the .instrument environment, it will be used as the counter_currency. Otherwise, "USD" will be used.

Value

Called for side-effect

Note

Currently, this function is using a dot to separate the 2 currencies in the exchange_rate primary_id. FinancialInstrument and blotter do not use (expect) a separator. In the near future, either this function will create primary_ids for exchange_rates that look like "EURUSD", or FinancialInstrument/blotter will be updated to expect primary_ids that look like "EUR.USD"

Author(s)

Garrett See

See Also

exchange_rate, ls_exchange_rates(), twsInstrument

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
#make EUR.USD, EUR.JPY, GBP.USD, GBP.JPY
define_FX(counter_currencies=c("EUR","GBP"), second_currencies=c("USD","JPY"))

define_FX(c("USD.CHF","NZD.USD))

define_FX()

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.