DEV Community

carrierone
carrierone

Posted on

FRED and BLS Economic Indicator Data for Developers

FRED and BLS Economic Indicator Data for Developers

When developing applications that require access to economic indicators such as CPI, NFP, GDP, PCE, and unemployment rates, developers often turn to sources like the Federal Reserve Economic Database (FRED) and Bureau of Labor Statistics (BLS). These resources provide comprehensive data that can be crucial for macro trading or analytics apps. Below is a simple example in Python using an API endpoint designed for such purposes.

Getting Started with CPI Data

One common indicator used in economic analysis is the Consumer Price Index (CPI), which measures changes in prices over time for goods and services purchased by consumers. To fetch this data, you can use an API that offers access to FRED's datasets. Here’s a quick example of how to request CPI data using a hypothetical endpoint api.verilexdata.com/api/v1/econ/stats:


python
import requests

# Define the URL for the API endpoint
url = 'https://api.verilexdata.com/api/v1/econ/stats'

# Parameters for the request, including the indicator we want to fetch data on (CPI)
params = {
    'indicator': 'CPI',
    # Add any other parameters like date range here if needed
}

# Send a GET request to the API with the specified URL and params
response = requests.get(url, params=params
Enter fullscreen mode Exit fullscreen mode

Top comments (0)