Unsubscription
The parameter struct and builder for LiveClient::unsubscribe.
The builder can be instantiated with the associated function builder(), and the struct is created from the builder with the build() method.
For every field except sent_at, there is an identically named setter method on the builder.
An Unsubscription can also be created from a Subscription with Subscription::to_unsubscription() or Unsubscription::from(&subscription).
Fields
| Parameter | Type | Description |
|---|---|---|
symbols | Symbols | The symbols of the instruments to unsubscribe from. Symbols::All removes every symbol for the schema. |
schema | Schema | The data record schema to unsubscribe from. |
stype_in | SType | The symbology type of input symbols. Must be SType::RawSymbol, SType::Parent, or SType::InstrumentId. Defaults to SType::RawSymbol. |
sent_at | OffsetDateTime | When the unsubscription was last sent to the gateway. Set by the client and used by LiveClient::resubscribe to replay subscriptions and unsubscriptions in order. Defaults to OffsetDateTime::UNIX_EPOCH until sent. |
API method
pub struct Unsubscription {
pub symbols: Symbols,
pub schema: Schema,
pub stype_in: SType,
pub sent_at: OffsetDateTime,
} Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use databento::{
dbn::{SType, Schema},
live::{Subscription, Unsubscription},
};
let unsubscription = Unsubscription::builder()
.symbols(vec!["AAPL", "MSFT"])
.schema(Schema::Tbbo)
.build();
assert_eq!(unsubscription.stype_in, SType::RawSymbol);
let subscription = Subscription::builder()
.symbols(vec!["AAPL", "MSFT"])
.schema(Schema::Tbbo)
.build();
assert_eq!(subscription.to_unsubscription(), unsubscription);