Skip to content

Output Writing

Syed Ibrahim Omer edited this page Apr 13, 2026 · 1 revision

Output Writing

This page documents how output paths are constructed and how files are written.

Output path selection

The writer chooses the output path based on these inputs:

  • --dir (optional output directory)
  • --output (optional output file name or list)
  • --format (file type/extension)
  • ticker, period, timeframe (for auto-naming)

Auto-generated naming

If --output is not provided, the output file name is:

<ticker>_<period>_<timeframe>.<ext>

Examples:

  • AAPL_1y_1d.csv
  • MSFT_2y_1wk.parquet

With --dir

If --dir is provided, the file is written inside that directory. The directory is created if it does not exist.

Format writers

The tool writes based on the final extension:

  • .csvpolars.DataFrame.write_csv
  • .parquetwrite_parquet
  • .jsonwrite_json
  • .xlsxwrite_excel
  • .avrowrite_avro

Concurrency model

Writes are scheduled as asyncio tasks, but the actual write calls run in threads via asyncio.to_thread(...).

This helps avoid blocking the event loop while writing large files.

Related pages:

Clone this wiki locally