Skip to content

DataStore.to_json

Python

Write the records as JSON lines, one record each.

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_json(
    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_json("trades.json")
print(open("trades.json").readline())
Example responseCaptured from the demo
{
  "ts_recv": "2021-09-27T00:00:00.072765000Z",
  "ts_event": "2021-09-27T00:00:00.072765000Z",
  "publisher_id": 2,
  "instrument_id": 7203,
  "action": "T",
  "side": "A",
  "depth": 0,
  "price": 10155.0,
  "size": 305500,
  "flags": 0,
  "sequence": 8224,
  "trade_id": "8224-0",
  "symbol": "7203"
}