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).

The ratio is the Global Macro Database’s own figure, published in percent and divided by 100 here.

The formula is as follows:

\[\text{Exports to GDP Ratio} = \text{Exports of Goods and Services} / \text{Nominal GDP}\]

Also known as: exports to GDP ratio, trade openness.

Exports to GDP in Python or via the MCP

Install the Finance Toolkit 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', end_date="2025-12-31")

economics.get_exports_to_gdp_ratio(countries=['United States', 'Canada', 'Russian Federation'])

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

How did exports as a share of GDP compare in the United States, Canada and Russia from 2015 to 2025?

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.1012 0.2947 0.2552
2021 0.1083 0.3118 0.3
2022 0.1165 0.3372 0.2771
2023 0.1105 0.3334 0.2277
2024 0.1097 0.3247 0.2179
2025 0.1079 0.3133 0.1815

Parameters

get_exports_to_gdp_ratio accepts the following parameters.

ParameterTypeDescriptionExample
countrieslist[str] | str | NoneA list of countries or a single country to include in the results. Defaults to None.["United States", "Germany"]
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 growth data. 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