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

# Python Models

> Work with Python event models, unknown additive messages, Decimal V3 values, and exact orderbook strings.

WebSocket events are Pydantic models selected by `event_type`:

```python theme={null}
from polynode.types.events import PolyNodeEvent

def handle_event(event: PolyNodeEvent) -> None:
    match event.event_type:
        case "settlement":
            print(event.tx_hash, event.taker_size)
        case "status_update":
            print(event.tx_hash, event.block_number)
        case "price_feed":
            print(event.feed, event.price, event.twap_window_seconds)
        case "unknown":
            print(event.wire_event_type, event.raw)
        case other:
            print(other)
```

The model union covers fills, settlements, trades, confirmation updates, blocks, position changes, deposits, splits, merges, conversions, redemptions, combo execution/status/lifecycle/approval events, oracle events, Chainlink price feeds, and an `UnknownEvent` fallback.

Unknown additive messages preserve the raw payload. Observe them without treating every compatible server addition as fatal.

V3 decimal fractions decode as `Decimal`. Orderbook prices and sizes remain exact strings. Perps prices and quantities are also wire strings. Keep these exact representations for accounting and convert only for display.

See the [event reference](/websocket/events/settlement), [orderbook protocol](/orderbook/overview), and [perps channels](/perps/websocket/channels).
