Skip to content

Historical.timeseries.get_range

POST/v0/timeseries.get_rangePython · HTTP · CLI

Records of one schema for some securities over a time range, from your recordings in the cloud: merged across recordings that overlap (each record once) and in time order. OHLCV bars exist only here, built from your own uploads, and only for the securities and times they cover.

Parameters

dataset str required

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

start str | int | date required

The inclusive start. An ISO 8601 time (JST unless it names a zone), a date (that trading day, from JST midnight) or UTC nanoseconds.

end str | int | date | None optional

The exclusive end, in the same forms. Default: the end of the start's trading day. At most 31 days after start; both between 2000 and 2100.

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 = "trades"

trades (default), mbp-10, definition, imbalance, brisk-quotes or ohlcv-1s, ohlcv-1m, ohlcv-1h, ohlcv-1d. See Data format.

stype_in str optional = "raw_symbol"

Only raw_symbol (JPX codes).

stype_out str optional = "instrument_id"

Only instrument_id; every record also has its code in symbol.

limit int | None optional

The most records to return, after time-ordering.

path str | Path | None optional

Also write the records (Parquet) to this file.

Returns

DataStore

A DataStore of the records.

API method
Historical.timeseries.get_range(
    dataset: str,
    start: str | int | date,
    end: str | int | date | None = None,
    symbols: Iterable[str] | str = "ALL_SYMBOLS",
    schema: str = "trades",
    stype_in: str = "raw_symbol",
    stype_out: str = "instrument_id",
    limit: int | None = None,
    path: str | Path | None = None,
) -> DataStore
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:01",
    limit=1,
)
print(data.to_df(tz="Asia/Tokyo").iloc[0])
export BRISK_KEY=$(brisk identity --export)   # your archive identity is the API key
curl -X POST 'https://h2dxahfcj6436nlf3y255exu6e0omhrk.lambda-url.ap-northeast-1.on.aws/v0/timeseries.get_range' \
  -u "$BRISK_KEY:" \
  -d dataset=XTKS.BRISKDEMO \
  -d symbols=7203 \
  -d schema=trades \
  -d start=2021-09-27T09:00 \
  -d end=2021-09-27T09:01 \
  -d encoding=json \
  -d limit=1
brisk query XTKS.BRISKDEMO --schema trades --symbols 7203 \
  --start 2021-09-27T09:00 --end 2021-09-27T09:01 --limit 1
Example responseCaptured from the demo
ts_event         2021-09-27 09:00:00.072765+09:00
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
Name: 2021-09-27 09:00:00.072765+09:00, dtype: object
{
  "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"
}
"ts_recv","ts_event","publisher_id","instrument_id","action","side","depth","price","size","flags","sequence","trade_id","symbol"
"2021-09-27T00:00:00.072765000Z","2021-09-27T00:00:00.072765000Z",2,7203,"T","A",0,10155,305500,0,8224,"8224-0","7203"