OpenBB-finance/OpenBB · error · OpenBBError

OpenBBError(response.get("error"))

Error message

OpenBBError(response.get("error"))

What it means

OpenBBError raised inside get_ticker_data when the Deribit /public/ticker response contains a non-null 'error' field (Deribit signals API errors in-band with HTTP 200). The error dict (code/message) is passed as the exception arg. This is the per-instrument failure for invalid names, e.g. error code 11000 'instrument not found'. Note this raise is then re-wrapped by the outer except (error 277).

Source

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

    Parameters
    ----------
    symbol : str
        The symbol to get ticker data for.

    Returns
    -------
    dict
        The ticker data.
    """
    # pylint: disable=import-outside-toplevel
    from openbb_core.provider.utils.helpers import amake_request

    url = f"{BASE_URL}/api/v2/public/ticker?instrument_name={symbol}"

    try:
        response = await amake_request(url)
        if response.get("error"):  # type: ignore[union-attr]
            raise OpenBBError(response.get("error"))  # type: ignore[union-attr]
        data = response.get("result", {})  # type: ignore[union-attr]
        stats = data.pop("stats", {})
        return {**data, **stats}

    except Exception as e:  # pylint: disable=broad-except
        raise OpenBBError(f"Failed to get ticker data -> {e}: {e.args[0]}") from e


async def get_perpetual_symbols() -> dict:
    """
    Get perpetual symbols.

    Returns
    -------
    dict
        A dictionary of short symbols to full perpetual symbols.
    """
    instruments = await get_instruments("all", "future")

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Confirm the exact instrument_name via get_instruments for the currency/kind and retry with that string verbatim.
  2. Trim/strip symbols and reject empty strings before calling.
  3. Read the embedded Deribit error code in the message — 11000-series mean unknown/invalid instrument.
  4. If expired contracts are the cause, switch to the active contract or perpetual.

Example fix

# before
from openbb_deribit.utils.helpers import get_ticker_data
t = await get_ticker_data("BTC-PERP")

# after
t = await get_ticker_data("BTC-PERPETUAL")
Defensive patterns

Strategy: validation

Validate before calling

from openbb_deribit.utils.helpers import get_instruments
names = {d["instrument_name"] for d in asyncio.run(get_instruments("all", None))}
symbol = symbol.strip()
assert symbol and symbol in names, f"{symbol!r} is not a live Deribit instrument"

Type guard

def is_live_instrument(symbol: str, live: set[str]) -> bool:
    return isinstance(symbol, str) and symbol.strip() in live

Try / catch

from openbb_core.provider.utils.errors import OpenBBError
try:
    t = await get_ticker_data(symbol)
except OpenBBError as e:
    msg = str(e)
    if "instrument" in msg.lower() or "11000" in msg:
        refresh_instrument_cache(); skip(symbol)  # unknown/expired instrument
    else:
        raise

Prevention

When it happens

Trigger: Requesting a ticker for a non-existent, misspelled, or expired instrument_name; or a Deribit permission/availability error returned in the error envelope. The URL embeds the symbol unescaped, so whitespace/commas also produce malformed names.

Common situations: Passing instrument names assembled from stale cached lists (contract expired), trailing whitespace in symbols, or wrong instrument naming conventions (must be e.g. BTC-PERPETUAL or BTC-27JUN26-25000-C).

Related errors


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