OpenBB-finance/OpenBB · error · ValueError

Data length is less than required by parameters: {max(length

Error message

Data length is less than required by parameters: {max(length)}

What it means

validate_data in openbb_technical/helpers.py raises when any required lookback length exceeds the number of data points supplied. Indicator calculations (volatility estimators, cones, etc.) declare minimum bar counts; this guard rejects inputs too short for them.

Source

Thrown at openbb_platform/extensions/technical/openbb_technical/helpers.py:18

"""Technical Analysis Helpers."""

# pylint: disable=too-many-arguments,too-many-locals,too-many-positional-arguments

from typing import TYPE_CHECKING, Any, Literal
from warnings import warn

if TYPE_CHECKING:
    from pandas import DataFrame, Series, Timestamp


def validate_data(data: list, length: int | list[int]) -> None:
    """Validate data."""
    if isinstance(length, int):
        length = [length]
    for item in length:
        if item > len(data):
            raise ValueError(
                f"Data length is less than required by parameters: {max(length)}"
            )


def parkinson(
    data: "DataFrame",
    window: int = 30,
    trading_periods: int | None = None,
    is_crypto: bool = False,
    clean=True,
) -> "DataFrame":
    """Parkinson volatility.

    Uses the high and low price of the day rather than just close to close prices.
    It is useful for capturing large price movements during the day.

    Parameters
    ----------

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Fetch more history: increase limit or widen the date range so len(data) >= max required length.
  2. Lower the indicator window below the data length.
  3. Choose window = min(window, len(data) - 1) for exploratory runs.
  4. Pre-check with openbb_technical.helpers.validate_data before computing.

Example fix

# before
data = obb.equity.price.historical(symbol, limit=50).to_df()
cones(data, window=120)  # raises

# after
data = obb.equity.price.historical(symbol, limit=500).to_df()
cones(data, window=120)
Defensive patterns

Strategy: validation

Validate before calling

from openbb_technical.helpers import validate_data
validate_data(data, length=[window])  # e.g. cones: [3,10,30,60,90,120,150,180,210,240,300,360]

Type guard

def has_enough_bars(data: list, lengths: list[int]) -> bool:
    return all(n <= len(data) for n in lengths)

Try / catch

try:
    out = cones(data, lower_q=0.1, upper_q=0.9)
except ValueError as e:
    if "Data length is less than required" in str(e):
        data = fetch_more_history(limit=500)
        out = cones(data, lower_q=0.1, upper_q=0.9)
    else:
        raise

Prevention

When it happens

Trigger: Calling technical indicator helpers with data shorter than the indicator's lookback, e.g. parkinson/garman-klass volatility with window=30 on 20 rows, or cones with fewer rows than the largest window (360).

Common situations: Small limit values in history fetches; recent IPOs with little history; weekly/monthly series where the developer assumed daily bar counts; reusing parameters across studies with different minimums.

Related errors


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