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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: dlee-bq <dlee@brightquery.com>
This commit is contained in:
Art Cashin
2026-11-28 23:53:44 +00:00
committed by GitHub
parent 5f00f98af1
commit 45c2a1342c
6 changed files with 28 additions and 32 deletions

View File

@@ -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

View File

@@ -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}),
],
)

View File

@@ -224,7 +224,7 @@
"h": 14,
"state": {
"params": {
"symbol": "BUKENGY"
"symbol": "BUK100P"
}
}
},

View File

@@ -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",
]

View File

@@ -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())

View File

@@ -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"})