Skip to main content
Build a table of wallets with their grades, profit and loss (P&L), and the timestamps behind those figures. Then read their open positions and calculate a subtotal only for wallets with known P&L. You need a Pro API key and Python with requests installed. Run python -m pip install requests if needed. The snippets form one script and share the variables from step 1.

1. Set up the API helper

The helper stops on permanent failures, including a bad credential or lapsed subscription. It retries 408, 429, 502, 503, and 504 up to 4 attempts. A monthly quota failure stops immediately.
parse_float=Decimal preserves decimal JSON values for the subtotal. Round only when printing. Connection failures raise from requests, so an unreachable API never looks like an empty portfolio. Repeating POST /traders/batch after a timeout is safe because it only reads data. Do not reuse this retry helper for a write that lacks an idempotency key.

2. Read wallets in groups of 25

Batch traders accepts up to 25 wallet addresses, usernames, or trd_ IDs per request. Ask for expand: ["trust"] to receive the timestamps used below.
Check each item’s status before using its data. A failed input does not fail the other inputs. Optional fields are omitted from the JSON, so read them with .get(). Do not use pnl.last_7d or pnl.last_30d. They are deprecated and are not returned.

3. Separate the subtotal from missing data

Calculate the subtotal from wallets with a known pnl.total. Keep a list of wallets with no figure and a separate list whose timestamp exceeds your freshness limit.
The 24-hour maximum age is an application choice. On this trader field, freshness.status: "fresh" says a sync timestamp exists; it does not impose an age limit. Check as_of yourself. A subtotal can include old figures, so print the stale list beside it. If any wallet lacks P&L, the script reports a covered subtotal rather than claiming a total for the whole portfolio.

Handle an untracked wallet

sync_status: "unknown" means 0xinsider does not track the wallet. Reading it does not start tracking it. Wallets enter the tracked set through 0xinsider’s own large-trade, large-position, and leaderboard data. Keep an untracked wallet in the missing list and check it again on the next scheduled run. Faster polling does not change that status.

4. Read open positions

Positions accepts up to 25 repeated wallet parameters. The example fetches every page for each group.
requests sends a list value as repeated query parameters, so wallets[start:start + 25] becomes one wallet= per address. An unseen address returns any recorded rows or an empty list. An unresolved username or trd_ ID returns 404 with error.param: "wallet"; fix the input rather than retrying it. Show freshness and last_reconciled_at alongside each position value. Missing reconciliation fields should remain visibly unavailable.

5. Choose a refresh interval

The account has a 100-request-per-minute limit and an included quota of 500,000 requests per UTC month on Pro or 2,000,000 on Max. Batch requests also use a 2,500-item-per-minute limit. All keys on the account share these budgets; see Rate limits. Each group of 25 wallets costs 1 batch request, plus 1 positions request per page. The positions page contains up to 100 rows. A group with no positions still needs its first request. Refresh every 5 or 15 minutes unless your application needs another interval. P&L changes when a new sync is available, and the timestamp tells you when that happened. Raise min_size if you want fewer small positions and fewer pages. The positions route supports ETag. If you add conditional requests, handle 304 before parsing the body because it has no body; the helper above is for full responses.

Limits

  • P&L is the last synced figure, not a live wallet balance.
  • Requests do not start tracking a wallet or move funds.
  • Positions cover open, valued positions with YES and NO legs. They exclude closed positions and markets with more than 2 outcomes.
  • An empty positions result means no matching valued positions were returned. It does not establish that the wallet holds nothing.
  • A portfolio with missing P&L has a covered subtotal, not a complete total.
Use Position timeline to inspect stored fills for one position.