Live.start
Start the session.
A client can only be started once, and after a successful connection is made by calling Live.subscribe.
A client can be gracefully stopped by calling Live.stop or forcefully using Live.terminate
When iterating records with Live.__iter__ or Live.__aiter__ it is not necessary to call Live.start and doing so before iterating will raise a ValueError.
Info
A session cannot be started more than once.
API method
1
Live.start() -> None Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import databento as db
# Create a live client
client = db.Live(key="$YOUR_API_KEY")
# Subscribe to the trades schema for all ES futures
client.subscribe(
dataset="GLBX.MDP3",
schema="trades",
stype_in="parent",
symbols="ES.FUT",
)
# Print records as they arrive
client.add_callback(print)
# Start the streaming session
client.start()
# Block until disconnection
client.block_for_close()