OpenBB-finance/OpenBB · error · ValueError

Kind {derivative_type} not supported. Supported kinds are: {

Error message

Kind {derivative_type} not supported. Supported kinds are: {', '.join(DERIVATIVE_TYPES)}

What it means

ValueError from get_instruments when derivative_type is truthy and not in DERIVATIVE_TYPES = [future, option, spot, future_combo, option_combo]. The value is interpolated into the &kind= query parameter verbatim, so this guard prevents malformed Deribit URLs.

Source

Thrown at openbb_platform/providers/deribit/openbb_deribit/utils/helpers.py:80

    currency : Currencies
        The currency to get instruments for. Default is "BTC".
    derivative_type : Optional[DerivativeTypes]
        The type of derivative to get instruments for. Default is None, which gets all types.

    Returns
    -------
    list[dict]
        A list of instrument dictionaries.
    """
    # pylint: disable=import-outside-toplevel
    from openbb_core.provider.utils.helpers import amake_request

    if currency != "all" and currency.upper() not in CURRENCIES:
        raise ValueError(
            f"Currency {currency} not supported. Supported currencies are: {', '.join(CURRENCIES)}"
        )
    if derivative_type and derivative_type not in DERIVATIVE_TYPES:
        raise ValueError(
            f"Kind {derivative_type} not supported. Supported kinds are: {', '.join(DERIVATIVE_TYPES)}"
        )

    url = f"{BASE_URL}/api/v2/public/get_instruments?currency={currency.upper() if currency != 'all' else 'any'}"

    if derivative_type is not None:
        url += f"&kind={derivative_type}"

    if expired:
        url += f"&expired={str(expired).lower()}"

    try:
        response = await amake_request(url)
        return response.get("result", [])  # type: ignore
    except Exception as e:  # pylint: disable=broad-except
        raise OpenBBError(
            f"Failed to get instruments -> {e.__class__.__name__}: {e}"
        ) from e

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use exactly one of: future, option, spot, future_combo, option_combo (lowercase, singular).
  2. Pass None (or omit) to get all types.
  3. For perpetuals, use kind='future' — Deribit treats perpetuals as futures.

Example fix

# before
data = await get_instruments("BTC", "futures")

# after
data = await get_instruments("BTC", "future")
Defensive patterns

Strategy: type-guard

Validate before calling

DERIVATIVE_TYPES = {"future", "option", "spot", "future_combo", "option_combo"}
if derivative_type is not None:
    assert derivative_type in DERIVATIVE_TYPES, f"kind must be one of {sorted(DERIVATIVE_TYPES)}"

Type guard

from typing import Literal, TypeGuard
DerivativeType = Literal["future", "option", "spot", "future_combo", "option_combo"]

def is_derivative_type(s: str) -> TypeGuard[DerivativeType]:
    return s in {"future", "option", "spot", "future_combo", "option_combo"}

Prevention

When it happens

Trigger: Passing 'futures' (plural), 'options', 'perp', 'PERPETUAL', or None-vs-string mistakes. Note: None is allowed (omits kind), but any other unlisted string fails; matching is case-sensitive.

Common situations: Pluralized or uppercased kind strings copied from docs/conversations, or reusing DerivativeTypes values from other providers.

Related errors


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