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

# Prices & Streams

> Polled prices and four real-time feeds.

## Polled price

```python theme={null}
price = await client.markets.price("ETH/USD")   # latest feed price, float
```

Good for scripts. For anything latency-sensitive, stream instead.

## Streams

| Factory                                  | Transport      | Delivers                      | Notes                                                                                               |
| ---------------------------------------- | -------------- | ----------------------------- | --------------------------------------------------------------------------------------------------- |
| `client.lazer_price_stream(feed_ids)`    | SSE            | Prices, lowest latency        | Feed ids from `pair.lazer_feed.feed_id`                                                             |
| `client.hermes_price_stream(feed_ids)`   | Pyth Hermes WS | Prices                        | 0x-hex Pyth feed ids                                                                                |
| `client.pair_data_stream()`              | Socket.IO      | Funding / OI / spread updates | Needs `pip install 'avantis-trader-sdk[streams]'`. Protocol: [Pair data Socket.IO](/data/socket-io) |
| `client.order_event_stream(trader=None)` | Pusher WS      | Your fills and cancels        | Idle unless your orders execute                                                                     |

All streams share the same API: `await stream.run(callback)` blocks and invokes the callback per event; `stream.stop()` ends it.

### Price stream

```python theme={null}
eth = await client.markets.pair("ETH/USD")
stream = client.lazer_price_stream([eth.lazer_feed.feed_id])

async def on_price(update):        # PriceUpdate
    print(update.feed_id, update.price, update.best_bid, update.best_ask)

await stream.run(on_price)
```

`PriceUpdate` fields: `feed_id`, `price`, `timestamp_ms`, `best_bid`, `best_ask`, `raw`.

### Pair data

Live catalog diffs (funding, OI, spread, market hours) from the data
service. Payloads are **partial** — bootstrap from `GET /v2/trading` and
deep-merge. Full handshake, hosts, and payload rules:
[Pair data Socket.IO](/data/socket-io).

```python theme={null}
# pip install 'avantis-trader-sdk[streams]'
stream = client.pair_data_stream()

async def on_pairs(diff):          # raw RES:DATA dict
    print(list(diff.get("pairInfos", {})))

await stream.run(on_pairs)
```

### Order events

The reliable way to confirm fills (see [Core concepts](/concepts#receipts-and-fills)):

```python theme={null}
orders = client.order_event_stream()

async def on_event(ev):            # OrderEvent
    print(ev.event, ev.data)       # OrderPickedUpForExecution, ExecutionConfirmedInFlashblock,
                                   # OrderFilled, OrderCanceled

await orders.run(on_event)
```

For streaming prices straight into locally built orders, see the [market-maker fast path](/advanced/mm-fast-path).
