DBNStore.to_parquet
Write data to a file in Apache parquet format.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | PathLike[str] or str | required | The file path to write the data to. |
price_type | PriceType or str, default "float" | optional | The price type to use for price fields. If "fixed", prices will have a type of int in fixed decimal format; each unit representing 1e-9 or 0.000000001. If "float", prices will have a type of float. |
pretty_ts | bool, default True | optional | Whether timestamp columns are converted to tz-aware pyarrow.TimestampType (UTC). |
map_symbols | bool, default True | optional | If symbology mappings from the metadata should be used to create a 'symbol' column, mapping the instrument ID to its raw symbol for every record. |
schema | Schema or str | optional | The data record schema for the output parquet file. Must be one of the values from list_schemas. This is only required when reading a DBNStore with mixed record types. |
mode | str | optional | The file write mode to use, either "x" or "w". Defaults to "w". |
**kwargs | Any | optional | Keyword arguments to pass to pyarrow.parquet.ParquetWriter. These can be used to override the default behavior of the writer. |
API method
1 2 3 4 5 6 7 8 9
DBNStore.to_parquet(
path: PathLike[str] | str,
price_type: PriceType | str = "float",
pretty_ts: bool = True,
map_symbols: bool = True,
schema: Schema | str | None = None,
mode: Literal["w", "x"] = "w",
**kwargs: Any,
) -> 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 .parquet
data.to_parquet("GLBX-ESM2-20220606-trades.parquet")