Skip to content

DataStore.to_df

Python

The records as a pandas DataFrame (needs pip install 'briskapi[pandas]'), indexed by ts_recv (or ts_event for bars). As Databento's.

Parameters

price_type str optional = "float"

"float" (yen), "fixed" (integers of 1e-9 yen) or "decimal" (decimal.Decimal).

pretty_ts bool optional = True

Timestamps as pandas.Timestamps; False gives UTC nanoseconds.

map_symbols bool optional = True

Keep the symbol column (the JPX code).

tz str optional = "UTC"

The time zone to show timestamps in, such as "Asia/Tokyo".

count int | None optional

Return an iterator of DataFrames of at most this many rows.

Returns

pandas.DataFrame | Iterator[pandas.DataFrame]

A DataFrame, or an iterator of DataFrames with count.

API method
DataStore.to_df(
    price_type: str = "float",
    pretty_ts: bool = True,
    map_symbols: bool = True,
    tz: str = "UTC",
    count: int | None = None,
) -> pandas.DataFrame | Iterator[pandas.DataFrame]
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",
)
print(data.to_df(tz="Asia/Tokyo")[["symbol", "price", "size", "side"]])
Example responseCaptured from the demo
                                 symbol    price    size side
ts_recv
2021-09-27 09:00:00.072765+09:00   7203  10155.0  305500    A
2021-09-27 09:00:00.327866+09:00   7203  10155.0     400    A
2021-09-27 09:00:00.801729+09:00   7203  10155.0     700    A
2021-09-27 09:00:00.803944+09:00   7203  10160.0     100    B
2021-09-27 09:00:00.817904+09:00   7203  10150.0     100    A
2021-09-27 09:00:00.876274+09:00   7203  10160.0     100    B
2021-09-27 09:00:01.671092+09:00   7203  10160.0     100    B
2021-09-27 09:00:02.104003+09:00   7203  10160.0     100    B
2021-09-27 09:00:02.168343+09:00   7203  10160.0    5400    B
2021-09-27 09:00:02.176897+09:00   7203  10155.0     100    A
2021-09-27 09:00:02.176897+09:00   7203  10150.0     400    A
2021-09-27 09:00:02.183538+09:00   7203  10155.0     100    A
2021-09-27 09:00:02.186961+09:00   7203  10160.0     100    B
2021-09-27 09:00:03.038753+09:00   7203  10160.0     100    B
2021-09-27 09:00:03.038753+09:00   7203  10165.0     100    B
2021-09-27 09:00:03.068028+09:00   7203  10160.0     100    B
2021-09-27 09:00:03.068028+09:00   7203  10165.0     100    B
2021-09-27 09:00:03.824183+09:00   7203  10160.0     400    B
2021-09-27 09:00:04.746295+09:00   7203  10150.0     100    A
2021-09-27 09:00:04.817684+09:00   7203  10155.0     100    B