OpenBB-finance/OpenBB · error · ValueError

Date field is not supported for Deribit provider. Use 'hours

Error message

Date field is not supported for Deribit provider. Use 'hours_ago' instead.

What it means

A pydantic model_validator on DeribitFuturesCurveQueryParams rejects any request carrying a date parameter. Deribit's public API does not serve historical futures curves by calendar date; the curve model supports history only via hours_ago (compared against a cached snapshot), so date is explicitly blocked to prevent silently wrong results. The ValueError surfaces at parameter validation, before fetching.

Source

Thrown at openbb_platform/providers/deribit/openbb_deribit/models/futures_curve.py:79

    @field_validator("hours_ago", mode="before", check_fields=False)
    @classmethod
    def _validate_hours_ago(cls, v):
        """Validate hours ago."""
        if isinstance(v, str):
            return v
        if isinstance(v, int):
            return v
        if isinstance(v, list):
            return ",".join([str(i) for i in v])
        return None

    @model_validator(mode="before")
    @classmethod
    def _validate_model(cls, values):
        """Validate the model."""
        if values.get("date"):
            raise ValueError(
                "Date field is not supported for Deribit provider. Use 'hours_ago' instead."
            )
        return values


class DeribitFuturesCurveData(FuturesCurveData):
    """Deribit Futures Curve Data."""

    hours_ago: int | None = Field(
        default=None,
        description="The number of hours ago represented by the price."
        + " Only available when hours_ago is set in the query.",
    )


class DeribitFuturesCurveFetcher(
    Fetcher[DeribitFuturesCurveQueryParams, list[DeribitFuturesCurveData]]
):

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Remove date and use hours_ago=N (int or comma-joined list) for historical comparison
  2. Guard provider-specific params when the same call is reused across providers
  3. For deep history, capture curves on a schedule yourself — hours_ago covers only recent snapshots

Example fix

# before
curve = obb.derivatives.futures.curve(symbol='BTC', date='2024-01-15', provider='deribit')

# after
curve = obb.derivatives.futures.curve(symbol='BTC', hours_ago=24, provider='deribit')
Defensive patterns

Strategy: validation

Validate before calling

def clean_curve_params(params: dict) -> dict:
    params = dict(params)
    if params.get('date'):
        params.pop('date')  # unsupported by deribit; history uses hours_ago
    return params

Prevention

When it happens

Trigger: obb.derivatives.futures.curve(symbol='BTC', date='2024-01-15', provider='deribit') — copying the standard OpenBB date param that other providers accept; passing date=None is fine, but any truthy date string fails.

Common situations: Portable code that injects date into every historical query; UIs exposing a date picker for all providers; users expecting the standard OpenBB date contract to apply here.

Related errors


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