Skip to content

Recording

Recording isn't a third API. The live calls record as they run, and brisk live and brisk record are their command-line form, with the same code, options and upload choice.

Command line Python Records Kept on disk Uploaded
brisk live --site sbi (or e-shiten, matsui, monex, smbcnikko) briskapi.connect(site="sbi") Your broker's live feed until you stop it, each trading day as two recordings (its sessions) Each recording, with --output DIR (output=) Each recording as it is made, unless you opt out
brisk live --site demo briskapi.connect(site="demo") The demo replay, printed as JSON lines With --output DIR If the replay completes
brisk record --output DIR briskapi.record(DIR) The demo replay Always, in DIR If the replay completes

What you record is then read through the other two APIs:

  • On your computer: briskapi.load("days/sbi_live_20261013_085800-153512"), then Ticker and Market, exactly as recorded; brisk export for NautilusTrader or JSONL; or the Parquet tables themselves (data format). brisk pull (briskapi.pull()) brings an uploaded recording back to disk.
  • In the cloud: briskapi.Historical() or brisk query XTKS.BRISK reads every broker day you uploaded, merged across days, with OHLCV bars. Demo recordings aren't in XTKS.BRISK; everyone can query the same demo as XTKS.BRISKDEMO.

While it runs, brisk live also serves its feed to briskapi.Live() on this computer (Live records): the records as they arrive, not a recording.

While a day runs, it is written to disk as it arrives: Parquet files in a spool folder (~/.local/share/brisk/spool), about as large as the finished recording, so a crash loses at most its last half-minute. A broker's day becomes two recordings as it runs: the morning session's, kept and uploaded once the lunch break begins, and the afternoon's at the day's end, starting from a snapshot of the book where the morning's ended. The demo's replay is one recording.

  • Without --output, each recording goes to your archive and its local copy is removed. With uploads off as well (--no-upload, or --no-upload-market-data for a broker's market recording), that day isn't kept anywhere, so add --output DIR to keep it.
  • A lost connection doesn't lose the day. brisk live --site sbi (or another broker's site) reconnects by itself, after 5 s, then 10 s, 30 s, a minute and every 2 minutes. What it recorded before the drop is a complete recording of its own (..._085800-101500), kept and uploaded like a day, and the rest of the day is recorded from a fresh snapshot (..._102000-153512). Only the gap is missing; the cloud API merges the two. It stops for good when another connection can't help: an expired session, another BRiSK window open on your account, or a site that changed.
  • Stopping (Ctrl-C, kill, shutting the computer down, feed.close()) ends the day where it is, as the close would: the day so far is a complete recording (..._085800-121500), kept and uploaded like any day. Start again later and the rest of the day is another recording; the cloud API merges them.
  • A crash or a forced kill can't end the day, so it is repaired: the day so far (all but its last half-minute, still in the spool) gets the end marker its host never wrote, and is then kept and uploaded as that session's settings said. After a crash this happens when you next start a feed; for a host that doesn't end within 30 seconds of being asked to stop, right away. The repaired end counts the day's quote updates exactly; its frame count and duration, which died with the host, are rebuilt from the recording.