LiveThreaded::Unsubscribe

Remove the specified symbols from the session's subscriptions for a schema.

The symbols don't need to match an earlier LiveThreaded::Subscribe call: any subset of the subscribed symbols can be removed, and databento::kAllSymbols removes every symbol for the schema.

The gateway acknowledges the request with a SystemMsg with system code UnsubscribeAck. Symbols that aren't subscribed, or that can't be removed with the given stype_in, are left in place and reported in an ErrorMsg.

The unsubscribe's stype_in must be compatible with the subscription's stype_in.

Subscribed with
Can unsubscribe with
RawSymbol, InstrumentId, or Continuous
RawSymbol or InstrumentId
Parent
Parent

To remove a continuous symbol, unsubscribe the raw symbol or instrument ID that it resolved to at subscription time.

Parameters

Parameter
Type
Description
symbols
std::vector<std::string>
The product symbols to unsubscribe from. Use databento::kAllSymbols from <databento/symbology.hpp> to remove all symbols for the schema.
schema
databento::Schema
The data record schema to unsubscribe from.
stype_in
databento::SType
The symbology type of input symbols. Must be RawSymbol, Parent, or InstrumentId.
API method
void Unsubscribe(const std::vector<std::string>& symbols,
    Schema schema, SType stype_in);
Example usage
1
2
3
4
5
6
7
8
9
10
11
#include <databento/live.hpp>

using namespace databento;

auto client = LiveThreaded::Builder()
                  .SetKey("$YOUR_API_KEY")
                  .SetDataset("GLBX.MDP3")
                  .BuildThreaded();
client.Subscribe({"ES.FUT", "CL.FUT"}, Schema::Trades,
                 SType::Parent);
client.Unsubscribe({"CL.FUT"}, Schema::Trades, SType::Parent);