Skip to main content
All topics

Topic

Broker API Automation

How automated orders actually reach the market: authorisation, idempotency, reconciliation and the permissions never to grant.

Definition

What is broker api automation?
Broker API automation is the practice of placing orders programmatically through a broker's authorised API connection, where the vendor holds permission to submit orders on a client's behalf but never holds client funds, and the broker remains responsible for every order that leaves through its systems.

3 pieces published on this topic · Updated

Understanding broker api automation

A broker API is the mechanism by which an automated strategy places a real order. The authorisation model is the part worth understanding first: a client grants a platform permission to submit orders against their own brokerage account, and the account, the funds and the holdings stay with the broker. A platform that asks for a transfer of funds is describing something else entirely.

The engineering problem the APIs create is that order submission is a network call, and network calls fail in ways that leave the outcome unknown. A request can be accepted by the broker and the response lost, so a naive retry becomes a second position, and the system's own records will show only one. The standard defence is an idempotency key generated before the first attempt and reused on every retry.

Everything else follows from not trusting your own bookkeeping. Session tokens expire, often daily, and expiry should be detected before a trading session rather than discovered by a failing order. Positions should be reconciled against the broker's own view rather than derived from a ledger of responses. And rate limits should be treated as a design constraint, not an error to handle.

Common questions

Does a broker API connection give a vendor access to client funds?
It grants permission to submit orders against an account, which is a meaningful permission and worth scoping carefully. It does not transfer custody. Funds and holdings stay with the broker, and withdrawal is not something a trading API is used for.
What happens if an order submission times out?
The correct behaviour is to retry with the same idempotency key, so the broker can recognise the duplicate, and then reconcile against the broker's positions rather than assume. Retrying with a fresh key is how one intended order becomes two real ones.
Why do broker sessions need re-authorisation so often?
Most Indian brokers expire API sessions daily, generally requiring an interactive login step. It is a deliberate control rather than a limitation, and it means an automated system needs a defined answer for what happens to open positions when the session is gone.

Technical articles

Engineering deep-dives covering this topic.

Put this into practice

Describe a strategy in plain language, backtest it against historical data, and paper trade it before any capital is committed.