Gross Domestic Product (GDP)
Get the Gross Domestic Product for a variety of countries over time. The Gross Domestic Product is the total value of goods produced and services provided in a country during one year. By default the data comes from the Global Macro Database (GMDB); set gmdb_source=False to retrieve it from the OECD instead.
Note that the OECD source reports GDP on a per capita basis, i.e. the total Gross Domestic Product divided by the population of the country, whereas the Global Macro Database (GMDB) source reports the total (not per capita) figure. The two are also expressed in different units: the OECD source is in current-price US dollars per person converted with Purchasing Power Parities (PPPs), which makes the level comparable across countries, while the GMDB source is in millions of national currency. Both are annual.
The data is returned as levels. To obtain period-on-period changes (e.g. year on year or quarter on quarter growth), set growth=True and use lag to control how many periods back the comparison is made.
See definition: https://data.oecd.org/gdp/gross-domestic-product-gdp.htm
The inflation adjusted and US dollar figures are only available from the Global Macro Database (GMDB), so they always come from it. For more information see: https://www.globalmacrodata.com/documentation.html
Also known as: GDP, national income, economic growth, real GDP, real GDP in USD, cross-country comparable GDP.
Gross Domestic Product (GDP) in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_gross_domestic_product as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2015-01-01', end_date="2025-12-31")
economics.get_gross_domestic_product(inflation_adjusted=True, countries=['Netherlands', 'Germany', 'China'])
Or, after setting up the Finance Toolkit MCP, ask:
How large was the real GDP of the Netherlands, Germany and China, in national currency, from 2015 to 2025?
Which returns:
| Netherlands | Germany | China | |
|---|---|---|---|
| 2015 | 699213 | 3.08436e+06 | 7.02512e+07 |
| 2016 | 716132 | 3.15026e+06 | 7.50097e+07 |
| 2017 | 736049 | 3.24792e+06 | 8.01788e+07 |
| 2018 | 752633 | 3.28523e+06 | 8.55972e+07 |
| 2019 | 769904 | 3.31842e+06 | 9.07907e+07 |
| 2020 | 740429 | 3.16955e+06 | 9.29147e+07 |
| 2021 | 786377 | 3.29206e+06 | 1.00878e+08 |
| 2022 | 825789 | 3.35415e+06 | 1.04039e+08 |
| 2023 | 820955 | 3.33152e+06 | 1.09674e+08 |
| 2024 | 829705 | 3.3158e+06 | 1.15158e+08 |
| 2025 | 844596 | 3.32724e+06 | 1.20916e+08 |
Parameters
get_gross_domestic_product accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
countries | list[str] | str | None | A list of countries or a single country to include in the results. Defaults to None. | ["United States", "Germany"] |
inflation_adjusted | bool | Whether to return the inflation adjusted data. Defaults to False. | True |
gmdb_source | bool | None | Whether to retrieve the data from the GMDB. Defaults to None, which falls back to the gmdb_source set on the Economics class (True by default). | False |
usd | bool | Whether to return the values in millions of US dollars, converted by the Global Macro Database, instead of millions of national currency, which makes levels comparable across countries. With inflation_adjusted=True, real GDP in millions of US dollars at constant 2015 prices, converted at the 2015 market exchange rate (not at purchasing power parities), so its growth equals the growth of real GDP in the national currency. Always from the GMDB. Defaults to False. | True |
rolling | int | The rolling window size to use for smoothing the data (simple moving average). Defaults to None. | 4 |
trailing | int | The trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None. | 4 |
growth | bool | Whether to return the growth data or the actual data. Defaults to False. | True |
lag | int | The number of periods to lag the growth data. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None. | 2 |
gmdb_forecasts | bool | Whether 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 |