Skip to main content
Composite “agent startup” bundle. Fetches the caller’s account state, open positions, market summaries for held symbols, and the count of open orders — all in one call with sub-handlers parallelized. Equivalent to calling accountState + openOrders + marketSummary separately, but cheaper (weight 2 vs 5 + 5 + 1 = 11). Weight: 2

Request

{
  "type": "agentContext",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "broker_id": "orderly",
  "account_id": "0xabc..."
}
FieldTypeRequiredDefaultNotes
addressstringYesWallet address
broker_idstringNoOptional
account_idstringNoOptional — see “Primary account” below

Response

FieldTypeNotes
accountobjectSingle account snapshot (subset of accountState)
account.open_order_countintCount from openOrders; defaults to 0 on sub-handler failure
positions[]arrayOpen positions (same shape as accountState)
markets[]arrayOne entry per symbol held in positions[]; same shape as marketSummary row
markets[].24h_change_pctstring(close - open) / open × 100 (computed at the bundle layer)

Notes

  • Primary account selection (when account_id is omitted): the largest account_value, with account_type == "main" as the tiebreaker
  • Sub-handlers run in parallel: accountState ‖ openOrders, then marketSummary once held symbols are known
  • markets[] only includes symbols the account actually holds — not the entire universe
  • For the full open orders list, call openOrders separately
{
  "success": true,
  "data": {
    "account": {
      "broker_id": "orderly",
      "account_id": "0xabc...",
      "account_value": "50000.5",
      "total_collateral_value": "45000",
      "free_collateral": "30000",
      "margin_ratio": "0.25",
      "total_unrealized_pnl": "5000.5",
      "total_pnl_24_h": "250.75",
      "open_order_count": 7
    },
    "positions": [ /* same shape as accountState.positions[] */ ],
    "markets": [ /* marketSummary row plus a 24h_change_pct field */ ]
  },
  "ts": 1779269143700
}