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, normally two recordings per trading day (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_20261013_085800-113000"), thenTickerandMarket, exactly as recorded;brisk exportfor 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()orbrisk query XTKS.BRISKreads every broker day you uploaded, merged across days, with OHLCV bars. Demo recordings aren't inXTKS.BRISK; everyone can query the same demo asXTKS.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 normally 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. A busy session is split again when a
completed part brings its recording to 80 million quote rows. 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-datafor a broker's market recording), that day isn't kept anywhere, so add--output DIRto 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, and if another feed recorded that stretch,brisk repaircan fill it (Repairing a recording). 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.
- A save that fails keeps what it can. A recording whose upload failed is kept in
~/.local/share/brisk/recordingswith its manifest, andbrisk upload DIRretries. One that could not be packaged is tried again five minutes later from the same data, three times during the day and once more at its end; its tables are kept there if even that fails. If nothing of a day could be saved, its spool folder is left in place, with a warning naming it, and the next feed you start finishes it (delete the folder to give the day up).