OpenBB-finance/OpenBB · error · OpenBBError

vx_type must be one of: 'am', 'eod'

Error message

vx_type must be one of: 'am', 'eod'

What it means

Raised by OpenBB's CBOE provider when fetching current VX (VIX futures) data with a vx_type argument that is neither 'am' nor 'eod'. 'am' returns only the front-month AM-settlement symbols (VX_AM_SYMBOLS); 'eod' returns the first nine current end-of-day contract symbols. The check exists because the downstream symbol list and DataFrame column shaping depend on this two-way branch.

Source

Thrown at openbb_platform/providers/cboe/openbb_cboe/utils/vix.py:130

        The type of VX futures to get. Default is "eod".
            am: Mid-morning TWAP value
            eod: End-of-day value
    use_cache : bool
        Whether to use the cache. Default is True. Cache is only used for symbol mapping.

    Returns
    -------
    DataFrame
        DataFrame with the current VX futures data.
    """
    # pylint: disable=import-outside-toplevel
    from datetime import datetime  # noqa
    from openbb_core.app.model.abstract.error import OpenBBError
    from openbb_cboe.models.equity_quote import CboeEquityQuoteFetcher
    from pandas import DataFrame

    if vx_type not in ["am", "eod"]:
        raise OpenBBError("vx_type must be one of: 'am', 'eod'")

    current_symbols = list(get_vx_symbols().values())[:9]
    symbols = VX_AM_SYMBOLS if vx_type == "am" else current_symbols
    current_months = [VX_EOD_SYMBOL_TO_MONTH.get(d) for d in current_symbols]
    current_year = datetime.today().year
    data = await CboeEquityQuoteFetcher.fetch_data(
        {"symbol": ",".join(symbols), "use_cache": use_cache}, {}
    )
    df = DataFrame([d.model_dump() for d in data])  # type: ignore

    if vx_type == "am":
        df = df[["symbol", "last_price"]]
    elif vx_type == "eod":
        df = df.sort_values(by="last_timestamp", ascending=False)[
            ["symbol", "last_price"]
        ]
        df = df.set_index("symbol")
        df = df.filter(items=current_symbols, axis=0).reset_index()

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass exactly 'am' or 'eod' (lowercase) as vx_type.
  2. Normalize input before the call: vx_type = vx_type.strip().lower() and reject anything else.
  3. If building a wrapper API, expose vx_type as Literal['am','eod'] so invalid values fail at type-check time.

Example fix

# before
await get_vx_futures(vx_type='AM')

# after
await get_vx_futures(vx_type='am')
Defensive patterns

Strategy: validation

Validate before calling

VX_TYPES = {'am', 'eod'}
if vx_type not in VX_TYPES:
    raise ValueError(f"vx_type must be one of {sorted(VX_TYPES)}, got {vx_type!r}")

Type guard

from typing import Literal
VxType = Literal['am', 'eod']

def is_vx_type(value: str) -> bool:
    return value in ('am', 'eod')

Prevention

When it happens

Trigger: Calling equity.vix(status='futures', ...) style helpers routed into openbb_cboe.utils.vix with vx_type misspelled or capitalized, e.g. vx_type='AM', vx_type='EOD', vx_type='settle', or passing None/another string through a custom script or Router command that forwards user input verbatim.

Common situations: User interface dropdowns that send capitalized labels ('AM') instead of lowercase codes; typos from hand-written Python; upgrading scripts where an older parameter name (e.g. 'extended', 'period') was repurposed into vx_type; passing an Enum's name instead of its value.

Related errors


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