options backfill: skip empty month frames before concat (pandas FutureWarning)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user