Submit Order
submit_orderSubmit buy/sell orders to US/HK exchanges with a dry-run preview that requires explicit user confirmation before any order is placed.
Instructions
Submit a buy/sell order. DRY RUN unless execute is the confirmation_code from its own dry run: call once without execute, show the preview to the user, then re-call quoting the code only after they explicitly confirm.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| _jq | No | Optional jq filter (jaq syntax) applied to this tool's JSON response before it is returned; it never changes the upstream request. One output is returned as-is, several as a JSON array, none as []. Module imports and the `env`/`debug`/`stderr` builtins are unavailable. Example: .data | map({symbol}). Omit for the full response. | |
| side | Yes | Buy or Sell | |
| remark | No | Order remark (max 255 characters) | |
| symbol | Yes | Security symbol, e.g. "700.HK". Use the canonical form — a padded code like "00700.HK" returns an empty record, not an error. | |
| execute | No | The `confirmation_code` from this order's dry run. WITHOUT IT NOTHING IS SENT. Omitted (the default) makes this a DRY RUN: the request is validated and echoed back with a three-digit `confirmation_code`, and nothing reaches the exchange. Required protocol: call once without `execute`, show the returned preview to the user, and call again quoting the code only after the user has explicitly confirmed that exact order. The code is single use, expires in 10 minutes, and applies only to this exact order — change any field and it stops working. Never quote it back on your own initiative, and never in the same turn the user first asks. | |
| order_type | Yes | Order type (HK supports all; US supports LO/MO/LIT/MIT/TSLPAMT/TSLPPCT only): - LO (Limit Order): requires submitted_price - ELO (Enhanced Limit Order, HK only): requires submitted_price - MO (Market Order): no price required - AO (At-auction Order, HK only): executed at auction price, no price required - ALO (At-auction Limit Order, HK only): requires submitted_price - ODD (Odd Lots Order, HK only): requires submitted_price, for non-standard lot sizes - LIT (Limit If Touched): requires submitted_price and trigger_price; activates when market price touches trigger_price - MIT (Market If Touched): requires trigger_price only; executes at market when trigger_price is touched - TSLPAMT (Trailing Limit If Touched by Amount): requires trailing_amount and limit_offset; trailing stop by fixed amount - TSLPPCT (Trailing Limit If Touched by Percent): requires trailing_percent (0-1) and limit_offset; trailing stop by percentage - SLO (Special Limit Order, HK only): requires submitted_price; cannot be replaced after submission | |
| expire_date | No | Expiry date (yyyy-mm-dd). Required when time_in_force is GTD | |
| outside_rth | No | Outside regular trading hours: "RTH_ONLY" (regular trading hours only), "ANY_TIME" (any time including pre/post market), "OVERNIGHT" (overnight session, US only), "OPTION_PRE_MARKET" (US option pre-market session) | |
| limit_offset | No | Limit offset from the trailing stop price. Required for: TSLPAMT, TSLPPCT | |
| time_in_force | Yes | Order validity: "Day" (Day Order, expires end of session), "GTC" (Good Til Canceled), "GTD" (Good Til Date, requires expire_date) | |
| trigger_price | No | Trigger (activation) price. Required for: LIT, MIT, TSLPAMT, TSLPPCT | |
| submitted_price | No | Limit price. Required for: LO, ELO, ALO, ODD, LIT, SLO | |
| trailing_amount | No | Trailing amount (absolute price distance). Required for TSLPAMT | |
| trailing_percent | No | Trailing percent as decimal (e.g. 0.05 = 5%). Required for TSLPPCT | |
| client_request_id | No | Idempotency key, unique per intended order (e.g. a UUID). When two requests carry the same value the exchange places one order and returns the original `order_id` for the second, so a retry after a timeout or a dropped connection cannot double-fill. Set it whenever you may retry; generate a NEW value for a genuinely new order. | |
| submitted_quantity | Yes | Order quantity (number of shares) | |
| attached_order_type | No | Attach a take-profit / stop-loss leg to this order: "PROFIT_TAKER" (take-profit only), "STOP_LOSS" (stop-loss only) or "BRACKET" (both). Omit for a plain order; every other attached_* field is ignored without it. | |
| attached_expire_time | No | Expiry of the attached leg as a unix timestamp in seconds (e.g. "1767139200"). Required when attached_time_in_force is GTD. | |
| attached_outside_rth | No | Outside-RTH setting of the triggered leg: "RTH_ONLY" / "ANY_TIME" / "OVERNIGHT" / "OPTION_PRE_MARKET". | |
| attached_time_in_force | No | Time-in-force of the attached leg: "Day" / "GTC" / "GTD". Defaults to the parent order's setting when omitted. | |
| attached_stop_loss_price | No | Stop-loss trigger price. Required for STOP_LOSS and BRACKET. | |
| attached_profit_taker_price | No | Take-profit trigger price. Required for PROFIT_TAKER and BRACKET. | |
| attached_activate_order_type | No | Order type the attached leg is submitted as once triggered, e.g. "LO" (then set the matching attached_*_submit_price) or "MO". | |
| attached_stop_loss_submit_price | No | Limit price of the stop-loss leg, for an LO attached_activate_order_type. | |
| attached_profit_taker_submit_price | No | Limit price of the take-profit leg, for an LO attached_activate_order_type. |