Expenditure to GDP
Get the Government Expenditure to GDP Ratio for a variety of countries over time from the Global Macro Database (GMDB). The Government Expenditure to GDP Ratio is the total spending of the government (goods and services and the wages of its employees, but also social benefits and other transfers, subsidies and interest on its debt) 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.3708 for 37.08% 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{Government Expenditure to GDP Ratio} = \text{Government Expenditure} / \text{Nominal GDP},\;\; \text{using the level of government selected with level ("consolidated" by default)}\]Also known as: government spending to GDP.
Expenditure to GDP in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_government_expenditure_to_gdp_ratio as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2015-01-01', end_date="2025-12-31")
economics.get_government_expenditure_to_gdp_ratio(
countries=['United States', 'Japan', 'Netherlands'])
Or, after setting up the Finance Toolkit MCP, ask:
How did government expenditure as a share of GDP compare in the United States, Japan and the Netherlands from 2015 to 2025?
Which returns:
| United States | Japan | Netherlands | |
|---|---|---|---|
| 2015 | 0.3791 | 0.3766 | 0.4525 |
| 2016 | 0.3818 | 0.3757 | 0.4391 |
| 2017 | 0.3788 | 0.37 | 0.4275 |
| 2018 | 0.3785 | 0.3705 | 0.4244 |
| 2019 | 0.3836 | 0.3752 | 0.421 |
| 2020 | 0.4736 | 0.4466 | 0.4781 |
| 2021 | 0.4542 | 0.4244 | 0.4591 |
| 2022 | 0.3849 | 0.4126 | 0.4328 |
| 2023 | 0.3931 | 0.3881 | 0.4401 |
| 2024 | 0.3966 | 0.3839 | 0.4429 |
| 2025 | 0.3981 | 0.3791 | 0.4486 |
Parameters
get_government_expenditure_to_gdp_ratio 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"] |
level | str | The government the figures cover: “consolidated” (the Global Macro Database’s combination of general and central government figures, with the longest history), “general” (general government: central, state and local government and social security) or “central” (central government only). Defaults to “consolidated”. | "general" |
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 |