1. The API is a platform layer, not an add-on
The difference is ownership: who maintains the screen, the session, the credential, and the escalation path.
| Platform | How you connect | Who keeps it up | Typical user |
|---|---|---|---|
| TWS / IB Gateway | Local install | You | Depth, multi-leg |
| Client Portal | Browser login | Broker | Accounts, reports |
| Mobile | App login | Broker | Positions, alerts |
| API | Your program, plus gateway | You | Automation |
Whoever keeps the connection keeps the schedule: an upgrade and a 3 a.m. page are one event.
2. Three interfaces, three access surfaces
Access is fixed at connect time: socket, credential, breach signal, support queue. Features sit on the API comparison page.
| Interface | Where it connects | Authentication | Default ceiling | Ops burden |
|---|---|---|---|---|
| TWS API | Local TWS or Gateway socket | Local login session | 50 req/s | Uptime, build drift |
| Client Portal Web API | Local proxy or OAuth | Gateway, OAuth 1.0a/2.0 | 10 req/s each | Keepalive, daily login |
| FIX | Broker session over VPN | Logon, sequence numbers | 250 msgs/s | Network, resend |
Desktop multi-leg: TWS API. Server accounts: Web API. Routing and drop copy: FIX.
3. Authentication: three modes, three maintenance bills
| Mode | Eligible accounts | Automated | Credential | You maintain |
|---|---|---|---|---|
| Client Portal Gateway | Individual | One login a day | Browser SSO session | Uptime, re-login |
| OAuth 1.0a | Advisors, brokers, funds, developers | Yes | Keys plus session token | Signing, rotation |
| OAuth 2.0 | Advisors and brokers | Yes | Authorization code | Token refresh |
Two rules decide it: OAuth 1.0a is the only path for third-party developers, and advisor account management requires OAuth 2.0.
4. Sessions and allowlists: four gates you pass again
Four items reopen daily or weekly; one failing stops the strategy.
- Entitlements: API and trading permissions are separate; account type decides interfaces.
- IP allowlist: one fixed address; a dynamic IP drops daily.
- Keepalive: ping the gateway; on a drop, re-authenticate or alert.
- Maintenance: never schedule across the weekend rollover.
When it dies there is no error email, only an absence of fills.
5. Rate limits: two ceilings, two arithmetic styles
TWS API scales by market data lines; Web API caps a rate per username plus endpoint limits. Errors: 100 or 429.
| Interface | Ceiling | Breach | Countermeasure |
|---|---|---|---|
| TWS API, 100 lines | 50 req/s | Error 100; session may end | Queue, slow down |
| Web API global | 10 req/s | 429 | Token bucket |
| Web API snapshot | 10 req/s | 429 | Batch, cache |
| Web API history | 50/min | 429 | Backfill after close |
| Web API orders | Once per 5s | 429 | Stream instead |
| FIX via Gateway | 250 msgs/s | Session settings | Shaping |
Repeat offenders sit in a ten minute penalty box: the limit stops you.
Pacing is per connection, lines are per account, and the Web API rate is shared by username.
6. A worked budget: 100 requests a minute, 1,000 orders a day
Put both sizes in one budget.
| Workload | Per minute | Cap | Feasible | How |
|---|---|---|---|---|
| Quotes, 30 symbols | 60 | 10/s | If shaped | Batch |
| Order polling | 24 | 1 per 5s | At edge | Stream |
| Historical backfill | 12 | 50/min | Yes | After close |
| Account reads | 4 | 1 per 5s | Yes | Cache 30s |
| Total | 100 | - | Yes | 20% margin |
1.67 per second looks safe until 60 calls land in one second.
A thousand orders over 6.5 hours is 2.6 a minute; preview, place, and confirm make 3,000 calls, or 7.7 a minute. Order calls share the cap, the open clusters volume, and retries trigger 429.
On TWS API, fifty a second is 3,000 a minute, so a hundred uses three percent.
7. Latency: the path sets the floor
Latency is path length.
| Path | Round trip | Drift | Choose it when |
|---|---|---|---|
| Local TWS or Gateway | Tens of ms | Local load | Desktop workflow |
| Local Gateway to Web API | Hundreds of ms | Proxy hop | Account work |
| FIX session | Ten ms or less | Network, resends | Institutional routing |
Measure the 1st, 50th, and 99th percentile; averages hide the open.
8. Paper and live: one path, two logins
Paper proves workflow and errors, not queue position or slippage.
| Environment | Entry | Port | Proves | Cannot prove |
|---|---|---|---|---|
| TWS paper | TWS | 7497 | Order flow | Queueing |
| TWS paper | IB Gateway | 4002 | Same, lighter | Desktop UI |
| TWS live | TWS or Gateway | 7496/4001 | Everything | - |
| Web API paper | Client Portal Gateway | Paper login | Accounts, orders | Matching |
| Web API live | Same gateway | Live login | Everything | - |
One gateway, one port, two logins: make the environment a setting, printed at startup.
Paper quotes lag; rehearse on paper trading first.
9. Support: four channels, four boundaries
Separate account issues from code issues.
| Channel | Good for | Not for | Pace |
|---|---|---|---|
| API ticket | Entitlements, auth, limits | Strategy logic | Days |
| Docs and courses | Parameters, samples | Your config | Immediate |
| Community libraries | Samples, traps | Guarantees | Varies |
| Institutional onboarding | FIX, compliance | Small accounts | Scheduled |
Include the request ID, timestamp, interface, and error code to skip two rounds. Docs start at the support centre.
10. Seven checks before launch
- Environment switch: printed at startup with the account number.
- Credential custody: keys and cookies stay out of the repository.
- Allowlist: the fixed address changes through a process.
- Budget sheet: per-minute and daily caps assert in code.
- Backoff: 429 and error 100 back off, never retry unbounded.
- Idempotency: client order ID, de-duplication, status check after reconnect.
- Health checks: external monitoring alerts first, automates second.
FAQ
Is API access charged separately?
Usually free; quotes, depth, and historical data may be billed.
Must individual accounts log in daily?
Gateway: one interactive login a day; OAuth runs unattended.
How long to wait after a 429?
Back off exponentially; repeat offenders can hit a penalty box.
Does TWS have to stay open?
Yes; IB Gateway is lighter but still needs a build and login.
Are paper quotes real time?
Often delayed; do not judge real-time sensitivity on paper.
Can several strategies run at once?
Yes, by client ID, but quota is per account and username.
Is FIX realistic for a small team?
Rarely: network, session, and compliance costs are high.
Does switching interfaces mean a rewrite?
Usually the access layer; abstract the calls and swap the adapter.
Sources and date
Sources: IBKR Web API documentation (authentication, pacing, endpoint rate table), TWS API documentation (pacing, error codes), IBKR API product pages and Campus courses, published fee and entitlement notes, port references. Reviewed: November 2026. Limits, ports, and schedules change; confirm against official documentation.