Skip to main content

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.

Coming soon

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, not 00700).
  • 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_force day, ioc or gtc.
  • trading_session_ids selects the sessions an order can trade in: 1 (pre-opening auction), 2 (continuous trading) and 3 (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_codeHTTP statusMeaning
BasicInput_Error400A field is missing or invalid, or account_number is missing or not linked to your API key
DisallowedOrderAction_Error400The request is valid but not allowed, for example the account is frozen or the order can no longer be modified
AccountBalancesPositions_Error400Not enough cash, margin or shares for the order
Instrument_Error400Unknown symbol, or a symbol that cannot be traded
DataRetrieval_Error400The requested record was not found, for example an unknown order_id
Permission_Error401 / 403401: the X-API-KEY header is missing or invalid. 403: a read-only key was used for a POST or PUT
Misc_Error400 / 500400: the request body is not valid JSON or has a field of the wrong type. 500: an unexpected server error
AVInternal_Error500Internal 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 /websocket and 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.