Rate Limit
The platform enforces quotas on API calls to ensure stability and fairness.
Best Practices
- Batch requests — Combine multiple symbols into one call. For example,
code_listsupports up to 400 symbols. - Cache static data — Trading calendars, plate lists, and other infrequently changing data should be cached locally.
- Stagger calls — Avoid sending bursts of requests during market open.
- Exponential backoff — When encountering rate-limit errors, retry with exponential backoff.
Backoff Strategy
When receiving a rate-limit response, use exponential backoff:
python
import time
import requests
def safe_request(url, headers, data, max_retries=3):
for i in range(max_retries):
resp = requests.post(url, headers=headers, json=data)
if resp.status_code == 429:
wait = int(resp.headers.get('Retry-After', 2 ** i))
time.sleep(wait)
continue
return resp
raise Exception("max retries exceeded")See Also
- Getting Started - Learn the API Host, choose an authentication method, and make your first request.