Skip to content

DataStore.to_parquet

Python

Write the records as Parquet. With the defaults, the file is exactly what the service returned.

Parameters

path str | Path required

Where to write.

price_type str optional = "float"

"float", "fixed" or "decimal", as in to_df.

pretty_ts bool optional = True

Timestamps as such; False gives UTC nanoseconds.

map_symbols bool optional = True

Keep the symbol column.

Returns

Path

The path written.

API method
DataStore.to_parquet(
    path: str | Path,
    price_type: str = "float",
    pretty_ts: bool = True,
    map_symbols: bool = True,
) -> Path
Example usage
import briskapi

client = briskapi.Historical()
data = client.timeseries.get_range(
    dataset="XTKS.BRISKDEMO",
    symbols=["7203"],
    schema="trades",
    start="2021-09-27T09:00",
    end="2021-09-27T09:00:05",
)
import pyarrow.parquet as pq

data.to_parquet("trades.parquet")
print(pq.read_schema("trades.parquet"))
Example responseCaptured from the demo
ts_recv: timestamp[ns, tz=UTC]
ts_event: timestamp[ns, tz=UTC]
publisher_id: uint16
instrument_id: uint32
action: string
side: string
depth: uint8
price: double
size: uint64
flags: uint8
sequence: uint64
trade_id: string
symbol: string