> ## Documentation Index
> Fetch the complete documentation index at: https://api.unusualwhales.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> API requests use the base URL https://api.unusualwhales.com and require a bearer token in the `Authorization` header (`Authorization: Bearer <API_KEY>`). Create and manage API tokens at https://unusualwhales.com/dashboard/api.
> For live market data inside an AI tool, use the Unusual Whales MCP server at https://unusualwhales.com/public-api/mcp.
> Instructions for agents using Unusual Whales tools: https://unusualwhales.com/skill.md

# net-flow

> Options net flow: market wide tide, per sector flow and near dated expiry tide

Topic
messages**3**
routing**message key**
encoding**protobuf**

## Messages on this topic

[dte-tide
DteTide
Net options flow of near dated contracts, bucketed to the minute and broken out by underlying type, moneyness and time to expiry. Every trade counts into four buckets: its own moneyness and ALL\_MONEYNESS, crossed with its own underlying type and ALL\_TYPES, so the ALL buckets are pre-aggregated roll ups. Each message is a per window partial sum; consumers add messages with the same bucket together. net means ask side minus bid side.
11 fields→](/docs/kafka/types/DteTide.md)

[market-cope
NetFlow
Market wide options net flow ("market tide"): the ask side vs bid side volume and premium of all option trades, aggregated across the whole market. Published under two message keys with the same payload: key market-cope carries one minute buckets and key second-market-cope carries one second buckets. Each message is a per interval delta. Consumers NEED TO sum the deltas to build cumulative series.
27 fields→](/docs/kafka/types/NetFlow.md)

[sec-indst
SecIndst
Options net flow aggregated per sector. Same field semantics as NetFlow: net means ask side minus bid side, otm fields count OTM contracts only, and each message is a per interval delta.
27 fields→](/docs/kafka/types/SecIndst.md)

The message type is determined by the Kafka message key.

## Consume the topic

```python Python theme={null}
from confluent_kafka import Consumer
from unusualwhales.schema_pb2 import DteTide, NetFlow, SecIndst

# The record key selects the message type.
BY_KEY = {
    b"dte-tide": DteTide,
    b"market-cope": NetFlow,
    b"sec-indst": SecIndst,
}

# CONFIG comes from the Connecting section of the Kafka overview.
consumer = Consumer(CONFIG | {"group.id": "my-net-flow-consumer"})
consumer.subscribe(["net-flow"])

while True:
    msg = consumer.poll(1.0)
    if msg is None or msg.error():
        continue

    message_type = BY_KEY.get(msg.key())
    if message_type is None:
        continue

    event = message_type()
    event.ParseFromString(msg.value())
    print(event)
```
