Exchange rates
Daily exchange rates from FactSet are available between most major currencies.
Retrieve exchange rates
- fx(base, quote, source)
Retrieve the daily exchange rate between the two currencies. The value is the number of units of the quote currency required to buy one unit of the base currency. The currencies are specified using their three-letter ISO codes (ISO 4217).
- Parameters:
base (str) – the base currency
quote (str) – the quote currency
To get the exchange rate from pound sterling to US dollars (
GBPUSD
pair):fx('GBP', 'USD')
Currency conversion
Signals support the method signal.convert_currency()
. This method can be used in two different
ways, depending on whether the original time series has a currency set or not.
Each data point is converted using the exchange rate of the corresponding date, if it exists. If there is no known exchange rate for a date, the last known exchange rate before that date is used. In particular, for future data points, the latest exchange rate is used.
- signal.convert_currency(currency)
Convert a signal to the given currency. This only works if the original time series has set a currency.
- Parameters:
currency – The currency. Must be specified as a three-letter ISO code (ISO 4217).
To convert a currency-aware time series to Pound Sterling:
signal.convert_currency("GBP")
- signal.convert_currency(base, quote)
Convert a signal from one currency to another. This can be used for signals where the original time series does not have a currency set, but you nevertheless know which currency it has. In this case, you should specify the time series’ currency as the base currency.
If the time series does have a known currency, it is recommended to use the one-argument version of this signal.
For signals that are evaluated for a company, a company-relative identifier may be specified. The supported company-relative identifiers are:
Identifier
Meaning
factset_estimate
The currency of FactSet estimates and actuals for the company.
factset_fundamental
The currency of FactSet fundamentals data for the company.
factset_price
The currency of FactSet price data for the company.
- Parameters:
base – The base currency. Must be specified either as a three-letter ISO code (ISO 4217) or as one of the company-relative currency identifiers.
quote – The quote currency. Must be specified either as a three-letter ISO code (ISO 4217) or as one of the company-relative currency identifiers.
To convert a time series which does not have a currency set, but where you know that the currency is the same as the currency of the FactSet estimates:
signal.convert_currency("factset_estimates", "EUR")
Interval-based currency conversion
In many time series, a data point is meant to represent an entire period, for example a fiscal
quarter. In these cases, converting the data points using just the exchange rate for the date used
in the time series, may not be the best solution. For this reason, many signals (i.e. FactSet and
Visible Alpha signals) support the two arguments currency
and currency_method
, which allow
you to use exchange rates determined by the periods in question.
The currency
argument must be a three-letter ISO code (ISO 4217).
The currency_method
argument can have two values, mean
and last
, where mean
is the
default. If the value is mean
, the exchange rate used is the mean over the entire period. If the
value is last
, the exchange rate on the last date of the period is used.
Note
For dates without a known exchange rate, we use the last known exchange rate before that date. In particular, for future dates, we use the latest known exchange rate.
This means that if currency_method='mean'
, when calculating the exchange rate for the current
fiscal period, we extrapolate the last known exchange rate till the end of the fiscal period, and
then calculate the mean.
Examples:
FactSet reported sales numbers, converted to US dollars using the average exchange rate over each fiscal period:
fs_actual('sales', currency='USD')
FactSet consensus estimates for total debt, converted to euro using the exchange rate on the last date of each fiscal period:
fs_consensus('total_debt', currency='EUR', currency_method='last')
# This is equivalent to:
fs_consensus('total_debt').convert_currency(currency='EUR')
FactSet consensus estimates for total debt, converted to euro using the last exchange rate of each fiscal period, but aligned to the report dates:
fs_consensus('total_debt', alignment='rd', currency='EUR', currency_method='last')
# This is not equivalent to the following, as this expression would use the exchange rates
# of the report dates, while the expression above uses the exchange rate on the last date of
# each fiscal period.
fs_consensus('total_debt', alignment='rd').convert_currency(currency='EUR')