From c66335e25bce389dd174dab37e636772c69a2932 Mon Sep 17 00:00:00 2001 From: Art Cashin <64659740+artcashin@users.noreply.github.com> Date: Sat, 28 Nov 2026 23:43:54 +0000 Subject: [PATCH] fix(cboe): a non-numeric settlement price is null (#7759) The futures options settlement file prints CAB in the price column for cabinet trades. The column then reads as text and the row fails float validation, so the whole options request failed. Settlement prices are coerced to numbers, and a non-numeric price becomes null; the row is kept. Co-authored-by: artcashin Co-authored-by: Claude Opus 5.5 Co-authored-by: dlee-bq --- .../cboe/openbb_cboe/utils/helpers.py | 5 ++++- .../providers/cboe/tests/test_models.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py b/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py index f537ce8db68..b439f3d791b 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py +++ b/openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py @@ -701,7 +701,7 @@ async def _get_settlement_csv(url: str, **kwargs) -> DataFrame: """ from io import StringIO - from pandas import DataFrame, read_csv + from pandas import DataFrame, read_csv, to_numeric response = await get_cboe_data(url, use_cache=False, **kwargs) data = read_csv(StringIO(response), index_col=None, parse_dates=True) @@ -711,6 +711,9 @@ async def _get_settlement_csv(url: str, **kwargs) -> DataFrame: data.columns = [to_snake_case(c) for c in data.columns] + if "price" in data.columns: + data["price"] = to_numeric(data["price"], errors="coerce") + return data.rename(columns={"expiration_date": "expiration"}) diff --git a/openbb_platform/providers/cboe/tests/test_models.py b/openbb_platform/providers/cboe/tests/test_models.py index 1c426d5df41..4f00ccb1800 100644 --- a/openbb_platform/providers/cboe/tests/test_models.py +++ b/openbb_platform/providers/cboe/tests/test_models.py @@ -1038,6 +1038,24 @@ class TestFuturesSettlements: final_settlement=False, ) + def test_non_numeric_price_is_null(self): + """The options file prints CAB for cabinet trades; that price is null.""" + csv = ( + "Product,Symbol,Expiration Date,Price\n" + "IBYO,IBYO/H7 P16800,2027-03-01,0.7389\n" + "IBYO,IBYO/Z6 P17000,2026-12-01,CAB\n" + ) + query = CboeFuturesSettlementsFetcher.transform_query({"options": True}) + + with patch( + "openbb_cboe.utils.helpers.get_cboe_data", new=AsyncMock(return_value=csv) + ): + raw = asyncio.run(CboeFuturesSettlementsFetcher.aextract_data(query, None)) + + results = CboeFuturesSettlementsFetcher.transform_data(query, raw) + + assert [r.price for r in results] == [0.7389, None] + def test_empty_raises(self): """A session with no published prices raises EmptyDataError.""" query = CboeFuturesSettlementsFetcher.transform_query({})