Skip to Content
Scalar
Trading APIs

Get position and margin

Returns the current position, margin, and outstanding order sizes for a user address and instrument. Requires an `Authorization: Bearer` SIWE token proving control of `user`; otherwise 401.

GET
/account/{user}/positions/{instrument_bytes}

Returns the current position, margin, and outstanding order sizes for a user address and instrument. Requires an Authorization: Bearer SIWE token proving control of user; otherwise 401.

Authorization

bearer_auth
headerAuthorizationBearer <token>

Path Parameters

user*string

User address in hex format (0x prefix optional)

instrument_bytes*string

Instrument identifier in hex format (0x prefix optional)

Response Body

User instrument position and margin

application/json
  1. response

A user's position in one instrument.

quantity and the outstanding_*_quantity fields are in WHOLE CONTRACTS — the same unit as order quantity, scale factor 1 (position accumulates as quantity += fill_quantity per fill; see maen_order_store::UserInstrumentInfo::apply_trade). The margin fields are in MICRO-DOLLARS (CASH_DENOMINATOR = 1e6 units per $1; one contract's full notional = contract_notional·1e6 = 10_000_000). price on the wire is human dollars.

Account-level balance/margin are deliberately absent — fetch them from GET /account/{user}, which is their single source.

instrument*string

Instrument identifier as 0x-prefixed lowercase hex

outstanding_ask_margin*string

Ask-side margin locked by resting asks, micro-dollars (base-10 string).

outstanding_ask_quantity*integer

Total resting ask quantity, whole contracts.

Formatint64
outstanding_bid_margin*string

Bid-side margin locked by resting bids, micro-dollars (base-10 string; CASH_DENOMINATOR = 1e6 per $1), net of position that nets against it.

outstanding_bid_quantity*integer

Total resting bid quantity, whole contracts.

Formatint64
quantity*string

Signed net position, whole contracts (base-10 string, may be negative). Same unit as order quantity; scale factor 1 — no micro-scaling.

user*string

User address as 0x-prefixed lowercase hex

Example Request
curl -X GET 'https://testnet-api.scalar.market/account/string/positions/string'
Example Response
{  "instrument": "string",  "outstanding_ask_margin": "string",  "outstanding_ask_quantity": 0,  "outstanding_bid_margin": "string",  "outstanding_bid_quantity": 0,  "quantity": "string",  "user": "string"}