Exchange Rates
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.
Also known as: currency exchange, FX rates, foreign exchange rates.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Exchange Rates for you. Just ask in plain English.
Calculate the Exchange Rates in Python
The Exchange Rates is available in the Economics module of the open-source Finance Toolkit. Install it 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"])
Which returns:
| Japan | Indonesia | China | |
|---|---|---|---|
| 2000 | 107.835 | 8394.53 | 8.2784 |
| 2001 | 121.484 | 10253 | 8.2777 |
| 2002 | 125.255 | 9318.73 | 8.2771 |
| 2003 | 115.936 | 8573.73 | 8.278 |
| 2004 | 108.147 | 8931.52 | 8.2782 |
| 2005 | 110.133 | 9701.29 | 8.1942 |
| 2006 | 116.354 | 9164.03 | 7.9724 |
| 2007 | 117.755 | 9139.41 | 7.6074 |
| 2008 | 103.388 | 9663.87 | 6.9502 |
| 2009 | 93.5716 | 10376.8 | 6.8308 |
| 2010 | 87.7606 | 9078.03 | 6.769 |
Parameters
get_exchange_rates accepts the following parameters:
- countries (list[str] | str | None, optional): The countries to include in the data. Defaults to None.
- period (str | None, optional): Whether to return the monthly, quarterly or the annual data.
- gmdb_source (bool | None, optional): Whether to get the data from the Global Macro Database (GMDB).
- rolling (int, optional): The rolling window size to use for smoothing the data (simple moving average). Defaults to None.
- trailing (int, optional): The trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.
- growth (bool, optional): Whether to return the growth data or the actual data.
- lag (int, optional): The number of periods to lag the data by.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Related Economy
The Economics module page introduces the module, and the sidebar lists all of its functions.