OpenBB-finance/OpenBB · error · ValueError

Currency {currency} not supported. Supported currencies are:

Error message

Currency {currency} not supported. Supported currencies are: {', '.join(CURRENCIES)}

What it means

ValueError from get_instruments (openbb_deribit.utils.helpers) when the currency argument is not 'all' (case-insensitive) and its uppercased form is not in CURRENCIES = [BTC, ETH, USDC, USDT, EURR, 'all']. This is a static guard in front of the Deribit /public/get_instruments URL build.

Source

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

    Get Deribit instruments.

    Parameters
    ----------
    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

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use one of BTC, ETH, USDC, USDT, EURR, or the literal 'all' (case-insensitive).
  2. For option underlyings like SOL/XRP, note the helper itself maps them to USDC where appropriate; do not pass them to get_instruments directly.
  3. Validate currency against CURRENCIES before looping over currencies in batch scripts.

Example fix

# before
instruments = await get_instruments("SOL", "future")

# after
instruments = await get_instruments("all", "future")  # or "BTC", "ETH", "USDC", "USDT", "EURR"
Defensive patterns

Strategy: validation

Validate before calling

CURRENCIES = {"BTC", "ETH", "USDC", "USDT", "EURR", "all"}
cur = cur.strip()
assert cur.upper() in CURRENCIES or cur == "all", f"currency must be one of {sorted(CURRENCIES)}"

Type guard

from typing import Literal, TypeGuard
Currency = Literal["BTC", "ETH", "USDC", "USDT", "EURR", "all"]

def is_deribit_currency(s: str) -> TypeGuard[Currency]:
    return s in {"BTC", "ETH", "USDC", "USDT", "EURR", "all"} or s.upper() in {"BTC", "ETH", "USDC", "USDT", "EURR", "ALL"}

Prevention

When it happens

Trigger: Calling get_instruments('SOL') (options-only underlying, not a futures currency), 'BTC_USD', 'usdt' is fine (uppercased), or any fiat/altcoin not in the list. Note this function is also called internally with mapped values, so user-facing trigger is via direct helper use.

Common situations: Assuming every DERIBIT_OPTIONS_SYMBOLS underlying works as a currency for instruments (SOL, XRP, BNB, PAXG are NOT valid here), or passing exchange-pair strings.

Related errors


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