Skip to content

Conditional orders and trigger retries

These interfaces cover eligible HK-equity and futures conditional orders, retry preferences and retry history. Live backend behavior remains UNVERIFIED; offline tests do not establish fills or actual backend retries.

Explicit initial.pdt_protection=true is rejected; omission or false uses the disabled value. The ordinary PlaceOrder PDT contract remains unchanged.

Activation and permissions

--enable-conditional-orders is disabled by default. Enable it explicitly for the new order entry point and retry-setting writes. Writes still require trade:real and the relevant account, instrument and session checks. Configuration uses enable_conditional_orders = true in TOML or <enable_conditional_orders>true</enable_conditional_orders> in XML. Enabling the flag does not submit orders or change preferences.

Existing order groups continue to require --enable-group-orders. Both flags must be enabled before eligible group legs read and apply retry preferences. Enabling order groups alone does not activate the new retry behavior.

Settings

API CLI REST POST Permission
GetConditionOrderRetrySettings condition-order-retry-settings /api/condition-order-retry-settings acc:read
SetConditionOrderRetrySettings set-condition-order-retry-settings /api/set-condition-order-retry-settings trade:real

Reads require --extended-data-reads, enabled by default. Initial writes additionally require --extended-data-writes, also enabled by default. Neither replaces the separate conditional-order flag.

Requests include extension_version: 1. Writes also require a nonempty intent_key and items, each explicitly specifying market, enable and retry_count. This market enumeration uses 1 for HK and 5 for futures. Editable values come from available_markets; do not reuse market codes from unrelated APIs. Retry counts range from 1 to 5.

The CLI accepts repeatable --item MARKET:ENABLE:COUNT options, such as --item 1:false:3; REST and MCP use a typed items array. MCP tool names are futu_get_condition_order_retry_settings and futu_set_condition_order_retry_settings.

The four MCP tools on this page require --opend-rest-url and preserve the authenticated caller through REST; there is no raw TCP fallback. A per-call api_key takes precedence over HTTP Bearer, then the startup identity; the forwarding key must identify that same caller. Settings writes require configured API-key authentication and do not support anonymous mode.

Writes update the supplied markets and retain other markets. Settings belong to the logged-in user; account-restricted keys cannot change them. A missing or out-of-range stored count normalizes to 1. A market without a setting does not enable retries. raw_items retain optional fields; effective_items contain normalized values, with the last entry winning for duplicate markets. parse_state is no_item, missing, empty, valid or malformed. Results preserve raw configuration, effective values and parse state; missing configuration is distinct from a failed read.

A successful settings read returns settings. For a settings write, ret_type=0 means an operation receipt was obtained. Inspect receipt.ack_state, readback status and comparison. Unknown outcomes or mismatched readback never trigger another upload. Reusing the same intent and content retrieves the original receipt without a second settings write.

Orders and history

API CLI REST POST MCP
PlaceConditionalOrder place-conditional-order /api/trd/place-conditional-order futu_place_conditional_order
GetConditionOrderRetryHistory condition-order-retry-history /api/trd/condition-order-retry-history futu_get_condition_order_retry_history

PlaceConditionalOrder requests include header, extension_version: 1 and exactly one of initial or confirm. initial supplies idempotency_key and one order, with optional asset_category. confirm uses a previously returned confirmation_id and allowed selections; a fabricated confirmation cannot replace initial submission.

The typed order node includes account, client order identity, code, security market, side, order type, quantity/amount, price and conditions. Quantities and prices are decimal strings. children must be empty; children_relation and brother_relation must both be 0. PlaceConditionalOrder accepts one eligible HK-equity or futures conditional order, without children or order relations. It uses an explicit idempotency key and retains confirmation-required, rejected and unknown states. Retry counts come from enabled settings for the current user and market, with account, authoritative instrument type and order-type checks.

Eligible legs of PlaceOrderGroup follow the same retry rules. Modifications do not reapply current retry settings to an existing order. The original PlaceOrder entry point retains its existing protocol and does not read these retry preferences.

Backend retries after a failed condition trigger are distinct from client order resubmission. Timeouts, disconnects and unknown outcomes never trigger automatic client resubmission. Use the existing receipt and order queries to reconcile the outcome.

GetConditionOrderRetryHistory (CLI condition-order-retry-history, REST POST /api/trd/condition-order-retry-history) reads retry records for an order owned by the selected account. It requires acc:read and extended data reads, enabled by default. Results preserve log identity, operation and step types, source, result and raw microsecond timestamps. Only completed: true explicitly establishes completeness; missing or false does not mean all history was returned.

History requests require header, order_id_ex and extension_version: 1. If local query metadata for that order is missing, supply both exchange and security_type; the server still queries and verifies account ownership. These fields do not replace ownership validation. Response log_list[].create_time retains the integer microsecond value.