Exchange rates are defined as the price of one country’s currency in relation to another country’s currency. This indicator is measured in terms of national currency per US dollar.

See definition: https://data.oecd.org/conversion/exchange-rates.htm

It is also possible to get the data from the Global Macro Database (GMDB) by setting the gmdb_source to True.

Both sources are quoted the same way (national currency per US dollar), but the OECD source omits the United States itself, since the rate is trivially 1, whereas the GMDB source carries it as 1.0. Only the OECD source supports monthly and quarterly frequency; the GMDB is annual only, so the period argument has no effect when gmdb_source is True.

Both are averages over each period. For daily and weekly rates (period=”daily” or “weekly”), or the rate at the end of each month, quarter or year (end_of_period=True), the rates come from the Bank for International Settlements instead, without an API key: daily for around 80 currencies with history back to 1945 for some, and at the end of each month for around 130, back to the 1950s for most. Weekly and quarterly or yearly end-of-period rates take the last observation of each period.

Also known as: currency exchange, FX rates, foreign exchange rates.

Exchange Rates in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_exchange_rates as shown below.

from financetoolkit import Economics

economics = Economics(start_date='2000-01-01', end_date='2010-12-31')

economics.get_exchange_rates(countries=['Japan', 'Indonesia', "China"], period='yearly')

Or, after setting up the Finance Toolkit MCP, ask:

How many Japanese yen, Indonesian rupiah and Chinese yuan did one US dollar buy on average each year from 2000 to 2010?

Which returns:

  Japan Indonesia China
2000 107.746 8401.53 8.2771
2001 121.409 10252.9 8.277
2002 125.138 9315.13 8.277
2003 115.929 8570.07 8.277
2004 108.158 8945.34 8.2777
2005 110.181 9714.85 8.1924
2006 116.307 9170.49 7.9737
2007 117.774 9138.88 7.6063
2008 103.444 9682.61 6.9485
2009 93.5426 10397.6 6.8311
2010 87.7075 9082.76 6.7678

Parameters

get_exchange_rates accepts the following parameters.

ParameterTypeDescriptionExample
countrieslist[str] | str | NoneThe countries to include in the data. Defaults to None.["United States", "Germany"]
periodstr | NoneWhether to return the daily, weekly, monthly, quarterly or the annual data. Defaults to None, which is quarterly when the Economics class was initialized with quarterly=True and otherwise the highest frequency available: daily."weekly"
gmdb_sourcebool | NoneWhether to get the data from the Global Macro Database (GMDB).False
end_of_periodboolWhether to return the rate at the end of each month, quarter or year instead of its average. Defaults to False.True
rollingintThe rolling window size to use for smoothing the data (simple moving average). Defaults to None.4
trailingintThe trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.4
growthboolWhether to return the growth data or the actual data. Defaults to False.True
lagintThe number of periods to lag the data by. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None.2
gmdb_forecastsboolWhether to include the years the Global Macro Database projects, from the IMF’s World Economic Outlook, up to five years ahead. Only applies to data from the Global Macro Database. Defaults to False, which ends a series with its last observation.True
Share