Skip to content

Historical.timeseries.get_snapshot

Python

The latest record of each security at or before a moment: its book as it stood. BRiSK sends a security's whole state on every update, so the last record is the state. By default the moment is on the receipt clock, so it holds what a program receiving the feed would have held then. A security with no record since since is absent. Implemented in the client over get_range; it adds no endpoint. For book-deltas, each security's whole books as of the moment by BRiSK's stamp: a clear and its levels, rebuilt by the cloud API from its last checkpoint.

Parameters

dataset str required

XTKS.BRISK (your own live recordings) or XTKS.BRISKDEMO (the public demo, open to every identity).

at str | int | date required

The moment: an ISO 8601 time (JST unless it names a zone), a date (that trading day, from JST midnight) or UTC nanoseconds. Records at exactly this moment count.

symbols Iterable[str] | str optional = "ALL_SYMBOLS"

Up to 2,000 JPX codes ("7203", "167A"), as a list or comma-separated. Default "ALL_SYMBOLS".

schema str optional = "brisk-quotes"

A record schema: brisk-quotes (default), mbp-10, book-deltas, imbalance, trades or definition; not bars.

since str | int | date | None optional

Where the search starts. Default: the JST midnight of at's trading day. During the session pass a later one, or the search reads the whole morning.

ts_filter str | None optional

ts_recv (the default: what had been received by at) or ts_event (BRiSK's stamp, and the only one for book-deltas).

skew float optional = 10.0

Seconds of padding either side of the window for ts_filter="ts_recv" (default 10). A warning says when BRiSK's stamps ran ahead of the receipt clock by more than half of it.

path str | Path | None optional

Also write the records (Parquet) to this file.

Returns

DataStore

A DataStore with one row per security, in instrument_id order.

API method
Historical.timeseries.get_snapshot(
    dataset: str,
    at: str | int | date,
    symbols: Iterable[str] | str = "ALL_SYMBOLS",
    schema: str = "brisk-quotes",
    since: str | int | date | None = None,
    ts_filter: str | None = None,
    skew: float = 10.0,
    path: str | Path | None = None,
) -> DataStore
Example usage
import briskapi

client = briskapi.Historical()
snap = client.timeseries.get_snapshot(
    dataset="XTKS.BRISKDEMO",
    at="2021-09-27T09:00:00",
    symbols=["7203", "6758"],
    schema="brisk-quotes",
)
print(snap.to_df(tz="Asia/Tokyo")[["symbol", "bid_price", "ask_price", "indicative_price", "indicative_volume"]])
Example responseCaptured from the demo
                                 symbol  bid_price  ask_price  indicative_price  indicative_volume
ts_recv
2021-09-27 08:59:59.993844+09:00   6758    13195.0    13200.0           13200.0             245900
2021-09-27 08:59:59.993551+09:00   7203    10145.0    10150.0           10150.0             304700