INNER CODE UNIT · Python
export_all
zillionare/zillionare · scripts/export_influx_data.py:77
def export_all() -> None:
output_dir = Path.cwd() / "1m"
output_dir.mkdir(parents=True, exist_ok=True)
current = date(2005, 1, 1)
stop = date(2024, 1, 1)
while current < stop:
month_start = current.replace(day=1)
if month_start.month == 12:
next_month = date(month_start.year + 1, 1, 1)
else:
next_month = date(month_start.year, month_start.month + 1, 1)
output_path = output_dir / f"{month_start.year:04d}_{month_start.month:02d}.csv.gz"
wrote_any = False
with gzip.open(output_path, "wt", encoding="utf-8", newline="") as handle: