LiveClient::close

Stop the session. The instance can be reused by calling Live.reconnect.

API method
pub async fn close(&mut self) -> databento::Result<()>;
Example usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use databento::{
    LiveClient,
    dbn::{Dataset::GlbxMdp3, SType, Schema},
    live::Subscription,
};

// Create a live client
let mut client = LiveClient::builder()
    .key("$YOUR_API_KEY")?
    .dataset(GlbxMdp3)
    .build()
    .await?;
// Subscribe to the trades schema for all ES futures
client
    .subscribe(
        Subscription::builder()
            .schema(Schema::Trades)
            .stype_in(SType::Parent)
            .symbols("ES.FUT")
            .build(),
    )
    .await?;
// Start the streaming session
client.start().await?;
// Close the streaming session
client.close().await?;