binance_place_otoco_order
Place an entry order that arms a take-profit/stop-loss bracket once filled, automating a full Binance OTOCO bracket in one request.
Instructions
Place a REAL entry that arms a take-profit/stop pair when it fills. Real money.
Calls POST /api/v3/orderList/otoco (SIGNED, IP weight 1, unfilled-order count 3).
The working leg (LIMIT or LIMIT_MAKER) rests on the book; once it is fully
filled, the two pending legs go on as an OCO pair, so the first of them to
trigger cancels the other. Cancelling any leg kills the whole list.
Kill-switch. Refused with Error: … trading is disabled … unless the server runs
with BINANCE_ALLOW_TRADING=1.
There is no dry-run for a list; binance_test_order validates one order at a time.
Enforced locally before anything is signed (S2 L3571-L3579):
working_type=LIMIT→working_time_in_force;per pending leg — LIMIT_MAKER → price; STOP_LOSS / TAKE_PROFIT → stop price and/or trailing delta; STOP_LOSS_LIMIT / TAKE_PROFIT_LIMIT → price, time-in-force, and stop price and/or trailing delta;
when both pending legs are given, the OCO pairing and the price ordering (
pending_aboveprice >pending_belowprice). The last traded price is unknown to this server, so only the relationship between the prices you pass is checked; Binance applies the fullabove > last traded price > belowrule at trigger time.
Binance marks pending_below_type optional; a list without it is really an OTO, so
pass both pending legs unless you mean to place an OTO.
When to Use:
The full bracket in one request: entry, target and stop, with nothing armed until the entry fills.
When NOT to Use:
When you already hold the position — the bracket alone is
binance_place_oco_order.For entry plus a single follow-up —
binance_place_oto_order.
Returns:
A confirmation echoing orderListId, contingencyType, listStatusType, listOrderStatus,
listClientOrderId and a ### Legs table of all three legs exactly as Binance reported
them (the pending pair shows as PENDING_NEW until the working leg fills).
Examples: params = {"symbol": "BTCUSDT", "working_type": "LIMIT", "working_side": "BUY", "working_price": "60000.00", "working_quantity": "0.001", "working_time_in_force": "GTC", "pending_side": "SELL", "pending_quantity": "0.001", "pending_above_type": "LIMIT_MAKER", "pending_above_price": "66000.00", "pending_below_type": "STOP_LOSS_LIMIT", "pending_below_price": "57000.00", "pending_below_stop_price": "57500.00", "pending_below_time_in_force": "GTC", "list_client_order_id": "full-bracket-001"}
Error Handling:
Error: … trading is disabled …→ the kill-switch is off; nothing was sent.-2010 / -1013 / -1111 are balance, filter and precision failures on any leg.
-2021 means a LIMIT_MAKER leg would have taken liquidity immediately.
A 5xx or a timeout means the execution status is UNKNOWN — query with
binance_get_order_listbefore retrying.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |