Skip to main content
Receive real-time updates on your positions.
  • Topic: position
  • Stream: Private (wss://api.ekiden.fi/ws/private)

Authenticate

Use authentication flow described in the Connect page.

Subscribe

{ "op": "subscribe", "args": ["position"], "req_id": "202001" }
Ack:
{ "op": "subscribed", "args": ["position"], "req_id": "202001" }

Events

Messages arrive with op: "event", topic: "position", and data is an array of PositionResponse augmented with PnL fields. Example:
{
	"op": "event",
	"topic": "position",
	"data": [
		{
			"sid": "0xpos1",
			"market_addr": "0xmarket",
			"user_addr": "0xuser",
			"size": -250,
			"price": 100100,
			"entry_price": 100100,
			"margin": 50000,
			"funding_index": 12345,
			"epoch": 42,
			"is_cross": true,
			"initial_margin": 1200,
			"initial_margin_mark": 1210,
			"maintenance_margin": 800,
			"leverage": 10,
			"mark_price": 100200,
			"seq": 999,
			"timestamp": 1681234567,
			"timestamp_ms": 1681234567000,
			"side": "sell",
			"unrealized_pnl": -25,
			"liq_price": 100000
		}
	]
}
Field notes:
  • initial_margin, initial_margin_mark, maintenance_margin, leverage, and liq_price may be null when not computable (e.g., zero size), though typical streaming updates include them.
  • timestamp (seconds) is deprecated; prefer timestamp_ms.
  • Semantics: initial_margin is entry-notional based IM requirement; initial_margin_mark is mark-notional based IM requirement. margin is the actual collateral assigned to the position (quote units, scaled). In cross mode, it represents the portion of account equity allocated to this position for risk and liquidation.

Fields

FieldTypeNotes
sidstringPosition identifier (vault address)
market_addrstringMarket address
user_addrstringUser address
sizeintegerSigned base units (scaled)
priceintegerEntry price alias (scaled)
entry_priceintegerSame as price for clarity
marginintegerMargin allocated to position (quote units, scaled)
funding_indexintegerPosition funding index
epochintegerInternal epoch/version
is_crossbooleanMargin mode
initial_margininteger or nullRequired initial margin (entry notional)
initial_margin_markinteger or nullRequired initial margin (mark notional)
maintenance_margininteger or nullRequired maintenance margin
leverageinteger or nullEntry notional / margin
mark_priceintegerCurrent mark price
seqintegerSequence of last update
sidestringbuy or sell inferred from size
unrealized_pnlintegerSigned PnL (scaled)
liq_priceinteger or nullEstimated liquidation price
timestampintegerDeprecated seconds timestamp
timestamp_msintegerMilliseconds timestamp (preferred)
See schema details in AsyncAPI: PositionResponse.