OpenBB-finance/OpenBB · error · OpenBBError

maturity must be a float or a comma-separated string of floa

Error message

maturity must be a float or a comma-separated string of floats

What it means

Error "maturity must be a float or a comma-separated string of floats" thrown in OpenBB-finance/OpenBB.

Source

Thrown at openbb_platform/providers/fred/openbb_fred/utils/fred_helpers.py:219

    "slovak_republic",
    "slovakia",
    "slovenia",
    "south_africa",
    "spain",
    "sweden",
    "switzerland",
    "turkey",
    "united_kingdom",
    "united_states",
]


def comma_to_float_list(v: str) -> list[float]:
    """Convert comma-separated string to list of floats."""
    try:
        return [float(m) for m in v.split(",")]
    except ValueError as e:
        raise OpenBBError(
            "maturity must be a float or a comma-separated string of floats"
        ) from e


def all_cpi_options(harmonized: bool = False) -> list[dict]:
    """Get all CPI options."""
    data = []

    current_dir = os.path.dirname(os.path.realpath(__file__))
    file = "harmonized_cpi.csv" if harmonized else "cpi.csv"

    with open(Path(current_dir, file), encoding="utf-8") as csv_file_handler:
        csv_reader = csv.DictReader(csv_file_handler)
        for rows in csv_reader:
            row = {key.lstrip("\ufeff"): value for key, value in rows.items()}
            data.append(row)
    return data

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass maturity as a float (e.g., 3.5) or a comma-separated string of floats (e.g., '1,3,6').
  2. Remove any non-numeric characters from the maturity value.

When it happens

Trigger: Thrown at openbb_platform/providers/fred/openbb_fred/utils/fred_helpers.py:219 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/0997570010fe6a1a. Report an issue: GitHub.