Macroeconomics is a part of economics dealing with the performance, structure, behavior, and decision-making of an economy as a whole. Our Macro Indicators Data API includes regional, national, and global economies. We provide data for more than 30 macro indicators such as GDP, unemployment rates, national income, price indices, inflation rates, consumption, international trades, and many other significant indicators. Most data is provided from December 1960.
Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. A more detailed information about the functions of the Macro Indicators Data API you can find on our documentation web-page.
Accessing the EODHD API
To access the EODHD API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.
api = APIClient("demo")
Please, note that you can also specify the API key in a configuration file or as an environment variable, as described in the library documentation here.
1. Use the “demo” API key to test our data from a limited set of the tickers without registering:
AAPL.US | TSLA.US | VTI.US | AMZN.US | BTC-USD | EUR-USD
Real-Time Data and All of the APIs (except Bulk) are included without limitations on API calls.
2. Register to get your free API key (limitated by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange
3. To unlock your API key we recommend to choose subscription which covers your needs
Retrieving Macro Indicators Data
resp = api.get_macro_indicators_data (country = "USA")
The API response will be a single JSON structure.
Converting JSON Response to DataFrame
To convert JSON to DataFrame it is possible to use:
indicator = pd.DataFrame(resp)
All data in DataFrame will contain information such as: “country code”, “country name”, “indicator”, “date”, “period” and “value” for country, which was used when we called API, in particular (“USA”).
Extended functions of the Macro Indicators Data API
For a more accurate research, it is possible to use parameter that lays in Macro Indicators Data API. This argument named indicator. For example, it may be real interest rate or consumer price index (all available indicators will be shown below)
indicator_extended = api.get_macro_indicators_data (country = "USA", indicator = "real_interest_rate")
The API response is a JSON array containing data for all the requested tickers. You can convert the resulting JSON array to a DataFrame for further analysis:
indicator_m = pd.DataFrame(indicator_extended) print (indicator_m)
The List of Available Macroeconomics Indicators
- real_interest_rate‘ – Real interest rate (%).
- ‘population_total‘ – Population, total.
- ‘population_growth_annual‘ – Population growth (annual %).
- ‘inflation_consumer_prices_annual‘ – Inflation, consumer prices (annual %).
- ‘consumer_price_index‘ – Consumer Price Index (2010 = 100).
- ‘gdp_current_usd‘ – GDP (current US$).
- ‘gdp_per_capita_usd‘ – GDP per capita (current US$).
- ‘gdp_growth_annual‘ – GDP growth (annual %).
- ‘debt_percent_gdp‘ – Debt in percent of GDP (annual %).
- ‘net_trades_goods_services‘ – Net trades in goods and services (current US$).
- ‘inflation_gdp_deflator_annual‘ – Inflation, GDP deflator (annual %).
- ‘agriculture_value_added_percent_gdp‘ – Agriculture, value added (% of GDP).
- ‘industry_value_added_percent_gdp‘ – Industry, value added (% of GDP).
- ‘services_value_added_percent_gdp‘ – Services, etc., value added (% of GDP).
- ‘exports_of_goods_services_percent_gdp‘ – Exports of goods and services (% of GDP).
- ‘imports_of_goods_services_percent_gdp‘ – Imports of goods and services (% of GDP).
- ‘gross_capital_formation_percent_gdp‘ – Gross capital formation (% of GDP).
- ‘net_migration‘ – Net migration (absolute value).
- ‘gni_usd‘ – GNI, Atlas method (current US$).
- ‘gni_per_capita_usd‘ – GNI per capita, Atlas method (current US$).
- ‘gni_ppp_usd‘ – GNI, PPP (current international $).
- ‘gni_per_capita_ppp_usd‘ – GNI per capita, PPP (current international $).
- ‘income_share_lowest_twenty‘ – Income share held by lowest 20% (in %).
- ‘life_expectancy‘ – Life expectancy at birth, total (years).
- ‘fertility_rate‘ – Fertility rate, total (births per woman).
- ‘prevalence_hiv_total‘ – Prevalence of HIV, total (% of population ages 15-49).
- ‘co2_emissions_tons_per_capita‘ – CO2 emissions (metric tons per capita).
- ‘surface_area_km‘ – Surface area (sq. km).
- ‘poverty_poverty_lines_percent_population‘ – Poverty headcount ratio at national poverty lines (% of population).
- ‘revenue_excluding_grants_percent_gdp‘ – Revenue, excluding grants (% of GDP).
- ‘cash_surplus_deficit_percent_gdp‘ – Cash surplus/deficit (% of GDP).
- ‘startup_procedures_register‘ – Start-up procedures to register a business (number).
- ‘market_cap_domestic_companies_percent_gdp‘ – Market capitalization of listed domestic companies (% of GDP).
- ‘mobile_subscriptions_per_hundred‘ – Mobile cellular subscriptions (per 100 people).
- ‘internet_users_per_hundred‘ – Internet users (per 100 people).
- ‘high_technology_exports_percent_total‘ – High-technology exports (% of manufactured exports).
- ‘merchandise_trade_percent_gdp‘ – Merchandise trade (% of GDP).
- ‘total_debt_service_percent_gni‘ – Total debt service (% of GNI).
- ‘unemployment_total_percent’ – Unemployment total (% of labor force).
Our Macro Indicators Data API opens the door to a world of economic insights and data-driven decision-making. By leveraging this powerful resource, you can embark on a journey of exploration and analysis, uncovering the economic dynamics that shape our world. Whether you’re an economist, investor, or simply curious about macroeconomics, our API is your gateway to understanding and interpreting the economic forces that drive nations and markets. Happy analyzing!