Skip to content

AccountView

Describes stx-python 0.8.0, the current release.

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

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”

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
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() -> Dict[str, Any]

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

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.

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