Exports to GDP
Get the Exports to GDP Ratio for a variety of countries over time from the Global Macro Database (GMDB). The Exports to GDP Ratio is the ratio of the total amount of goods and services produced in a country that are sold to other countries to the Gross Domestic Product (GDP).
Data comes from the Global Macro Database (GMDB), further information about the variable can be found within https://www.globalmacrodata.com/documentation.html
The ratio is expressed as a decimal fraction (0.1016 for 10.16% of GDP).
Changed in v2.2.0: this used to be returned in percentage points. It is now a decimal fraction, matching every other ratio in the Finance Toolkit.
Also known as: exports to GDP ratio, trade openness.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Exports to GDP for you. Just ask in plain English.
Calculate the Exports to GDP in Python
The Exports to GDP is available in the Economics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_exports_to_gdp_ratio as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2015-01-01')
economics.get_exports_to_gdp_ratio(countries=['United States', 'Canada', 'Russian Federation'])
Which returns:
| United States | Canada | Russian Federation | |
|---|---|---|---|
| 2015 | 0.1241 | 0.3185 | 0.287 |
| 2016 | 0.1189 | 0.315 | 0.2585 |
| 2017 | 0.1218 | 0.3145 | 0.2609 |
| 2018 | 0.1229 | 0.3233 | 0.3079 |
| 2019 | 0.1179 | 0.3235 | 0.2843 |
| 2020 | 0.1007 | 0.2947 | 0.2552 |
| 2021 | 0.1079 | 0.3122 | 0.2977 |
| 2022 | 0.116 | 0.3385 | 0.2803 |
| 2023 | 0.1101 | 0.3337 | 0.2308 |
| 2024 | 0.1075 | 0.3235 | 0.2124 |
| 2025 | 0.1059 | 0.3165 | 0.2122 |
| 2026 | 0.1049 | 0.3124 | 0.2123 |
Parameters
get_exports_to_gdp_ratio accepts the following parameters:
- countries (list[str] | str | None, optional): A list of countries or a single country to include in the results. Defaults to None.
- 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. Defaults to False.
- lag (int, optional): The number of periods to lag the growth data. Defaults to 1.
- 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 Government
The Economics module page introduces the module, and the sidebar lists all of its functions.