{"record":{"id":"a154f7fe125eb797","repo":"OpenBB-finance/OpenBB","slug":"vx-type-must-be-one-of-am-eod-a154f7","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":202,"sourceCode":"            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        Categorical DataFrame with VX futures data for the given date(s).\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from datetime import datetime, timedelta  # noqa\n    from openbb_core.app.model.abstract.error import OpenBBError\n    from openbb_core.provider.utils.errors import EmptyDataError\n    from openbb_cboe.models.equity_historical import CboeEquityHistoricalFetcher\n    from pandas import Categorical, DataFrame, DatetimeIndex, concat, isna, to_datetime\n\n    if vx_type not in [\"am\", \"eod\"]:\n        raise OpenBBError(\"'vx_type' must be one of: 'am', 'eod'\")\n\n    df = DataFrame()\n    start_date = \"\"\n    end_date = \"\"\n    symbols = list(get_vx_symbols().values()) if vx_type == \"eod\" else VX_AM_SYMBOLS\n    dates = date.split(\",\") if isinstance(date, str) else date\n    dates = sorted([check_date(to_datetime(d)) for d in dates])\n    today = check_date(datetime.today()).strftime(\"%Y-%m-%d\")\n\n    if len(dates) == 1:\n        new_date = check_date(to_datetime(dates[0]))\n        if new_date.strftime(\"%Y-%m-%d\") == today:\n            df = await get_vx_current(vx_type=vx_type)\n            df[\"date\"] = new_date.strftime(\"%Y-%m-%d\")\n            return df\n\n        end_date = new_date.strftime(\"%Y-%m-%d\")\n        start_date = (check_date(new_date - timedelta(days=1))).strftime(\"%Y-%m-%d\")","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py#L184-L220","documentation":"Same vx_type contract as the current-futures endpoint, but enforced in the historical VX futures path (vix.py:202) that queries CboeEquityHistoricalFetcher for one or more dates. 'eod' resolves symbols from get_vx_symbols(); 'am' uses the fixed VX_AM_SYMBOLS list. Any other value aborts before any network request is made.","triggerScenarios":"Calling the historical VX futures helper with vx_type='AM'/'EOD'/'spot'/None, or forwarding an unvalidated CLI/web form field straight into the function alongside a date or comma-separated date list.","commonSituations":"Case-mismatch from UI labels; copy-pasting parameter values from docs that capitalize words in prose; automated pipelines that derive vx_type from a filename or config key with different casing.","solutions":["Use lowercase 'am' or 'eod' for vx_type.","Sanitize at the boundary: assert vx_type in ('am', 'eod') before invoking the helper.","Define the parameter as Literal['am', 'eod'] in your own wrapper so mypy/pydantic reject bad values early."],"exampleFix":"# before\ndf = await get_vx_futures_historical(date='2024-01-15', vx_type='EOD')\n\n# after\ndf = await get_vx_futures_historical(date='2024-01-15', vx_type='eod')","handlingStrategy":"validation","validationCode":"assert date is not None, 'date is required for historical VX futures'\nvx_type = vx_type.strip().lower()\nif vx_type not in ('am', 'eod'):\n    raise ValueError(\"vx_type must be 'am' or 'eod'\")","typeGuard":"def is_vx_type(value: str) -> bool:\n    return isinstance(value, str) and value.strip().lower() in ('am', 'eod')","tryCatchPattern":null,"preventionTips":["Centralize enum normalization in one helper shared by current and historical calls.","Validate dates as ISO weekday strings (1-5) before requesting history.","Unit-test wrappers with both valid codes and one invalid code."],"tags":["cboe","vix","validation","historical","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}