Available languages: [Python](https://databento.com/docs/api-live/client/stop.python.md) · [C++](https://databento.com/docs/api-live/client/stop.cpp.md) · [Rust](https://databento.com/docs/api-live/client/stop.rust.md) · [Raw](https://databento.com/docs/api-live/client/stop.raw.md)

Source: https://databento.com/docs/api-live/client/stop



### Live.stop

Stop the session and finish processing received records.

A client can only be stopped after a successful connection is made by calling [Live.subscribe](https://databento.com/docs/api-live/client/subscribe.md).

This method does not block waiting for the connection to close.
If this is desired, use [Live.block_for_close](https://databento.com/docs/api-live/client/block-for-close.md) or [Live.wait_for_close](https://databento.com/docs/api-live/client/wait-for-close.md) to wait for the client to disconnect.

The connection will eventually close after calling this method.
Once the connection has closed, the `Live` client can be reused but the session state is not preserved.

#### API method

```python
Live.stop() -> None
```

#### Example usage

```python
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",
)

# Start the streaming session
client.start()

# Stop the streaming session
client.stop()
```
