Skip to content

AccountView

Describes @stxapp/stx-typescript 0.12.1, the current release.

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

const ws = await client.websocket().connect();
const view = await ws.accountView({ onChange: (c) => render(c.view.state()) });
view.balance?.available_balance; // "746.8600"
view.openOrders[0]?.id; // "4702e9b6-211a-4805-a605-0eb0817ee9b3"
view.openOrders[0]?.status; // "open"
view.openOrders[0]?.price; // "0.5800"
Property Type Description
onChange (change: AccountChange) => void | undefined
seeds Record<string, number> Join snapshots applied so far, per channel: 1 after the first seed, more after reconnects.
ws STXWebSocket
balance Record<string, any> | null The latest balance summary, or null before the first snapshot.
closed boolean
fills Record<string, any>[] Fills, newest first.
openOrders Record<string, any>[] Open orders, newest first.
positions Record<string, any>[] Positions, one per market.
ready boolean True once every channel has delivered its join snapshot.
apply(msg: ChannelMessage | { channel?: string; event: string; payload: any }): AccountChange | undefined

Apply one channel message. The view calls this for the channels it joined; call it yourself to feed messages from an account: channel or a channel you joined elsewhere. Unknown events are ignored.

Parameter Type Description
msg ChannelMessage | { channel?: string; event: string; payload: any }

Returns AccountChange \| undefined.

close(): Promise<void>

Leave the four channels. The socket stays open.

Returns Promise<void>.

state(): AccountState

The whole view as plain data.

Returns AccountState.

STX is operated by XV Exchange, LLC, a Designated Contract Market regulated by the U.S. Commodity Futures Trading Commission (CFTC). Contracts traded on STX are cleared by XV Clearing, LLC, a CFTC-registered Derivatives Clearing Organization. Trading involves substantial risk of loss and may not be appropriate for everyone. Members risk losing the cost to enter any transaction, including fees. Consider whether trading is appropriate for you in light of your experience and financial resources. Nothing on this site is investment advice or a recommendation to trade. Past performance is not indicative of future results.

© 2026 STX. All rights reserved.llms.txtllms-full.txtView as Markdown
Docs version v1.10.5