WebSocket API — Position Snapshots

Live position data uses the authenticated encrypted trading protocol. It is not a plaintext JSON positions channel and does not send one position per frame.

the WebSocket origin/ws/v1

Authenticate and establish the HPKE session first (see WebSocket Trading). Use an official SDK to encode requests and decrypt pushes.

Subscribe

Send an encrypted SubscribePositions request. Its plaintext protobuf fields are:

account: bytes
interval_seconds: uint32

Allowed refresh intervals are 2, 5, or 10 seconds. Error 7202 rejects any other interval.

Decrypted Push

Each encrypted push contains one complete PositionsSnapshot, not an incremental position object:

account: bytes
rows: PositionRow[]
server_timestamp: uint64
source: INITIAL | PERIODIC | EVENT
correlation_id?: bytes
FieldTypeDescription
accountbytesAuthenticated 32-byte Solana account identity; SDKs expose it as base58
rowsPositionRow[]Full set of open positions at assembly time
server_timestampuint64Sequencer assembly time in nanoseconds since Unix epoch
sourceenumINITIAL for the subscription reply, PERIODIC for interval sweeps, or EVENT after a position-changing fill, flip, or close
correlation_idbytes, optionalEchoed for the initial subscription snapshot; absent from periodic and event pushes

Because every message is authoritative, replace the local position collection with rows; do not apply it as a delta.

PositionRow

Decimal quantities and prices are strings.

FieldType / values
symbol_iduint64 protocol instrument id
sideBUY or SELL
size, entry_priceRequired decimal strings
leverageuint32
mark_price, unrealized_pnl, notionalOptional decimal strings; absent before a usable oracle mark
mark_publish_time_secOptional oracle publish time
liquidation_price, margin, mmr, mgn_ratioOptional decimal strings
margin_ratio_bpsOptional uint64
adl_indicatorOptional uint32, 0 (safest) through 5
position_statusOptional NORMAL, LIQ, or ADL
mgn_modeISOLATED or CROSS
take_profit, stop_lossOptional decimal strings
tpsl_status, tpsl_parent_order_idOptional TP/SL lifecycle data

For the same schema over REST, use authenticated encrypted POST /api/v1/positions. There is no plaintext GET /positions.

Unsubscribe

Send an encrypted UnsubscribePositions request. Re-subscribe to obtain a fresh authoritative snapshot after reconnecting or if local state is in doubt.