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

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


### LiveBlocking::Unsubscribe

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

The symbols don't need to match an earlier [LiveBlocking::Subscribe](https://databento.com/docs/api-live/client/live-blocking-subscribe.md) 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](https://databento.com/docs/api-live/basics/system-messages.md) `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.

#### API method

```cpp
void Unsubscribe(const std::vector<std::string>& symbols,
    Schema schema, SType stype_in);
```

#### Parameters

| Parameter | Type | Description |
| `symbols` | std::vector\ | The product symbols to unsubscribe from. Use `databento::kAllSymbols` from `` to remove all symbols for the schema. |
| `schema` | databento::Schema | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.md) to unsubscribe from. |
| `stype_in` | databento::SType | The [symbology type](https://databento.com/docs/api-live/basics/symbology.md) of input `symbols`. Must be `RawSymbol`, `Parent`, or `InstrumentId`. |

#### Example usage

```cpp
#include <databento/live.hpp>

using namespace databento;

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