From dc5ab31bb7c27a044580bf34617440b5d0632f62 Mon Sep 17 00:00:00 2001 From: Gahow Wang Date: Mon, 12 Oct 2026 08:07:44 -0700 Subject: [PATCH] options backfill: skip empty month frames before concat (pandas FutureWarning) Co-Authored-By: Claude Opus 5.5 --- research/lab/fetch_options.py | 1 + 1 file changed, 1 insertion(+) diff --git a/research/lab/fetch_options.py b/research/lab/fetch_options.py index f47fdb3..baeb16e 100644 --- a/research/lab/fetch_options.py +++ b/research/lab/fetch_options.py @@ -562,6 +562,7 @@ def backfill_one(api: Api, u: str, start: str, end: str, lte_active: str, hist: + dt.timedelta(days=1)).isoformat()), g) lo = (pd.to_datetime(f["expiry"]) - pd.Timedelta(days=DTE_MAX)).dt.strftime("%Y-%m-%d") frames.append(f[(f["date"] >= lo) & (f["date"] <= f["expiry"]) & (f["date"] <= end)]) + frames = [f for f in frames if len(f)] bars = pd.concat(frames) if frames else pd.DataFrame(columns=BAR_COLS) _atomic_csv(bars, os.path.join(hist, f"{u}.csv.gz")) rec = {"underlying": u, "contracts": int(len(meta)), "bars": int(len(bars)), "requests": api.n - n0,