Historical.batch.download
Download a batch job or a specific file to {output_dir}/{job_id}/.
Will automatically generate any necessary directories if they do not already exist.
Related: Download center.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id | str | required | The batch job identifier. |
output_dir | PathLike[str] or str | optional | The directory to download the file(s) to. If None, defaults to the current working directory. |
filename_to_download | str | optional | The specific file to download. If None then will download all files for the batch job. |
keep_zip | bool, default False | optional | If True, and filename_to_download is None, all job files will be saved as a .zip archive in the output_dir. |
Returns
list[Path]
A list of paths to the downloaded files.
API method
1 2 3 4 5 6
Historical.batch.download(
job_id: str,
output_dir: PathLike[str] | str | None = None,
filename_to_download: str | None = None,
keep_zip: bool = False,
) -> list[Path] Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import databento as db
client = db.Historical("$YOUR_API_KEY")
# Download all files for the batch job
client.batch.download(
job_id="GLBX-20220610-5DEFXVTMSM",
output_dir="my_data/",
)
# Alternatively, you can download a specific file
client.batch.download(
job_id="GLBX-20220610-5DEFXVTMSM",
output_dir="my_data/",
filename_to_download="metadata.json",
)