Five points first
- The Web API allows 10 requests/second per username.
- Endpoint limits: 1 per 5 seconds or 15 minutes.
- Socket pacing is market data lines ÷ 2, 50 per second.
- A 429 can park your IP for 10 minutes.
- 1,000 orders a day rarely trips it; bursts do.
01What a 429 actually rejects
A 429 says the request was valid but arrived too fast; slowing down fixes it. A 401 is an expired session and a 500 a server fault, so retrying all three alike turns a recoverable error into a block. IBKR documents a 10-minute penalty box for violating IPs and permanent blocks for repeats: stop the queue, not the request, since the whole second draws on one allowance.
02Three layers: global, endpoint, connection
The global cap is 10 requests/second per authenticated username; extra sessions share an egress IP. Endpoints are tighter: orders 1 per 5 seconds, scanner 1 per second. Sockets allow market data lines ÷ 2, 50 per second; a breach returns error 100.
| Layer | Limit | Scope | On breach |
|---|---|---|---|
| Global (Web API) | 10 req/s | Per username | 429 |
| Single endpoint | 1/15 min – 10/s | Per endpoint | 429 |
| Socket (TWS/Gateway) | lines ÷ 2 | Per client | Error 100 |
| IP penalty box | 10 min | Per IP | Temporary, then permanent |
03Turn allowances into intervals
Milliseconds are harder to get wrong: 1 ÷ limit × 1.25. History allows 10 per second or 50 per minute, so 200 bars spend the minute budget in 5 seconds and call 51 fails; pace it at 1.2 seconds.
| Endpoint | Limit | Interval |
|---|---|---|
/iserver/marketdata/snapshot | 10/s | 125 ms |
/iserver/marketdata/history | 10/s or 50/min | 1.2 s |
/iserver/orders | 1/5 s | 6.25 s |
04The "10 requests a second" design that fails
Ten workers, six symbols each: 60 calls averaging 10 per second over 6 seconds, yet all leave inside 0.55 seconds, about 98 per second. REST rejects call 11, the socket call 51. Retrying at once extends the penalty.
| Time | Sent | OK | Rejected |
|---|---|---|---|
| 0.00–0.20 s | 18 | 18 | 0 |
| 0.20–0.40 s | 38 | 38 | 0 |
| 0.40–0.55 s | 54 | 50 | 4 |
05Backoff: 1, 2, 4, 8 seconds plus jitter
Exponential backoff waits 2^(n-1) seconds, capped at 30, with equal jitter: base ÷ 2 + random(0, base ÷ 2). Keep retries convergent: one queue per session, stop after four failures. Never blind-retry an order POST; deduplicate with cOID and query first, as in rejected orders.
| Retry | Window | Draw | Total |
|---|---|---|---|
| 1 | 0.5–1.0 s | 0.7 s | 0.7 s |
| 2 | 1.0–2.0 s | 1.6 s | 2.3 s |
| 3 | 2.0–4.0 s | 3.1 s | 5.4 s |
| 4 | 4.0–8.0 s | 6.4 s | 11.8 s |
06Retry-After and the 10-minute box
Honour Retry-After when present. IBKR does not promise it; treat the 10-minute box as the floor: one 429 backs off 1/2/4/8 seconds, three in a minute pause 60 seconds, two rounds from one IP stop 10 minutes.
07Queue design: one bucket, one writer
Limit before sending. A token bucket refilled at 8 per second, 80% of the cap, admits each call. Priority runs cancel, orders, reads, then backfill at 50 per minute; one writer thread sends orders, and snapshots older than 2 seconds are dropped.
08The 1,000 orders a day budget
1,000 orders a day is 0.043 per second, under 0.5% of the cap. A 40-order rebalance in 2 seconds is 20 per second; retrying all 1,000 inside 60 seconds is 16.7 per second and lands in the penalty box.
09Five common questions
How is a 429 different from a 503?
429 is a rate breach with a valid request; 503 means the service is down.
How long should I wait after a 429?
Retry-After if sent; otherwise 1, 2, 4, 8 seconds with jitter. The box is 10 minutes.
Can retrying lock my account?
IBKR documents a 10-minute IP penalty box and possible permanent blocks.
Do REST and socket pace alike?
No. The Web API caps at 10 requests/second; the socket uses lines ÷ 2, 50 by default.
Will 1,000 orders a day hit a limit?
Not by volume, at 0.043 per second; bursts do — 40 in 2 seconds.