Get the Investment to GDP Ratio for a variety of countries over time from the Global Macro Database (GMDB). The Investment to GDP Ratio is gross capital formation (what businesses, households and the government spend on fixed assets such as machinery, equipment, buildings and dwellings, plus the change in inventories) as a share of 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.2248 for 22.48% 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{Investment to GDP Ratio} = \text{Gross Capital Formation} / \text{Nominal GDP},\;\; \text{with Gross Capital Formation} = \text{Gross Fixed Capital Formation} + \text{Change in Inventories}\]

Also known as: investment rate.

Investment to GDP in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_investment_to_gdp_ratio as shown below.

from financetoolkit import Economics

economics = Economics(start_date='2019-01-01', end_date="2025-12-31")

investment_to_gdp_ratio = economics.get_investment_to_gdp_ratio()

investment_to_gdp_ratio.loc[:, ['Australia', 'Japan', 'Turkey']]

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

How did investment as a share of GDP compare in Australia, Japan and Turkey from 2019 to 2025?

Which returns:

  Australia Japan Turkey
2019 0.2265 0.2732 0.2751
2020 0.2246 0.2689 0.3415
2021 0.2333 0.2733 0.3438
2022 0.2392 0.2831 0.386
2023 0.2389 0.2778 0.3459
2024 0.2453 0.2766 0.3073
2025 0.2455 0.2778 0.3167

Parameters

get_investment_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