quantlab.utils.cli.place_downloads#

quantlab.utils.cli.place_downloads(config, download_dir)[source]#

Return config with its raw and watermark directories under download_dir.

A config factory builds raw_data_dir_path as .../<subdir>/<vendor> under the library’s data root. This keeps the vendor directory name and moves it: the result reads and writes <download_dir>/<vendor> and <download_dir>/_watermarks/<vendor>, each of which the acquisition extends with its data type’s directory (crsp_daily, nbbo). Everything an acquisition derives from the raw directory’s parent (the CRSP _reference/ and _vintage/ directories) therefore lands in download_dir too.

Parameters:
configAcquisitionConfig

The config a registry config_factory returned.

download_dirstr or os.PathLike

The directory chosen for this run’s downloads.

Returns:
AcquisitionConfig

A copy of config with the two paths replaced; config itself is unchanged.

Examples

With cfg.raw_data_dir_path ending in wrds_crsp/wrds:

moved = place_downloads(cfg, "/mnt/raw")
moved.raw_data_dir_path      # '/mnt/raw/wrds'
moved.watermark_path         # '/mnt/raw/_watermarks/wrds'