DEV Community

carrierone
carrierone

Posted on

FRED and BLS Economic Indicator Data for Developers

FRED and BLS Economic Indicator Data for Developers

As a developer looking to integrate economic indicator data into your macro trading or analytics applications, you'll want quick access to reliable sources like FRED from the Federal Reserve Economic Data library. These resources provide crucial information such as CPI (Consumer Price Index), NFP (Non-Farm Payroll), GDP (Gross Domestic Product), PCE (Personal Consumption Expenditures), and unemployment figures. Let's dive into how you can get these feeds with Python.

Problem: Accessing FRED/BLS Economic Indicators

You might need to fetch specific indicators like the Non-Farm Payroll report, which is crucial for understanding employment trends in the U.S., or CPI, which measures inflation rates affecting consumer spending. The challenge lies in finding a straightforward way to access this data programmatically.

Python Code Example: Fetching NFP Data

Here’s a simple example using an API endpoint that provides FRED and BLS economic indicators:


python
import requests

def fetch_nfp():
    url = "https://api.verilexdata.com/api/v1/econ/stats"

    params = {
        'indicator': 'NFP',
        'units': 'percent'
    }

    response = requests.get(url, params=params)
    if response.status_code == 200:
        data = response.json()
Enter fullscreen mode Exit fullscreen mode

Top comments (0)