Subscribe Position
Primary WebSocket channel for all market data and order management.
Subscribe to position updates for an account (requires authentication)#
Primary WebSocket channel for all market data and order management.
Request to subscribe to position updates (requires authentication)
Parameters
sourcestringMust be 'position'
accountstringEthereum address of the account (must match authenticated user)
{
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"source": "position",
"account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78"
},
"id": 5
}Generic success response for subscription requests
Parameters
message?stringSuccess message
{
"jsonrpc": "2.0",
"result": {
"message": "Subscribed to trades"
},
"usIn": 1234567890123,
"usOut": 1234567890456,
"usDiff": 333,
"id": 2
}Published each time a position is created or updated for the subscribed account. Wrapped with type field to identify the message type.
Parameters
accountstringEthereum address of the account
subaccountIndexstringSubaccount index as string
symbolstringMarket symbol for this position
quantitystringSigned decimal string - positive for long, negative for short
basisstringSigned notional cost basis as decimal string
feesstringAccumulated trade fees as unsigned decimal string
fundingstringAccumulated funding fees as signed decimal string
marginstringCollateral amount reserved for this position as unsigned decimal string
updatedAtintegerTimestamp when position was last updated in milliseconds
{
"type": "Position",
"data": {
"account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
"subaccountIndex": "0",
"symbol": "ETHUSD",
"quantity": "1.5",
"basis": "3720.226",
"fees": "1.323667",
"funding": "87.382478",
"margin": "558.621108",
"updatedAt": 1752846925000
}
}Error response for failed requests
Parameters
jsonrpcstringJSON-RPC version
errorobjectusInintegerRequest received timestamp in milliseconds
usOutintegerResponse sent timestamp in milliseconds
usDiffintegerProcessing time in milliseconds
id?string | integer | nullRequest identifier (if provided in request, otherwise null)
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid subscription params"
},
"usIn": 1234567890123,
"usOut": 1234567890456,
"usDiff": 333,
"id": 2
}