Skip to main content
An auto-order is an exit attached to a swap. When you buy a token, you can include one or more auto-orders that sell automatically once a condition is met — a take-profit, a stop-loss, a trailing stop, a time-based exit, or a dev-sell that fires when the token creator sells. Auto-orders are passed in the auto_orders array of a swap request. Each order is evaluated after the parent trade lands and sells part or all of your position when it triggers.

Fields

All numeric fields are JSON numbers, not strings. priority_fee and processor_tip are denominated per host, exactly as they are on the parent swap — see Fee denomination.

What target_value means

The same target_value field is interpreted differently for each target_type:
To create an automatic dev-sell, set target_type to dev_sell. There is no separate flag — the trigger type is the only thing you set.

Limits

You can attach up to 20 auto-orders to a swap. Any beyond 20 are dropped.

Examples

Take-profit at +50%

Sell the entire position when the price is up 50% from entry:

Stop-loss at -20%

Sell the entire position when the price is down 20% from entry (a negative target_value is a stop-loss):

Dev-sell

Exit when the token creator sells. target_value: 0 triggers on any dev sell; 100 triggers only on a full (whole-position) dev sell:

Attaching auto-orders to a swap

Add the orders to the auto_orders array of a buy. This example takes profit at +50% and also exits if the creator sells: