Get the Investment for a variety of countries over time from the Global Macro Database (GMDB). Investment is the total amount of money spent by businesses on capital goods, such as machinery, equipment, and buildings.

The level is annual and expressed in millions of national currency, so levels are not comparable across countries with different currencies, but growth rates are.

Data comes from the Global Macro Database (GMDB), further information about the variable can be found within https://www.globalmacrodata.com/documentation.html

Also known as: total investment, capital formation.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Total Investment for you. Just ask in plain English.

Calculate the Total Investment in Python

The Total Investment is available in the Economics module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_investment as shown below.

from financetoolkit import Economics

economics = Economics(start_date='2014-01-01')

investment = economics.get_investment()

investment.loc[:, ['United States', 'Portugal', 'China']]

Which returns:

  United States Portugal China
2014 3.68027e+06 26506.7 2.94903e+07
2015 3.91787e+06 28493.5 2.97829e+07
2016 3.92797e+06 29527 3.18198e+07
2017 4.14914e+06 33755.8 3.57888e+07
2018 4.45541e+06 37528.2 4.02584e+07
2019 4.66771e+06 39644.4 4.26678e+07
2020 4.57384e+06 38333.2 4.39554e+07
2021 5.0519e+06 44565.3 4.95782e+07
2022 5.70851e+06 50045.8 5.19792e+07
2023 5.97132e+06 52005.7 5.22754e+07
2024 6.36237e+06 54339.8 5.5217e+07
2025 6.66113e+06 57349.5 5.84789e+07

Parameters

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

The Economics module page introduces the module, and the sidebar lists all of its functions.

Share