Skip to content
AllTick
Market Data API Diagnostics & Troubleshooting Center

Market Data API Troubleshooting

A developer guide for diagnosing Market Data API issues. Troubleshooting checklists and test scripts for 401 Unauthorized, 429 Rate Limit, WebSocket missing push data, and UTC/US timezone conversions to restore data feeds quickly.

Standard Workflow

Narrow Down Issues in 4 Steps

Verify layer-by-layer to avoid blind retries on invalid credentials that trigger rate limits.

01

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.

02

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.

03

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.

04

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.

Core Guides

Troubleshooting Guides

In-depth root cause analysis, production investigation steps, and executable code across technical dimensions.

Total 3 dedicated troubleshooting guides
HTTP 401 / 429

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
Updated Full Steps
WebSocket Streaming

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
Updated Full Steps
UTC & US Eastern Time

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
Updated Full Steps
Cheat Sheet

Common Error Codes & Phenomena

Quickly find causes and recommended actions when encountering errors or anomalies.

Status / Error CodePhenomenonLikely CauseInvestigation & FixGuide
ret: 401 / HTTP 401token invalid (Authentication Failure)Token missing, malformed, expired, or contains whitespace/newlinesPrint token length and characters; verify status and market access in the AllTick consoleAuth Guide
ret: 429 / 605Too Many Requests (Rate Limit Exceeded)Exceeded per-second or per-minute rate limit, or multiple processes share the same tokenImplement Exponential Backoff with jitter; batch multiple single queries into symbol_list requestsRate Limit Guide
ret: 600code 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 listSymbol Format
ret: 603 / 604level not enough / unauthorizedRequested symbol count or candlestick limit exceeds plan quota, or token lacks market permissionsCheck plan batch query limits; confirm market permissions in the official dashboardQuota Limits
ret: 606Connection will be closedConcurrent WebSocket connections exceed plan quota, or multiple messages sent within 1-3 secondsKeep concurrent connections within quota; add at least 1-second delay between requests on a socketWebSocket Limits
ret: 400 / 402param invalid / query invalidMissing trace ID in payload, or GET query parameter is not URL-encoded JSONEnsure query is valid JSON and URL-encoded; confirm complete trace and data payload structureParam Specs
WS Connected But No DataNo Push DataSubscription packet (cmd_id: 22004) not sent, symbol in closed market session, or missing ackCheck subscription payload and seq_id ack; verify connectivity on weekdays using EURUSDWS Guide
Timestamp Parsed as 1970Timestamp Parsing ErrorAllTick tick_time is a 13-digit millisecond timestamp parsed incorrectly as a 10-digit second timestampCheck timestamp length: if > 10^12 divide by 1000 to convert to seconds; store in UTCTimestamp Guide
Self-Check Script

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.

test_connection.py
# 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}")
Expected Response (HTTP 200 OK)
JSON
{
  "ret": 200,
  "msg": "ok",
  "trace": "diagnose-1",
  "data": {
    "tick_list": [
      {
        "code": "700.HK",
        "price": "398.20",
        "tick_time": "1712648400000"
      }
    ]
  }
}
Tip: If you receive ret: 401, regenerate your Token in the AllTick console; if ret: 429, check your account request rate quota.
Official Technical Support

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.