Why broker API limits become incidents
A mishandled broker API limit can cost a small firm $5,000 to $50,000 in staff time, vendor escalation and remediation during a 30-minute incident, before client compensation or lost trading revenue. That is a plausible operational range, not an audited figure. The larger risk is a control path that stops responding during a market spike.
A limit is rarely one simple requests-per-second number. A provider may enforce separate quotas by API key, account, IP address, endpoint, order type or session.
The firm may also have its own limits in an API gateway, service mesh or risk system. If one layer returns HTTP 429 while another keeps sending, queues fill and retries amplify the load.
Map the quota boundaries
Start by recording each provider's documented limits and validating them with the account team. Mark which limits are shared across services and which are per account or endpoint.
Record whether the provider returns a Retry-After header, resets a fixed window, or uses a rolling window or token bucket. Documentation can lag implementation, so treat observed behaviour as evidence, not permission to exceed a published limit.
For each endpoint, capture normal and peak request rates, concurrency, response codes and latency. Separate reads such as balances and instrument metadata from order entry, cancellations and risk checks. A polling loop that is harmless at 09:00 can compete with order traffic during a fast market.
Decide what gets through
Assign traffic classes before designing retries. Order placement, cancellation and risk controls should not sit behind dashboards, historical queries or client refresh traffic.
Define how each class behaves at its local quota and at a provider quota. Broker infrastructure coverage at Trading Technology provides context for the systems and operational constraints around those decisions.
Days 1 to 7: measure and set policy
Use the first week to build an endpoint inventory and baseline. Pull at least 14 days of request logs if available, including a volatile session or scheduled market event.
Log provider, account, endpoint, response code, latency, retry count and request purpose. Avoid logging credentials or full payloads containing personal data.
Typical market ranges vary by provider and contract. These figures are planning assumptions for initial capacity tests, not guaranteed entitlements. Confirm actual limits with each API provider before setting production thresholds.
| API pattern | Typical market range | Design implication |
|---|---|---|
| REST read quota per key or account | 5 to 100 requests per second | Cache stable reference data and cap polling |
| Order submission quota | 1 to 20 orders per second | Reserve capacity for order and risk paths |
| Short burst allowance | 2 to 10 times sustained rate | Do not treat burst capacity as a steady rate |
| Retry-After or recovery delay | 1 to 30 seconds when supplied | Respect the response and avoid synchronized retries |
Translate the inventory into a written policy. Set a local ceiling below the provider quota, commonly 70 to 85 per cent of the documented sustained rate, to leave headroom for shared usage and measurement error. Assign a named owner for each provider connection and an escalation contact for quota changes.
- Document limits by account, endpoint and request class.
- Set per-service budgets and a firm-wide budget for shared credentials.
- Choose which requests can be delayed, cached, coalesced or rejected.
- Define alerts for sustained usage, 429 responses, queue age and retry volume.
Days 8 to 21: implement the control plane
Build one rate-control component for each provider connection, rather than letting every service implement its own interpretation. A token bucket is useful where short bursts are allowed: tokens refill at the sustained rate, while the bucket capacity sets the maximum burst.
A leaky bucket or paced queue gives steadier output when the provider expects a flat rate. Either approach needs a separate concurrency limit if requests can remain in flight for a long time.
Make backoff bounded and safe
On HTTP 429, first honour Retry-After if present. Otherwise use exponential backoff with full jitter, for example a random delay between zero and a ceiling that grows from 250 milliseconds to 8 seconds.
Set a maximum attempt count and a total deadline. A retry that arrives after the business operation is no longer useful should be dropped, not sent because a generic library permits it.
Do not automatically retry every failure. A timeout after order submission leaves the outcome uncertain: the provider may have accepted the order even though the client did not receive the response. Use an idempotency key where the API supports it, or reconcile order state before resubmitting. Treat validation errors and most other 4xx responses as non-retryable. For 5xx responses, use bounded retries and circuit breaking, with separate rules for read and order endpoints.
Protect critical traffic
Use priority queues with explicit capacity reservations. For example, reserve a portion of the local budget for order placement, cancellations and risk actions, then let lower-priority reads use the remainder. The exact split depends on the workload. A starting test might reserve 60 to 80 per cent for trading and safety actions, but measure whether that strands capacity during quiet periods.
Cache instrument metadata and other slow-changing responses. Coalesce identical concurrent reads, and spread scheduled refreshes with jitter so clients do not all poll on the minute. Add queue limits and expiry times. An unbounded queue converts a quota response into delayed, stale work that can arrive after the market condition has changed.
Expose metrics for requests by endpoint and class, granted and denied tokens, 429s, retries, queue depth, oldest queued request, in-flight calls and circuit-breaker state. Alert on rates and trends, not every isolated 429. A useful first trigger is quota use above 80 per cent for five minutes, paired with a sharper alert when rejection rates or queue age rise.
Days 22 to 30: test failure and operate it
Use the final nine days to validate behaviour under controlled load. Test normal traffic, a two-times peak, a provider returning 429 with Retry-After, missing headers, slow responses, timeouts and a brief 5xx burst. Verify that the client respects quotas across multiple services sharing one key. Test a restart too: a process that forgets its local budget can burst immediately after deployment.
Check these outcomes in a staging environment or through a provider-approved test facility:
- Low-priority reads shed load before order and risk traffic.
- Retries spread out, stop at their deadline and do not duplicate orders.
- Queues remain bounded and expired requests are discarded.
- Operators can identify the affected provider, account and endpoint from one dashboard.
- Recovery does not release a backlog faster than the downstream quota permits.
Write a short runbook with the quota owner, provider contact, dashboard links and safe actions. Include when to pause non-critical polling, lower refresh rates or disable a feature. Do not instruct operators to raise limits or replay queued orders without checking the provider's quota and order state.
Review the policy after each provider change, new account connection or material traffic increase. Put quota assumptions under version control and include them in release review. This keeps a limit from becoming an undocumented dependency that only surfaces during an incident.
This week, assign an owner to one provider connection and produce its endpoint-by-endpoint quota inventory.
Frequently Asked Questions
What should a broker API client do after HTTP 429?
Respect the Retry-After header if the provider sends one. Otherwise apply exponential backoff with jitter, a maximum attempt count and an overall deadline. Do not let every client retry at the same instant.
Should order requests be retried automatically?
Only when the outcome is safe to determine. A timeout can occur after the provider accepted an order, so use an idempotency key if supported or reconcile order state before resubmitting.
How much headroom should a broker leave below an API quota?
A practical starting point is to cap local sustained usage at 70 to 85 per cent of the documented limit. Adjust after measuring shared-key traffic, provider behaviour and peak bursts.
Which broker API traffic should receive priority?
Order placement, cancellations and risk controls generally need priority over dashboards, historical queries and routine refreshes. Set explicit budgets so lower-priority reads cannot consume the capacity required for trading and safety actions.
How should a firm test API throttling?
Test normal and peak traffic, 429 responses, Retry-After handling, timeouts, slow responses and provider errors in staging or an approved test facility. Verify bounded queues, safe order reconciliation and controlled recovery without sending a burst of backlog.
Platforms · Software · Providers · Markets