Trading API Integration: What Breaks When a Bot Goes Live
Trading API integration connects your strategy to a broker’s software door, so orders go out and fills (completed trades) come back. Sending an order is the easy part; the hard part is knowing for certain what happened to it after a dropped connection, a duplicate message or a timeout.
Live setups tend to break on this point rather than on the signal. The system and the broker disagree about a position, and nobody notices until the market moves.
The limits are real and written down. As of October 2026, Interactive Brokers’ Web API allows 50 requests per second per user; go over it and the API answers with error 429 (too many requests), and the address that sent them can be blocked for 10 minutes.
- What is trading API integration?
- REST, WebSocket or FIX: which trading API should you use?
- What does a broker API connection have to handle?
- Where do API trading setups usually break?
- How do you test an API integration before trading live?
- What should you ask a manager or platform about their integration?
- Questions traders ask about connecting to a broker API
What is trading API integration?
Trading API integration is the code that connects a trading strategy to a broker or exchange. It sends orders, follows each order until it is filled or cancelled, and checks the broker’s positions against your own. Most of the risk sits in the last two jobs.
An API (application programming interface) is the broker’s door for software instead of a person clicking buttons. On top of the same connection sits the client: the screen where you watch orders, fills and profit and loss while the strategy runs.
How these pieces fit together in a full platform is on our trading system architecture page. The servers and network underneath are on trading infrastructure.
REST, WebSocket or FIX: which trading API should you use?
Use a REST API to place orders and check their state at a calm pace, a WebSocket stream for live order and price updates, and FIX when you send large orders through an institutional broker. Most private traders and small funds combine REST with a stream.
| Type | How it works | Good for | Watch out for |
|---|---|---|---|
| REST | You ask, the broker answers, one request at a time | Placing orders, checking positions | Asking for updates over and over uses up the rate limit |
| WebSocket | The broker pushes order and price updates as they happen | Fills and prices in real time | After a drop you must reconnect and ask again what you missed |
| FIX | The industry’s standard message format, over a session with numbered messages | Larger size, institutional brokers and venues | Plan for onboarding and certification tests with the broker before the first live order |
Whichever you choose, read the broker’s limits and order-status pages before you write a line of code. They tell you exactly where your setup will be tested.
What does a broker API connection have to handle?
A trading API integration has to handle five jobs: keep the connection alive, track every order through its states, reconcile fills and positions with the broker, deal with errors such as rate limits, and show all of it on a screen you trust.
- The connection. It notices a drop within seconds, reconnects, and then asks the broker what changed while it was away.
- Order states. An order moves through states such as submitted, partly filled, filled or cancelled, not always in that order, and each broker names them its own way: Interactive Brokers uses PendingSubmit, PreSubmitted, Submitted, Filled, Cancelled and Inactive, among others. The FIX order state rules note that an exchange’s very first answer can already say partly filled or filled, because the order traded at once.
- Reconciliation. Fills are checked against a second source, because status messages alone are not reliable. Interactive Brokers’ own documentation says “often there are duplicate orderStatus messages”.
- Errors. Each error the broker can return has a written response: wait and retry, slow down, or stop trading and alert someone.
- The client. It shows open orders, fills, positions and profit and loss per currency, live, with the connection status always visible.
There is a time window on the second source too. Through the IB Gateway, the small program that connects your code to Interactive Brokers, the execution reports only reach back to midnight of the current trading day, so a system that waits until the next day to reconcile can no longer pull those reports through the API. Reconcile the same day, ideally after every fill.
Where do API trading setups usually break?
API trading setups usually break in four places: a dropped connection that leaves orders in an unknown state, a duplicate or missed message that throws the position off, a retry that sends the same order twice, and a rate limit hit at the busiest moment.
The retry fails without an error message, so nobody notices. A request times out, the code assumes the order failed and sends it again, but the first one went through. The fix is simple: give every order your own unique ID before sending it, and after a timeout ask the broker whether that ID exists before you try again.
The rate limit tends to bite exactly when markets move fast, because code that keeps asking for updates asks most often in volatile markets. A pacing rule for normal days and a slower mode for busy ones both belong in the code before the first live trade.
- On the evening of 27 November 2025, a cooling failure at a CyrusOne data centre halted CME Group’s Globex futures and options markets. Futures and options did not reopen until 7:30am Chicago time the next morning.
- CME cancelled all day orders and good-till-date orders (orders meant to stay live until a set date) for 28 November. Every system connected to CME had to learn that its orders were gone, and adjust its positions and plans to match.
After any outage, on your side or the venue’s, the rule is the same: before sending anything new, ask the broker for open orders, today’s fills and positions, and compare them with your own records.
How do you test an API integration before trading live?
Test a trading API integration before going live by running it on a paper account (simulated money) first, forcing failures on purpose, setting hard limits on order size and order count, and keeping a kill switch that stops all trading at once. Then start live at a small size.
- Pull the network cable in the middle of an open order, and check that the system finds the order again.
- Send requests faster than the limit, and check that it slows down instead of crashing.
- Kill the program after an order is sent but before the answer arrives, and check that a restart does not send it twice.
- Press the kill switch, and check at the broker that every open order is cancelled.
Hard limits exist because code fails fast. On 1 August 2012, Knight Capital’s router sent more than 4 million orders in 45 minutes while trying to fill 212 customer orders, and the firm lost more than $460 million. The SEC charged Knight in October 2013 for missing pre-trade controls (automatic checks that block an order before it reaches the market) and weak testing of new code.
Regulators still push on the same points. In February 2026, ESMA issued a supervisory briefing on algorithmic trading that covers pre-trade controls, testing and outsourced trading systems.
What should you ask a manager or platform about their integration?
Ask a manager or platform four things about their integration: what happens when their system and the broker disagree on a position, how they recover from a dropped connection, what stops a runaway order, and when they last tested a failure on purpose.
- A good answer names the source of truth (which record wins when the two disagree), how quickly a gap is found and who is alerted. “It has never happened” from a system live for more than a year is a red flag.
- A good answer on recovery describes the steps after a reconnect. “We use the standard SDK”, the broker’s ready-made code library, says nothing about what happens when it fails.
- A good answer on runaway orders gives the hard limits in numbers and who can press the kill switch. “We monitor it closely” is not a limit.
- A good answer on testing gives a date, what was simulated and what changed afterwards. Ask to see the incident log and the last test report.
For the gold strategy in The Review, we ran the strategy on our own account and also had a banking-grade business continuity audit done on the team behind it. The wider checklist is in our trading platform due diligence guide, and the costs of a weak setup show up as slippage and in operational risk.
Questions traders ask about connecting to a broker API
Interactive Brokers allows 50 API requests per second per user on its Web API, and 10 per second through the Client Portal Gateway, as of October 2026. Above that, the API returns error 429, the address can be blocked for 10 minutes, and repeat offenders permanently.
The TWS API, which most Python libraries connect to, has its own pacing rules, so check those separately.
If the API connection drops while an order is open, the order usually stays live at the broker and can fill without you seeing it. After reconnecting, ask for open orders, today’s fills and positions, and compare them with your records before sending anything new.
To stop a retry from sending a duplicate order, give every order your own unique ID before sending it. After a timeout, ask the broker whether that ID exists before sending again, because a timeout does not mean the order failed.
A trading client should show, live, every open order and its state, today’s fills, positions as the broker sees them next to your own, profit and loss per instrument and currency, and the connection status. If one of these is missing, you are trading partly blind.
The strategies worth featuring can show how every order is tracked and reconciled
Very few strategy teams can show this end to end. Most can show returns; far fewer can show what their system does when the broker and the code disagree.
For every strategy in The Review, we check how orders are tracked and reconciled, what happens after a dropped connection, the hard limits and the kill switch, and when a failure was last tested on purpose. Our scoring methodology lists the evidence for each.
Get in touch →