Exchange API
- Category
- Algorithmic Trading
- Level
- Professional
Simple definition
The programming interface an exchange publishes so software can read prices and place orders without anyone clicking a screen.
Professional definition
The endpoints and message formats a venue exposes for programmatic access: request-response calls for orders and account state, a streaming socket for market data and fills, and a signing scheme authenticating each private request. It is the contract between a bot and the venue, and the venue controls it.
Technical definition
Two transports do different jobs. Request-response endpoints are authoritative but metered and slow; streaming subscriptions are fast but lossy, since one dropped message leaves local state silently wrong. Robust clients treat the stream as a hint and the account endpoint as truth, reconcile positions after every reconnection, attach a client-assigned order identifier so a retried submission cannot create a second position, and scope keys so a leaked trading credential cannot withdraw funds.
Academic definition
The published programmatic interface through which a trading venue exposes market data, order entry and account state, together with its authentication, versioning and rate-limiting rules.
Mechanism
The venue publishes an interface rather than only a screen because order flow is the product. Rate limits, key scopes and sequence numbers exist so one client cannot degrade the service for everyone else. The asymmetry is that the venue owns the contract: client code has to be written for a counterparty that can change a field, deprecate an endpoint, or go down in the middle of an order.
In practice
- Who uses it
- Bot developers, market makers, quantitative funds, data vendors, and anyone whose trading cannot be done by hand.
- Why it matters
- It is the only supported route to automation, and its details — limits, latencies, error codes — decide which strategies are feasible on that venue.
- Limitations
- Documentation lags behaviour, endpoints and limits change, and sandbox environments rarely reproduce production liquidity or production failure modes.
Common mistakes
- Giving a trading key withdrawal permission.
- Trusting streamed position state after a disconnect.
- Retrying a submission with no idempotent client order id.
Examples
A client loses its socket for twenty seconds. On reconnect it does not replay the gap but re-reads open orders and positions from the account endpoint, then resumes — the only state it trusts is the one the venue reports.
An order for one unit times out, so the client retries twice. With no client order id the venue accepts all three: exposure is three units while the stop was sized for one, and risk per trade is three times what the rule intended.
- intended quantity = 1 unit
- two retries after a timeout, all accepted
- stop distance sized for 1 unit
- filled quantity = 1 + 1 + 1 = 3 units
- risk at stop = 3 x planned risk
An idempotent client order id makes the duplicate submissions rejected rather than filled. This failure has nothing to do with the strategy and is one of the most common ways automated accounts are damaged.
Related terminology
- related
- Trading Bot Rate Limiting Latency Smart Order Routing Order Matching Time in Force Partial Fill Operational Security Centralised Exchange versus Decentralised Exchange Colocation
Trading Bot
The API is the venue's published interface; the bot is the client that uses it. When an automated account behaves badly the cause is usually in the client's handling of the interface, not in the interface itself.
Sources
IOSCO · recommendations on operational and technological resilience of crypto trading platforms
https://www.iosco.org/library/pubdocs/pdf/IOSCOPD747.pdf URL verified
Editorial status
Written, not yet reviewed.
