Skip to main content

HK Risk Limits

Every Hong Kong order is checked by Atomic Vaults when you submit it. Orders that fail a check are rejected synchronously with an HTTP 400 and an error_code. The exchange applies its own rules afterwards; a rejection there arrives as a rejected WebSocket update.

Checks Applied by Atomic Vaults​

Buying power​

  • Cash accounts. A buy reserves quantity × price from cash_available until it fills or ends. price is the limit price for limit and stop-limit orders, the ask × 1.05 for market orders, and the higher of the ask and the stop price × 1.05 for stop orders. A buy that needs more than the available cash is rejected with AccountBalancesPositions_Error (insufficient cash to buy).
  • Margin accounts. The same amount is checked against excess margin. A buy that needs more is rejected with AccountBalancesPositions_Error (insufficient margin). Orders that close a position (position_effect: close) are not checked.

Positions​

A sell to close cannot exceed your long position, and a buy to close cannot exceed your short position.

Maximum order quantity​

999,999 shares per order.

Price format​

Prices must be positive, with at most 2 decimal places for prices of HKD 1 or more and at most 4 decimal places below HKD 1. Atomic Vaults does not check the HKEX spread table; see Exchange Rules.

Duplicate order IDs​

Every order_id and replacement_order_id must be unique. A repeated ID is rejected with BasicInput_Error (received duplicate order_id (must be unique)). If a request times out, check GET /orders/status before retrying with the same ID.

Account and end-customer modes​

ModeSet withEffect
Frozen accountPOST /accounts/mode/freezeNew orders and modifies are rejected (account is in frozen mode). Cancels still work.
Closing-only accountPOST /accounts/mode/closing-onlyOnly position_effect: close orders are accepted (account is in close-only mode).
Inactive end customerPOST /accounts/ec/statusNew orders and modifies for that end customer are rejected (client is in frozen mode).
Closing-only end customerPOST /accounts/ec/statusOnly position_effect: close orders for that end customer are accepted (client is in close-only mode).

Per-account limits​

Atomic Vaults can configure a daily notional limit and liquidity (average daily volume) limits for your account. They are agreed during onboarding.

Exchange Rules​

These are enforced by the exchange or broker, not by Atomic Vaults. Orders that break them are accepted by the API and then rejected, and you receive a rejected WebSocket update with the reason in text.

  • Spread table. Limit prices must be on the HKEX spread (tick size) for the price level.
  • Board lots. Each stock trades in its own board lot size.
  • Price limits. HKEX price-control rules apply in auctions and continuous trading.

Common Rejections​

error_codeMessageCause
BasicInput_Errorinvalid trading session combination (must be one of: '1', '2', '3', '1,2', '2,3', or '1,2,3')Invalid trading_session_ids
BasicInput_Errororder quantity exceeds maximum allowable (999,999)Quantity above the maximum
DisallowedOrderAction_Errornot_held execution_instruction currently not supportedexecution_instruction: not_held
AccountBalancesPositions_Errorinsufficient cash to buyNot enough cash_available in a cash account
AccountBalancesPositions_Errorinsufficient marginNot enough excess margin in a margin account
AccountBalancesPositions_Errorsell to close quantity exceeds long positionSelling more shares than you hold
Instrument_Errorsecurity not foundUnknown symbol. Use the code without leading zeros, for example 700
DisallowedOrderAction_ErrorIOC order cannot be canceled or modifiedCanceling or modifying an IOC order
DisallowedOrderAction_Errororder in terminal state cannot be canceled or modifiedThe order is already filled, canceled, replaced or rejected

See HK Trading for how error codes map to HTTP status codes.