Narrow Down Issues in 4 Steps
Verify layer-by-layer to avoid blind retries on invalid credentials that trigger rate limits.
Status & Business Code Check
Differentiate Auth vs Rate Limit
Check the HTTP status code and ret in the response body first. 401 indicates invalid or missing Token; 429/605 indicates rate limits. Never retry infinitely on 401.
Credential Integrity
Verify Token & Environment Variables
Verify that the Token loaded in code is non-empty with no leading/trailing spaces or newlines. Ensure environment variables are loaded on both local and production servers.
API & Market Routing
Confirm Endpoint & Symbol Format
Stock data requires quote-stock-b-api (e.g., 700.HK, AAPL.US); Forex & precious metals require quote-b-api (e.g., EURUSD). Mismatched endpoints return errors.
Trading Hours & WS Heartbeats
Rule Out Market Closure & Timeouts
Exchanges produce no tick push during market closures and midday breaks. WebSocket connections require regular heartbeat pings (cmd_id: 22000) and re-subscriptions upon reconnect.
Troubleshooting Guides
In-depth root cause analysis, production investigation steps, and executable code across technical dimensions.
Market Data API: 401 & 429 Troubleshooting
Systematically diagnose 401 authentication failures and 429 rate limits by inspecting HTTP status, business return codes, token scope, and QPS.
Key Focus:
- 4-level diagnosis: HTTP status → business code → Token → rate limits
- Python Exponential Backoff retry implementation with random jitter
- Batch symbol querying (symbol_list) to cut 80% of request frequency
WebSocket Connected but No Data
Troubleshoot silent WebSocket connections across five checkpoints: subscription payload, symbol format, endpoint URL, trading hours, and heartbeats.
Key Focus:
- Verify subscription message format (cmd_id: 22004) and server ack
- Check exchange trading hours, daylight saving, and lunch closures
- Minimal 5-line connectivity verification using 24/5 forex EURUSD
US Stock Timestamps, DST & Trading Hours
Correctly process US equity timestamps by storing UTC, converting via America/New_York for Daylight Saving Time, and aligning daily K-line dates.
Key Focus:
- Auto-detection and normalization between 13-digit ms and 10-digit sec timestamps
- US stock market open comparison between Summer Time (EDT) and Winter Time (EST)
- Prevent midnight boundary issues from splitting trading sessions into two days
Common Error Codes & Phenomena
Quickly find causes and recommended actions when encountering errors or anomalies.
| Status / Error Code | Phenomenon | Likely Cause | Investigation & Fix | Guide |
|---|---|---|---|---|
ret: 401 / HTTP 401 | token invalid (Authentication Failure) | Token missing, malformed, expired, or contains whitespace/newlines | Print token length and characters; verify status and market access in the AllTick console | Auth Guide |
ret: 429 / 605 | Too Many Requests (Rate Limit Exceeded) | Exceeded per-second or per-minute rate limit, or multiple processes share the same token | Implement Exponential Backoff with jitter; batch multiple single queries into symbol_list requests | Rate Limit Guide |
ret: 600 | code invalid (Invalid Symbol) | Typo in symbol ticker, missing suffix, or calling wrong endpoint (e.g., stock ticker via forex endpoint) | Verify endpoint routing: stocks use quote-stock-b-api, forex uses quote-b-api; check symbol list | Symbol Format |
ret: 603 / 604 | level not enough / unauthorized | Requested symbol count or candlestick limit exceeds plan quota, or token lacks market permissions | Check plan batch query limits; confirm market permissions in the official dashboard | Quota Limits |
ret: 606 | Connection will be closed | Concurrent WebSocket connections exceed plan quota, or multiple messages sent within 1-3 seconds | Keep concurrent connections within quota; add at least 1-second delay between requests on a socket | WebSocket Limits |
ret: 400 / 402 | param invalid / query invalid | Missing trace ID in payload, or GET query parameter is not URL-encoded JSON | Ensure query is valid JSON and URL-encoded; confirm complete trace and data payload structure | Param Specs |
WS Connected But No Data | No Push Data | Subscription packet (cmd_id: 22004) not sent, symbol in closed market session, or missing ack | Check subscription payload and seq_id ack; verify connectivity on weekdays using EURUSD | WS Guide |
Timestamp Parsed as 1970 | Timestamp Parsing Error | AllTick tick_time is a 13-digit millisecond timestamp parsed incorrectly as a 10-digit second timestamp | Check timestamp length: if > 10^12 divide by 1000 to convert to seconds; store in UTC | Timestamp Guide |
Verify Connectivity in 5 Lines of Code
Run this probe script locally or on your server to verify Token validity and network latency without application noise.
# AllTick Connectivity Self-Check
import os
import requests
API_TOKEN = os.getenv("ALLTICK_API_TOKEN", "YOUR_TOKEN_HERE")
BASE_URL = "https://quote.alltick.co/quote-stock-b-api/trade-tick"
params = {
"token": API_TOKEN,
"query": '{"trace":"diagnose-1","data":{"symbol_list":[{"code":"700.HK"}]}}'
}
response = requests.get(BASE_URL, params=params, timeout=5)
print(f"HTTP Status: {response.status_code}")
print(f"Response Body: {response.text}"){
"ret": 200,
"msg": "ok",
"trace": "diagnose-1",
"data": {
"tick_list": [
{
"code": "700.HK",
"price": "398.20",
"tick_time": "1712648400000"
}
]
}
}Still Unresolved After Self-Check?
If issues persist after following the steps above, please contact the AllTick technical support team with the desensitized logs listed below. Our engineers will assist promptly:
- Complete endpoint URL (with Token masked)
- Full HTTP status code and server JSON response
- Exact UTC timestamp and duration of the anomaly
- Programming language, libraries, and exact versions used
Ready to integrate stable market data in production?
AllTick provides millisecond-level data streams for US/HK equities, forex, and commodities, backed by 99.95% SLA and professional support.