REST API — Positions & account

Position, account, and fill-history shapes. As with orders, the SDK reads these locally; the future hosted gateway serves the same shapes over HTTP.


GET/v1/positions

Positions

Open positions, optionally filtered to one market.

  • Name
    venue
    Type
    string
    Description
    Required.
  • Name
    market
    Type
    string
    Description
    Optional filter.

SDK

await client.positions({ venue: 'hl' })

Response — Position[]

[
  {
    "venue": "hl",
    "market": "BTC",
    "side": "buy",
    "size": "0.0003",
    "entryPrice": "50000",
    "markPrice": "50120",
    "unrealizedPnl": "0.036",
    "liquidationPrice": "41200",
    "leverage": "10"
  }
]

POST/v1/positions/{market}/close

Close a position

Flatten an open position with a reduce-only IOC at the slippage band (default 2%). Throws INVALID_ARGUMENT if there's no open position on the market.

SDK

await client.closePosition({ venue: 'hl', market: 'BTC', slippageBps: 200 })
// → OrderStatus

GET/v1/balances

Balances

Asset balances per venue.

SDK

await client.balances({ venue: 'hl' })
// → Balance[]  { asset, total, available, locked }

GET/v1/margin

Margin state

Free collateral, margin ratio, initial/maintenance margin, and max leverage.

SDK

await client.marginState({ venue: 'hl' })
// → { marginRatio, freeCollateral, initialMargin,
//     maintenanceMargin, maxLeverage }

GET/v1/account

Account snapshot

One-shot snapshot combining balances + margin + leverage + builder attribution + network.

SDK

await client.account({ venue: 'hl' })
// → AccountSnapshot

GET/v1/fills

Fills

Historical fills, newest-first, optionally windowed by from / to (unix ms) and limit (default 100).

SDK

await client.fills({ venue: 'hl', market: 'BTC', limit: 50 })
// → Fill[]

Was this page helpful?