{"record":{"id":"7f6e9a1f0fb0f7a6","repo":"OpenBB-finance/OpenBB","slug":"vx-type-must-be-one-of-am-eod","errorCode":null,"errorMessage":"vx_type must be one of: 'am', 'eod'","messagePattern":"vx_type must be one of: 'am', 'eod'","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/cboe/openbb_cboe/utils/vix.py","lineNumber":130,"sourceCode":"        The type of VX futures to get. Default is \"eod\".\n            am: Mid-morning TWAP value\n            eod: End-of-day value\n    use_cache : bool\n        Whether to use the cache. Default is True. Cache is only used for symbol mapping.\n\n    Returns\n    -------\n    DataFrame\n        DataFrame with the current VX futures data.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from datetime import datetime  # noqa\n    from openbb_core.app.model.abstract.error import OpenBBError\n    from openbb_cboe.models.equity_quote import CboeEquityQuoteFetcher\n    from pandas import DataFrame\n\n    if vx_type not in [\"am\", \"eod\"]:\n        raise OpenBBError(\"vx_type must be one of: 'am', 'eod'\")\n\n    current_symbols = list(get_vx_symbols().values())[:9]\n    symbols = VX_AM_SYMBOLS if vx_type == \"am\" else current_symbols\n    current_months = [VX_EOD_SYMBOL_TO_MONTH.get(d) for d in current_symbols]\n    current_year = datetime.today().year\n    data = await CboeEquityQuoteFetcher.fetch_data(\n        {\"symbol\": \",\".join(symbols), \"use_cache\": use_cache}, {}\n    )\n    df = DataFrame([d.model_dump() for d in data])  # type: ignore\n\n    if vx_type == \"am\":\n        df = df[[\"symbol\", \"last_price\"]]\n    elif vx_type == \"eod\":\n        df = df.sort_values(by=\"last_timestamp\", ascending=False)[\n            [\"symbol\", \"last_price\"]\n        ]\n        df = df.set_index(\"symbol\")\n        df = df.filter(items=current_symbols, axis=0).reset_index()","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass exactly 'am' or 'eod' (lowercase) as vx_type.","Normalize input before the call: vx_type = vx_type.strip().lower() and reject anything else.","If building a wrapper API, expose vx_type as Literal['am','eod'] so invalid values fail at type-check time."],"exampleFix":"# before\nawait get_vx_futures(vx_type='AM')\n\n# after\nawait get_vx_futures(vx_type='am')","handlingStrategy":"validation","validationCode":"VX_TYPES = {'am', 'eod'}\nif vx_type not in VX_TYPES:\n    raise ValueError(f\"vx_type must be one of {sorted(VX_TYPES)}, got {vx_type!r}\")","typeGuard":"from typing import Literal\nVxType = Literal['am', 'eod']\n\ndef is_vx_type(value: str) -> bool:\n    return value in ('am', 'eod')","tryCatchPattern":null,"preventionTips":["Normalize casing (strip().lower()) before passing provider-specific enum strings.","Expose vx_type as Literal['am','eod'] in wrappers so static checkers catch typos.","Keep a constants module mapping friendly UI labels to provider codes."],"tags":["cboe","vix","validation","query-params","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}