# AccountView

> A live copy of your account kept by the socket.

Source: https://docs.stxapp.io/sdks/python/reference/account-view/

## `AccountView`

A live view of your account. Get one with `ws.account_view()`:

```python
```

async with client.websocket() as ws:
    view = await ws.account_view(on_change=lambda c: print(c.kind))
    view.balance["available_balance"]   # "746.8600"
    view.open_orders[0]["status"]       # "open"

### Attributes

| Attribute | Type | Description |
|---|---|---|
| `channels` | `Dict[str, Channel]` |  |
| `seeds` | `Dict[str, int]` |  |
| `balance` | `Optional[Dict[str, Any]]` | The latest balance summary, or None before the first snapshot. |
| `open_orders` | `List[Dict[str, Any]]` | Open orders, newest first. |
| `fills` | `List[Dict[str, Any]]` | Fills, newest first. |
| `positions` | `List[Dict[str, Any]]` | Positions, one per market. |
| `ready` | `bool` | True once every channel has delivered its join snapshot. |
| `closed` | `bool` |  |

### Methods

#### `apply()`

```python
apply(msg: Any) -> Optional[AccountChange]
```

Apply one channel message (a `ChannelMessage` or anything with
`event` and `payload`). Unknown events are ignored.

| Parameter | Type | Description |
|---|---|---|
| `msg` | `Any` |  |

#### `state()`

```python
state() -> Dict[str, Any]
```

The whole view as plain data, e.g. to send to a browser.

## `AccountChange`

One applied message, passed to `on_change`.

`kind` is `balance`, `orders`, `fills`, `positions` or
`payment`; `event` the wire event; `snapshot` True when that part
was replaced by a join snapshot rather than patched.

### Attributes

| Attribute | Type | Description |
|---|---|---|
| `kind` | `str` |  |
| `event` | `str` |  |
| `snapshot` | `bool` |  |
| `payload` | `Any` |  |
| `view` | `AccountView` |  |
