Skip to content

DataStore.to_csv

Python

Write the records as CSV.

Parameters

path str | Path required

Where to write.

pretty_px bool optional = True

Prices in yen; False gives integers of 1e-9 yen.

pretty_ts bool optional = True

ISO 8601 timestamps; False gives UTC nanoseconds.

map_symbols bool optional = True

Keep the symbol column.

Returns

Path

The path written.

API method
DataStore.to_csv(
    path: str | Path,
    pretty_px: bool = True,
    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",
)
data.to_csv("trades.csv")
print(open("trades.csv").read()[:420])
Example responseCaptured from the demo
ts_recv,ts_event,publisher_id,instrument_id,action,side,depth,price,size,flags,sequence,trade_id,symbol
2021-09-27 00:00:00.072765+00:00,2021-09-27 00:00:00.072765+00:00,2,7203,T,A,0,10155.0,305500,0,8224,8224-0,7203
2021-09-27 00:00:00.327866+00:00,2021-09-27 00:00:00.327866+00:00,2,7203,T,A,0,10155.0,400,0,8229,8229-0,7203
2021-09-27 00:00:00.801729+00:00,2021-09-27 00:00:00.801729+00:00,2,7203,T,A,0,10155.0,700,0,