Skip to main content
The Info client covers every read: market data, account and order queries, history, and realtime WebSocket streams. It needs no wallet and signs nothing. Every method returns the raw parsed JSON — see the Info API pages for the exact response shapes.
Pass skip_ws=True to construct a REST-only client (no background WebSocket thread). Call info.close() when you are done to stop the WebSocket cleanly. timeout, max_retries, and backoff work as described in Timeouts and retries; reads are always safe to retry.

Market data

configs is the source of truth for contract IDs, coin IDs, and the priceScale / qtyScale / tickSize / stepSize you need to convert display values to the raw integers the API expects. Fetch it once and cache it.
  • l2_book raises ServerError with code NOT_READY when the contract has no book yet. A group the contract does not offer is rejected with 400.
  • candle_snapshot takes start and end times in Unix milliseconds; always pass a window. The interval must be one of 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M.
  • ticker’s window slides over the last 24 hours; it is not a calendar day.

Account and orders

account_id accepts an int or string.
  • user_orders returns live orders only — resting and partially filled orders, plus conditional orders not yet triggered. Finished orders are in order_history. market_deployer_id=0 and contract_id=0 (the defaults) mean all. The answer is capped: when truncated is true the list is incomplete, so narrow the query by deployer or contract rather than treating a missing order as gone.
  • orders_by_ids / orders_by_cloids only see live orders too. Filled, canceled, and not-yet-triggered conditional orders are omitted, as are ids from another deployer. Pass the order’s own market_deployer_id (0 matches nothing and is refused locally), and at most 256 ids per call. Ids that are not found are simply absent from the result.

History

Finished orders, fills, and funding payments come from the history queries. All three take the same arguments and page the same way:
  • Rows are ascending by time. To page, pass the last row’s time as the next start_time — the bound is inclusive, so de-duplicate the overlapping row (execId for fills, orderId for orders).
  • limit is 1 to 1000 (the default is 1000). There may be more rows when the page is full or when truncated is true — a page can be cut short to fit the reply, so a page with fewer rows than limit is not proof you have reached the end.
  • end_time=0 means no upper bound. Times are Unix milliseconds.
  • History is indexed shortly after execution: an order that just finished may take a moment to appear here.

WebSocket streams

The Info client manages one shared WebSocket connection. Subscribe with a subscription dict and a callback; the callback receives each decoded message. subscribe returns an integer subscription id you pass back to unsubscribe.
Channels — see the WebSocket reference for payloads:
  • asset may be given as an int; the SDK sends it as the string the server requires.
  • l2Book groupings. group is optional and must be one of the contract’s digitMerge values; each grouping is a separate stream. A group equal to the contract’s tickSize is the raw book and is subscribed as such. A GroupRemoved frame means the grouping was removed from the contract and the stream has ended.
  • userAccount pushes the account view for one market deployer periodically, so positions and balances can be streamed rather than polled.
  • Snapshot frames. openOrders sends one snapshot when you subscribe — the userOrders response body — and no updates after it; use orderUpdates for changes. orderUpdates / userFills (recent history rows) and trades (recent trades, flagged isSnapshot) open with a snapshot whose shape differs from the updates that follow. candle has no snapshot: fetch history with candle_snapshot and apply the stream on top. Your callback must handle both shapes.
  • Refused subscriptions come back as an error frame whose data.subscription echoes the request that was refused. Pass Info(ws_error_callback=...) to receive them.
  • A malformed subscription dict raises WebsocketError before anything is sent.
Callbacks run on the socket’s reader thread, so keep them short. The client pings every 30 seconds and automatically reconnects, replaying its active subscriptions.