Skip to content

Feed.on_quote

Python

Call a function for each update, on the feed's thread. An exception in it stops the feed and is raised by wait().

Parameters

callback Callable[[dict], object] required

Called with each quote.

codes list[str] | str | None optional

Only these securities.

raw bool optional = False

BRiSK's own fields.

Returns

Callable[[], None]

A function that unsubscribes.

API method
feed.on_quote(
    callback: Callable[[dict], object],
    codes: list[str] | str | None = None,
    raw: bool = False,
) -> Callable[[], None]
Example usage
1
2
3
4
5
6
7
import briskapi

feed = briskapi.connect(site="demo", codes=["7203"], speed=0, upload=False)
seen = []
stop = feed.on_quote(lambda q: seen.append(q["indicative_price"]), codes="7203")
feed.wait()
print(len(seen), seen[:3])
Example responseCaptured from the demo
1796 [10150.0, 10150.0, 10155.0]