Nominal API Python Client

0.1198.0 · active · verified Fri Apr 17

The official Python client for the Nominal API, providing programmatic access to financial time-series data, including inflation, economic indicators, and asset prices. The library is actively maintained and frequently updated, often releasing new versions with minor bug fixes and feature enhancements, though breaking changes can occur in pre-1.0 releases.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the NominalAPIClient with your API key and fetch time-series data. This example retrieves CPI data for USD for the year 2020. Ensure your API key is configured either as an environment variable or directly in the code.

import os
from nominal import NominalAPIClient

api_key = os.environ.get('NOMINAL_API_KEY', 'YOUR_NOMINAL_API_KEY_HERE')

if api_key == 'YOUR_NOMINAL_API_KEY_HERE':
    print("Please set the NOMINAL_API_KEY environment variable or replace 'YOUR_NOMINAL_API_KEY_HERE' with your actual key.")
else:
    try:
        client = NominalAPIClient(api_key=api_key)
        # Fetch CPI data for USD between specified dates
        timeseries_data = client.get_timeseries("USD.CPI", "2020-01-01", "2020-12-31")
        print("Successfully fetched data:")
        print(f"First entry: {timeseries_data[0]}")
        print(f"Last entry: {timeseries_data[-1]}")
    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →