{"record":{"id":"8fb840c39f33d9ab","repo":"OpenBB-finance/OpenBB","slug":"date-field-is-not-supported-for-deribit-provider","errorCode":null,"errorMessage":"Date field is not supported for Deribit provider. Use 'hours_ago' instead.","messagePattern":"Date field is not supported for Deribit provider\\. Use 'hours_ago' instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/deribit/openbb_deribit/models/futures_curve.py","lineNumber":79,"sourceCode":"\n    @field_validator(\"hours_ago\", mode=\"before\", check_fields=False)\n    @classmethod\n    def _validate_hours_ago(cls, v):\n        \"\"\"Validate hours ago.\"\"\"\n        if isinstance(v, str):\n            return v\n        if isinstance(v, int):\n            return v\n        if isinstance(v, list):\n            return \",\".join([str(i) for i in v])\n        return None\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def _validate_model(cls, values):\n        \"\"\"Validate the model.\"\"\"\n        if values.get(\"date\"):\n            raise ValueError(\n                \"Date field is not supported for Deribit provider. Use 'hours_ago' instead.\"\n            )\n        return values\n\n\nclass DeribitFuturesCurveData(FuturesCurveData):\n    \"\"\"Deribit Futures Curve Data.\"\"\"\n\n    hours_ago: int | None = Field(\n        default=None,\n        description=\"The number of hours ago represented by the price.\"\n        + \" Only available when hours_ago is set in the query.\",\n    )\n\n\nclass DeribitFuturesCurveFetcher(\n    Fetcher[DeribitFuturesCurveQueryParams, list[DeribitFuturesCurveData]]\n):","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/deribit/openbb_deribit/models/futures_curve.py#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove date and use hours_ago=N (int or comma-joined list) for historical comparison","Guard provider-specific params when the same call is reused across providers","For deep history, capture curves on a schedule yourself — hours_ago covers only recent snapshots"],"exampleFix":"# before\ncurve = obb.derivatives.futures.curve(symbol='BTC', date='2024-01-15', provider='deribit')\n\n# after\ncurve = obb.derivatives.futures.curve(symbol='BTC', hours_ago=24, provider='deribit')","handlingStrategy":"validation","validationCode":"def clean_curve_params(params: dict) -> dict:\n    params = dict(params)\n    if params.get('date'):\n        params.pop('date')  # unsupported by deribit; history uses hours_ago\n    return params","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never inject the generic OpenBB date param for provider='deribit' curve calls","Use hours_ago (single int or list) for historical comparisons","Branch provider-specific params when sharing query-building code across providers"],"tags":["deribit","validation","unsupported-parameter","pydantic"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}