DBNStore.to_file

Write data to a DBN file.

Parameters

Parameter
Type
Required
Description
path
PathLike[str] or str
required
The file path to write to.
mode
str
optional
The file write mode to use, either "x" or "w". Defaults to "w".
compression
Compression or str
optional
The compression format to write. If None, uses the same compression as the underlying data.

Returns

A DBNStore object.

API method
1
2
3
4
5
DBNStore.to_file(
    path: PathLike[str] | str,
    mode: Literal["w", "x"] = "w",
    compression: Compression | str | None = None,
) -> None
Example usage
1
2
3
4
5
6
7
8
9
10
11
12
13
import databento as db

client = db.Historical("$YOUR_API_KEY")

data = client.timeseries.get_range(
    dataset="GLBX.MDP3",
    symbols=["ESM2"],
    schema="trades",
    start="2022-06-06",
)

# Save streamed data to .dbn.zst
data.to_file("GLBX-ESM2-20220606.trades.dbn.zst")