INNER CODE UNIT · Python
append_month
zillionare/zillionare · scripts/export_influx_data.py:68
def append_month(day: date, writer: TextIO, write_header: bool) -> bool:
frame = query_day(day)
if frame.empty:
return write_header
frame.to_csv(writer, index=False, header=not write_header)
return True
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)