HK Trading
The Hong Kong Trading API provides access to Hong Kong-listed stocks, ETFs, warrants, and bonds. It includes order management, position tracking, account management, end-customer accounts, IPO subscriptions, FOP stock transfers, house margin, FX rates, and market data capabilities.
Options, multileg orders, and OCO orders are not available in Hong Kong yet. The options, option-underliers and multileg endpoints, and the OCO fields on POST /orders/new, describe their planned behavior as a preview.
Paths
Hong Kong endpoints are unprefixed (for example, /orders/new). The KR and TW APIs share the same APAC base URLs under the /kr and /tw prefixes. Every market authenticates with X-API-KEY, but accounts, orders, positions, transactions, and WebSocket updates are resolved only within the market that owns the path.
Order updates stream over wss://{BASE_URL}/websocket.
Orders
- Use the stock code without leading zeros, as a string (for example,
700, not00700). - Equity orders use whole-share quantities and
execution_instruction: held. Notional and fractional orders are not supported. - Market, limit, stop and stop-limit orders are accepted with
time_in_forceday,iocorgtc. trading_session_idsselects the sessions an order can trade in:1(pre-opening auction),2(continuous trading) and3(closing auction). Omit it to trade in continuous trading only.
GET /equities returns stocks by default. Pass include_security_types (for example, ST,ETF,WT,LB) to include ETFs, warrants, and bonds.
Error Handling
Failed HTTP requests return a JSON body with an error_code and a human-readable error_msg:
{
"error_code": "AccountBalancesPositions_Error",
"error_msg": "insufficient cash to buy"
}
Use error_code for programmatic handling; the wording of error_msg can change.
error_code | HTTP status | Meaning |
|---|---|---|
BasicInput_Error | 400 | A field is missing or invalid, or account_number is missing or not linked to your API key |
DisallowedOrderAction_Error | 400 | The request is valid but not allowed, for example the account is frozen or the order can no longer be modified |
AccountBalancesPositions_Error | 400 | Not enough cash, margin or shares for the order |
Instrument_Error | 400 | Unknown symbol, or a symbol that cannot be traded |
DataRetrieval_Error | 400 | The requested record was not found, for example an unknown order_id |
Permission_Error | 401 / 403 | 401: the X-API-KEY header is missing or invalid. 403: a read-only key was used for a POST or PUT |
Misc_Error | 400 / 500 | 400: the request body is not valid JSON or has a field of the wrong type. 500: an unexpected server error |
AVInternal_Error | 500 | Internal error, for example system too busy. Check the order's status before retrying |
A 502 or 503 means an upstream service or the database is temporarily unavailable; retry later. Order rejections that happen after an order is accepted, for example by the exchange, are not HTTP errors: they arrive as rejected WebSocket updates.
Guides
- Orders Acceptance: trading sessions, order types and when orders are sent to the exchange.
- Risk Limits: order validation, buying power and common rejections.
- WebSocket: connecting to
/websocketand handling order updates.
See Environments & Base URLs for all available endpoints across UAT and Production.
Browse the individual endpoints in the sidebar to see request/response details, parameters, and schemas. Use the server selector on each endpoint page to switch between environments.