Get the Government Revenue to GDP Ratio for a variety of countries over time from the Global Macro Database (GMDB). The Government Revenue to GDP Ratio is the ratio of the total amount of money that a government collects from taxes and other sources 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.3104 for 31.04% of GDP).

Changed in v2.2.0: this used to be returned in percentage points. It is now a decimal fraction, matching every other ratio in the Finance Toolkit.

Also known as: revenue to GDP ratio.

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

Calculate the Revenue to GDP in Python

The Revenue to GDP is available in the Economics module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_government_revenue_to_gdp_ratio as shown below.

from financetoolkit import Economics

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

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

Which returns:

  United States Canada Russian Federation
2015 0.315 0.3996 0.3189
2016 0.3098 0.403 0.3292
2017 0.304 0.4034 0.3336
2018 0.3001 0.4102 0.3554
2019 0.3001 0.4057 0.3568
2020 0.3065 0.4141 0.3516
2021 0.3158 0.4252 0.3544
2022 0.3238 0.4114 0.342
2023 0.2921 0.4192 0.3426
2024 0.299 0.4127 0.3545
2025 0.3006 0.4124 0.3647
2026 0.3065 0.4115 0.365

Parameters

get_government_revenue_to_gdp_ratio 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