Skip to content

Flat Files

Flat files deliver the whole universe for one date in one call — every option contract or every stock for a given (security type, request type, date). Use them for daily ETL and backtests that need everything; use the per-contract reference endpoints when you need one contract fast; use streaming for live data.

Pull a file

The flat_files namespace exposes one method per (security type, request type) pair: option_quote, option_trade, option_trade_quote, option_ohlc, option_open_interest, option_eod, stock_quote, stock_trade, stock_trade_quote, stock_eod — plus a generic request(sec_type, req_type, date).

rust
use thetadatadx::flatfiles::{FlatFileFormat, ReqType, SecType};

// Vendor-format file straight to disk (bounded memory):
tdx.flatfile_option_quote("20250303", "quotes.csv", FlatFileFormat::Csv).await?;

// Decoded rows in memory:
let rows = tdx.flatfile_request_decoded(SecType::Option, ReqType::Quote, "20250303").await?;

Size guidance

Flat files are large — a whole-universe option-quote day commonly exceeds 100 MB and tens of millions of rows.

  • The decoded-rows path materializes everything in memory before returning; reserve it for machines with headroom.
  • The to-disk path (flatfile_to_path, the HTTP route, the CLI) keeps peak memory bounded and is the right default for ETL.
  • Transient download failures retry automatically with backoff; tune attempts and backoff via the flatfiles_* configuration fields.

Released under the Apache-2.0 License.