SPB Git

spb/hfmarketdata Public

Open high-frequency market data platform — FirstRate full-history downloader, DuckDB/Parquet lake, open REST API and React docs platform (www.hfmarketdata.io)

Python 46.7% JavaScript 37.4% CSS 14.9% HTML 0.9%

fix(api): NaN/±inf dans les Greeks sérialisés en null (500 sur /v1/options/history)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 7 h ago (Aug 10, 2026) parent 8982d91

Showing 1 changed file with +4 and −0

modified hfmarketdata/api/main.py +4 −0
@@ -184,6 +184,10 @@ def _rows_to_response(rel, limit: int, fmt: str, order_col: str):
184 184 for col in df.columns:
185 185 if str(df[col].dtype).startswith("datetime"):
186 186 df[col] = df[col].astype(str)
187 + # NaN / ±inf (Greeks manquants dans les vieux trimestres) ne sont pas
188 + # sérialisables en JSON strict → null
189 + df = df.replace([float("inf"), float("-inf")], None)
190 + df = df.astype(object).where(df.notna(), None)
187 191 return {"count": len(df), "data": df.to_dict(orient="records")}
188 192
189 193
190 194