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 × pricefromcash_availableuntil it fills or ends.priceis 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 withAccountBalancesPositions_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
| Mode | Set with | Effect |
|---|---|---|
| Frozen account | POST /accounts/mode/freeze | New orders and modifies are rejected (account is in frozen mode). Cancels still work. |
| Closing-only account | POST /accounts/mode/closing-only | Only position_effect: close orders are accepted (account is in close-only mode). |
| Inactive end customer | POST /accounts/ec/status | New orders and modifies for that end customer are rejected (client is in frozen mode). |
| Closing-only end customer | POST /accounts/ec/status | Only 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_code | Message | Cause |
|---|---|---|
BasicInput_Error | invalid trading session combination (must be one of: '1', '2', '3', '1,2', '2,3', or '1,2,3') | Invalid trading_session_ids |
BasicInput_Error | order quantity exceeds maximum allowable (999,999) | Quantity above the maximum |
DisallowedOrderAction_Error | not_held execution_instruction currently not supported | execution_instruction: not_held |
AccountBalancesPositions_Error | insufficient cash to buy | Not enough cash_available in a cash account |
AccountBalancesPositions_Error | insufficient margin | Not enough excess margin in a margin account |
AccountBalancesPositions_Error | sell to close quantity exceeds long position | Selling more shares than you hold |
Instrument_Error | security not found | Unknown symbol. Use the code without leading zeros, for example 700 |
DisallowedOrderAction_Error | IOC order cannot be canceled or modified | Canceling or modifying an IOC order |
DisallowedOrderAction_Error | order in terminal state cannot be canceled or modified | The order is already filled, canceled, replaced or rejected |
See HK Trading for how error codes map to HTTP status codes.