OpenBB-finance/OpenBB · error · ValueError

Invalid symbol: {s}. Valid symbols are: {all_symbols}

Error message

Invalid symbol: {s}. Valid symbols are: {all_symbols}

What it means

ValueError from the symbol field_validator in DeribitFuturesInfoQueryParams. Symbols are validated against the live union of Deribit futures instrument names plus perpetual short-symbol keys (fetched with run_async at validation time), and each must appear there before perpetuals are expanded to full instrument names. Unlike the historical model, this validator does NOT call .upper(), so case matters.

Source

Thrown at openbb_platform/providers/deribit/openbb_deribit/models/futures_info.py:53

    @classmethod
    def _validate_symbol(cls, v):
        """Validate the symbol."""
        # pylint: disable=import-outside-toplevel
        from openbb_core.provider.utils.helpers import run_async
        from openbb_deribit.utils.helpers import (
            get_futures_symbols,
            get_perpetual_symbols,
        )

        symbols = v.split(",")
        new_symbols: list = []
        perpetual_symbols = run_async(get_perpetual_symbols)
        futures_symbols = run_async(get_futures_symbols)
        all_symbols = futures_symbols + list(perpetual_symbols)

        for s in symbols:
            if s not in all_symbols:
                raise ValueError(
                    f"Invalid symbol: {s}. Valid symbols are: {all_symbols}"
                )
            if s in perpetual_symbols:
                new_symbols.append(perpetual_symbols[s])
            else:
                new_symbols.append(s)

        return ",".join(new_symbols)


class DeribitFuturesInfoData(FuturesInfoData):
    """Deribit Futures Info Data."""

    __alias_dict__ = {
        "symbol": "instrument_name",
        "change_percent": "price_change",
    }
    model_config = ConfigDict(extra="ignore")

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass uppercase Deribit instrument names, e.g. 'BTC-PERPETUAL' or 'ETH-PERPETUAL'; this validator does not uppercase input.
  2. For multiple symbols, pass a comma-separated uppercase list like 'BTC-PERPETUAL,ETH-PERPETUAL'.
  3. Discover currently valid names via get_instruments('all', 'future') or the futures instruments endpoint.
  4. Check connectivity if validation itself hangs — the valid list is fetched live.

Example fix

# before
obb.derivatives.futures.info(symbol="btc", provider="deribit")

# after
obb.derivatives.futures.info(symbol="BTC-PERPETUAL", provider="deribit")
Defensive patterns

Strategy: validation

Validate before calling

from openbb_deribit.utils.helpers import get_instruments
valid = {d["instrument_name"] for d in asyncio.run(get_instruments("all", "future"))}
symbols = [s.strip() for s in raw_input.split(",")]
assert all(s and s == s.upper() and s in valid for s in symbols), "use uppercase live instrument names"

Type guard

def is_deribit_futures_symbol(s: str, valid: set[str]) -> bool:
    return isinstance(s, str) and s in valid  # case-sensitive: must be uppercase

Try / catch

from pydantic import ValidationError
try:
    obb.derivatives.futures.info(symbol=s, provider="deribit")
except ValidationError as e:
    if "Invalid symbol" in str(e):
        s = s.upper()  # most common fix, then retry once
        obb.derivatives.futures.info(symbol=s, provider="deribit")

Prevention

When it happens

Trigger: Passing lowercase symbols ('btc'), exchange-agnostic tickers ('BTCUSDT'), or expired futures contract names to the futures info endpoint. The dynamic list fetch also means a network failure surfaces during validation.

Common situations: Reusing symbol strings from other OpenBB providers where symbols are lowercase, typing Binance-style pairs, or referencing expired contracts after Deribit rolls them.

Related errors


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