1
Attach the exits to the entry
stopLoss and takeProfit ride along with Place an
order. Atomic here means the exits are placed with the
order as one unit or not at all — there is no state where the entry landed and the protection
silently did not.price and the
tick offset from the entry.Read warnings on the response even when it succeeds: it reports non-fatal degradations on an
otherwise accepted request, and they are yours to surface.2
Set or replace the exits after entry
Set position exits sets or replaces the stop and
target on a position you already hold. The pair is applied as one unit, exactly as at entry.
clientOrderId is required here — the route answers 400 without one. Key it on the
instrument and the levels, as above, so a retry of the same intent dedups instead of fighting
itself.3
Move one leg and leave the other alone
Each level is three-state. A number sets it, Sending
null removes it, and omitting it leaves the
resting leg untouched. Tightening a stop without touching the target is one field:"takeProfit": null in that body would have removed the target instead.4
Read what is actually resting
List position exits returns the exits recorded
around the account’s positions, with each entry’s legs and their states, at the account
revision they were read at.If you already hold a snapshot you do not need this route: the same
brackets array is in
the snapshot, at the revision that names it.
This read takes no venue reading and allocates no revision.What the states mean
A bracket is the protection around one position. Itslegs are the individual orders.
Two details that catch clients out:
- The sibling. The stop and the target are cancel-linked siblings at the venue, paired by
ocoGroup. The leg that does not fill is cancelled when its sibling does — you do not cancel it yourself, and you should not treat its disappearance as a fault. - Re-parenting. A
pre_armedleg hangs off the entry order throughparentOrderId. Once that entry fills, the leg protects the position andparentOrderIdis null. Do not key a leg by its parent order.
When the engine moves the stop for you
A breakeven move or a trailing stop is run by the engine, not by you. List server-managed stops shows those instances, thephase each
has reached, and — where one is paused — the pauseReason explaining why nothing is moving the
stop. A pause is honest degradation, not failure: the venue-placed stop is still resting and still
protecting the position.
Both brackets and managedExits are account state, so an account
stream frame carries them at the same revision as
the positions and orders. There is no separate channel to subscribe to.
A risk-locked account answers 423 to both the order route and the exits route. That is a state
to display, not an error to retry.
Where to go deeper
- Place your first order — the five-step path from a key to a filled order.
- Save and apply exit plans — ladders, breakeven and trailing, applied by reference instead of retyped.
- Set risk controls — what produces the
423, and how it clears. - Idempotency — one intent, one id, forever.