briskapi.connect¶
Start a live feed and make it the default source for Ticker and Market, from a site, as brisk live --site does. site="demo" is the public BRiSK Next demo: not a live connection but a recording of 27 September 2021 that the demo site serves as files, downloaded, checked against pinned hashes and replayed at its recorded pace; cache=DIR replays a copy of those files downloaded before. site="sbi", "e-shiten", "matsui", "monex" or "smbcnikko" is your broker's live BRiSK (below). A complete session is uploaded to your private archive unless you opt out; output also keeps it on disk. On the command line: brisk live (see Recording).
Parameters¶
site str required"demo", or "sbi", "e-shiten", "matsui", "monex" or "smbcnikko": your broker's live BRiSK, signing in as login does unless it already has.
codes list[str] | None optionalSecurities to decode (default: the whole market).
history bool optional = FalseKeep every update and trade, for Ticker.history() and .trades().
upload bool | None optionalFalse uploads nothing; None follows your choice (on by default).
output str | Path | None optionalAlso keep each recording here (a broker's day comes as several), as SOURCE_YYYYMMDD_FROM-TO.
on_day Callable | None optionalCalled with each recording's result (kept, uploaded).
gateway bool optional = FalseAlso serve the feed to briskapi.Live() on this computer (brisk live does by default).
timeout float | None optionalSeconds to wait for the initial state (default 60, or 120 for a broker; a broker feed with no session to join waits for the next trading day's).
cache str | Path | None optionalThe demo from a copy of its files downloaded before (default: download them).
speed float optional = 1The demo's replay speed: 1 is the recorded pace, 0 as fast as possible.
limit_frames int | None optionalStop the demo after this many frames (a partial replay is never uploaded).
trace_protocol bool optional = FalseA broker's connection steps on stderr, tokens redacted.
profile dict | None optionalA broker connection's unverified Socket.IO parameters.
upload_market_data bool | None optionalFalse uploads a broker session's timing summary but not its market recording.
Returns¶
A Feed, already holding every selected security's state.
briskapi.connect(
*,
site: str, # "demo", or a broker: "sbi", ...
codes: list[str] | None = None,
history: bool = False,
upload: bool | None = None,
output: str | Path | None = None,
on_day: Callable | None = None,
gateway: bool = False,
timeout: float | None = None,
node: str = "node",
cache: str | Path | None = None, # the demo
speed: float = 1, # the demo
limit_frames: int | None = None, # the demo
trace_protocol: bool = False, # a broker
profile: dict | None = None, # a broker
upload_market_data: bool | None = None, # a broker
) -> Feed