Skip to main content

Monaco Protocol SDK v0.7.9

Parent TP/SL at Order Placement

You can now attach take-profit and stop-loss brackets directly when placing a limit or market order. Previously, TP/SL required a separate createConditionalOrder call after the order was open. With parent TP/SL, the legs are submitted atomically with the entry order and the matching engine owns their full lifecycle.

Attaching brackets on placement

Pass takeProfit and/or stopLoss in the options of placeLimitOrder or placeMarketOrder. Both are margin-only and cannot be combined with reduceOnly: true.
The same options are available on placeMarketOrder.

Leg shape

The leg has no quantity field — it inherits the parent order’s quantity.

Lifecycle

If the parent fills immediately, the attached TP/SL legs move directly to ACTIVE. If the parent rests on the book, the legs start as PENDING_PARENT and activate once the parent fill creates or extends a position. OCO behaviour: when one leg triggers, the matching engine automatically cancels the sibling. Cancelling the unfilled parent order also cancels any PENDING_PARENT children.

New ConditionalOrder fields

listConditionalOrders responses now include:

WebSocket changes

The conditional_order_update event gains matching fields and two new reason values:
New reason values:
  • activated — PENDING_PARENT leg became ACTIVE after the parent filled
  • parent_cancelled — parent order was cancelled before filling, leg was purged
  • oco_cancelled — sibling leg triggered first, this leg was cancelled by OCO

Deprecated: standalone createConditionalOrder

sdk.trading.createConditionalOrder is deprecated for TP/SL use. New integrations should use parent TP/SL (this release) or sdk.positions.attachPositionTpSl for existing positions. The method remains available but will be removed in a future release.

Migration

No breaking changes. All new fields are additive. If you use createConditionalOrder today and want to migrate to parent TP/SL:

Upgrade