From 45c2a1342cc90e7b13ab3c4fa394cf3cd4decbc8 Mon Sep 17 00:00:00 2001 From: Art Cashin <64659740+artcashin@users.noreply.github.com> Date: Sat, 28 Nov 2026 23:53:44 +0000 Subject: [PATCH] fix(cboe): do not offer the indices that have no constituents file (#7847) * fix(cboe): clear error for an index with no constituents file Cboe answers 403 or 404 for an index it publishes no constituents file for, which surfaced as an unexpected error. The app template opened on such an index (BUKENGY); it now opens on BUK100P. Co-Authored-By: Claude Fable 5.2 * fix(cboe): do not offer the 29 indices that have no constituents file Cboe answers 403 for the constituents file of its sector and factor indices. They are removed from CONSTITUENTS_EU, which feeds both the parameter and the widget choices, so they can no longer be requested. The 403/404 error branch added earlier on this branch is removed; the fetcher is as on develop. Co-Authored-By: Claude Fable 5.2 --------- Co-authored-by: Claude Fable 5.2 Co-authored-by: dlee-bq --- .../index/integration/test_index_api.py | 2 +- .../index/integration/test_index_python.py | 2 +- .../cboe/openbb_cboe/assets/apps.json | 2 +- .../cboe/openbb_cboe/utils/helpers.py | 31 ++----------------- .../providers/cboe/tests/test_cboe_router.py | 9 ++++++ .../providers/cboe/tests/test_models.py | 14 +++++++++ 6 files changed, 28 insertions(+), 32 deletions(-) diff --git a/openbb_platform/extensions/index/integration/test_index_api.py b/openbb_platform/extensions/index/integration/test_index_api.py index 9531319b67b..07395341bd6 100644 --- a/openbb_platform/extensions/index/integration/test_index_api.py +++ b/openbb_platform/extensions/index/integration/test_index_api.py @@ -23,7 +23,7 @@ def headers(): [ ({"symbol": "dowjones", "provider": "fmp"}), ({"symbol": "^TX60", "provider": "tmx", "use_cache": False}), - ({"symbol": "BUKBUS", "provider": "cboe"}), + ({"symbol": "BUK100P", "provider": "cboe"}), ], ) @pytest.mark.integration diff --git a/openbb_platform/extensions/index/integration/test_index_python.py b/openbb_platform/extensions/index/integration/test_index_python.py index 8af1c186a03..cff4ba2e01c 100644 --- a/openbb_platform/extensions/index/integration/test_index_python.py +++ b/openbb_platform/extensions/index/integration/test_index_python.py @@ -20,7 +20,7 @@ def obb(pytestconfig): "params", [ ({"symbol": "dowjones", "provider": "fmp"}), - ({"symbol": "BUKBUS", "provider": "cboe"}), + ({"symbol": "BUK100P", "provider": "cboe"}), ({"symbol": "^TX60", "provider": "tmx", "use_cache": False}), ], ) diff --git a/openbb_platform/providers/cboe/openbb_cboe/assets/apps.json b/openbb_platform/providers/cboe/openbb_cboe/assets/apps.json index 483434ec252..68bcb86f4f3 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/assets/apps.json +++ b/openbb_platform/providers/cboe/openbb_cboe/assets/apps.json @@ -224,7 +224,7 @@ "h": 14, "state": { "params": { - "symbol": "BUKENGY" + "symbol": "BUK100P" } } }, diff --git a/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py b/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py index b439f3d791b..b3431b6e2df 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py +++ b/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py @@ -53,6 +53,8 @@ GLOBAL_INDICES_FEED = ( CONSTITUENTS_AU = Literal["X2C", "X2CF", "X2CG", "X2CN"] +# The Cboe Europe indices with a constituents file. Cboe answers 403 for its +# sector and factor indices, so they are not offered. CONSTITUENTS_EU = Literal[ "BAT20P", "BBE20P", @@ -64,18 +66,6 @@ CONSTITUENTS_EU = Literal[ "BDK25P", "BEP50P", "BEPACP", - "BEPBUS", - "BEPCNC", - "BEPCONC", - "BEPCONS", - "BEPENGY", - "BEPFIN", - "BEPHLTH", - "BEPIND", - "BEPNEM", - "BEPTEC", - "BEPTEL", - "BEPUTL", "BEPXUKP", "BES35P", "BEZ50P", @@ -85,7 +75,6 @@ CONSTITUENTS_EU = Literal[ "BFRM20P", "BIE20P", "BIT40P", - "BNL25P", "BNLM25P", "BNO25G", "BNORD40P", @@ -95,23 +84,7 @@ CONSTITUENTS_EU = Literal[ "BUK250P", "BUK350P", "BUKAC", - "BUKBISP", - "BUKBUS", - "BUKCNC", - "BUKCONC", - "BUKCONS", - "BUKENGY", - "BUKFIN", - "BUKHI50P", - "BUKHLTH", - "BUKIND", - "BUKLO50P", - "BUKMINP", - "BUKNEM", "BUKSC", - "BUKTEC", - "BUKTEL", - "BUKUTL", ] diff --git a/openbb_platform/providers/cboe/tests/test_cboe_router.py b/openbb_platform/providers/cboe/tests/test_cboe_router.py index 81dc90e0d0d..d4eb3a59f6c 100644 --- a/openbb_platform/providers/cboe/tests/test_cboe_router.py +++ b/openbb_platform/providers/cboe/tests/test_cboe_router.py @@ -592,6 +592,15 @@ class TestAppsJson: assert apps assert set(apps[0]["tabs"]) == {"indices", "options", "optimizer", "futures"} + def test_constituents_open_on_an_index_with_a_file(self): + """The template's index is one Cboe publishes constituents for.""" + import json + + apps = json.dumps(asyncio.run(cboe_router.cboe_apps())) + + assert "BUKENGY" not in apps + assert '"BUK100P"' in apps + def test_standalone_ids_when_extensions_absent(self): """Standard-namespace IDs are swapped for the ``/cboe`` ones.""" apps = asyncio.run(cboe_router.cboe_apps()) diff --git a/openbb_platform/providers/cboe/tests/test_models.py b/openbb_platform/providers/cboe/tests/test_models.py index 4f00ccb1800..d009c0c76a7 100644 --- a/openbb_platform/providers/cboe/tests/test_models.py +++ b/openbb_platform/providers/cboe/tests/test_models.py @@ -599,6 +599,20 @@ class TestIndexConstituents: assert raw == [{"Weight": "1"}] helper.assert_awaited_once_with("X2CG", session="sod") + @pytest.mark.parametrize("symbol", ["BUKENGY", "BEPFIN", "BNL25P", "BUKHI50P"]) + def test_index_without_a_constituents_file_is_not_a_choice(self, symbol): + """Cboe publishes no constituents file for its sector and factor indices.""" + from typing import get_args + + from pydantic import ValidationError + + from openbb_cboe.utils.helpers import CONSTITUENTS_EU + + assert symbol not in get_args(CONSTITUENTS_EU) + + with pytest.raises(ValidationError): + CboeIndexConstituentsFetcher.transform_query({"symbol": symbol}) + def test_transform(self): """Percent change is normalized and context columns dropped.""" query = CboeIndexConstituentsFetcher.transform_query({"symbol": "BUK100P"})