Skip to content

Set a stop loss, take profit and trailing stop via API

Which exits you can set on a Hyperliquid or Aster bot through Prow's API, on a draft and a running bot, with curl examples and the limits on each change

By the Prow teamPublished Updated 7 min read

On this page

Through Prow's API you set a bot's stop loss, take profit and trailing exits when you save the draft. After the bot starts, the stop loss, range, investment, leverage and loss limit are fixed, because you signed them. A key can still make a running bot safer: it can set or lower a take profit, lower a trailing take profit, and set or lower a DCA bot's trailing stop. It can never remove or loosen an exit. This guide shows each call as curl, says which exit belongs to which bot, and lists the limits a change has to respect.

The examples use made-up prices. Never copy a price into a real bot: ask Prow for a live example first, as in Hyperliquid API trading bot without writing exchange code.

bash
export PROW_KEY="paste your key here"
export API="https://app.prowdex.com/api/v1"

Which exit goes with which setting?

ExitGrid botDCA bot
Price stop lossslLow below the range for long, slHigh above it for short, both for neutralslPct, percent from the average entry price, beyond the last extra order
Take profittakeProfitPct, percent of the investment, for the whole bottpPct per deal, botTpPct for the whole bot
Several targetsNot availabletpTargets, 2 to 4 of them, each with a pct and a share
Trailing take profittrailingTpPct, needs a take profittrailingTpPct, below tpPct, not together with tpTargets
Trailing stopNone: a grid's stop is fixedtrailingSlPct
Loss limitmaxLossUsd, the bot stops when its loss reaches this many dollarsThe same

A Ladder bot has combo.trailStop, on by default, which you set when you make the draft. A spot grid can follow the price with trailingUp and trailingDown. That moves the grid's range, not a stop. The bot settings reference lists every field with its range. For what each exit does to a bot in plain words, with a worked example in dollars, read Take profit and stop loss for grid and DCA bots.

How do I set a stop loss and take profit on a new bot?

Put them in the draft. A long grid on Hyperliquid with a stop below the range and a whole-bot take profit:

bash
curl -sS -X POST "$API/bots/drafts" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"venue":"hyperliquid","market":"BTC","draft":{"type":"grid","direction":"long","investment":200,"leverage":2,"lower":90000,"upper":100000,"count":20,"slLow":87000,"takeProfitPct":15}}'

Prow checks the draft the way it checks a bot before it starts. A stop on the wrong side of the range comes back as an error in plain words, and nothing is saved. On futures the stop rests on the venue once the bot runs, so it does not depend on Prow being reachable.

To move the stop on a draft, send only what changes:

bash
curl -sS -X PUT "$API/bots/drafts/aaaaaaaa-1111-4111-8111-aaaaaaaaaaaa" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"fields":{"slLow":88000}}'

How do I add a trailing stop?

A trailing stop follows the best price at a set distance in percent. On a DCA bot that is trailingSlPct. It sits under the price for a long deal, so it cannot end a deal by itself: it ends it only after the price retraces by that distance.

bash
curl -sS -X POST "$API/bots/drafts" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"venue":"hyperliquid","market":"ETH","draft":{"type":"dca","direction":"long","investment":100,"leverage":2,"baseOrder":50,"safetyOrder":20,"safetyCount":4,"deviationPct":1.5,"tpPct":2,"slPct":12,"trailingSlPct":3}}'

The same setting works as an MCP tool call, which is how an assistant sends it:

json
{
  "name": "create_bot_draft",
  "arguments": {
    "venue": "hyperliquid",
    "market": "ETH",
    "draft": {
      "type": "dca", "direction": "long", "investment": 100, "leverage": 2,
      "baseOrder": 50, "safetyOrder": 20, "safetyCount": 4, "deviationPct": 1.5,
      "tpPct": 2, "slPct": 12, "trailingSlPct": 3
    }
  }
}

How do I add a trailing take profit?

A trailing take profit waits until the take profit is reached, then closes the bot when its profit falls back a set percent from the peak. It replaces an exit at the target with one that can end below it, which is why a key cannot switch it on for a bot that is already running. Set it in the draft:

bash
curl -sS -X POST "$API/bots/drafts" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"venue":"hyperliquid","market":"BTC","draft":{"type":"grid","direction":"long","investment":200,"leverage":2,"lower":90000,"upper":100000,"count":20,"slLow":87000,"takeProfitPct":15,"trailingTpPct":3}}'

A DCA bot can instead take profit in steps. tpTargets takes 2 to 4 targets, each further from the entry than the one before, with shares that add up to 100:

bash
curl -sS -X POST "$API/bots/drafts" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"venue":"hyperliquid","market":"ETH","draft":{"type":"dca","direction":"long","investment":100,"leverage":2,"baseOrder":50,"safetyOrder":20,"safetyCount":4,"deviationPct":1.5,"tpPct":2,"slPct":12,"tpTargets":[{"pct":1.5,"share":40},{"pct":3,"share":30},{"pct":5,"share":30}]}}'

Each target's share of the base order must still reach the venue's minimum order, or the check answers tp_target_below_min.

What can I change on a bot that is already running?

Only a few settings, and only toward safer. This table is the short version of the change a running bot section of the docs.

SettingA key mayA key may not
takeProfitPct, botTpPctSet one where none is set (1 to 100), or lower itRemove it or raise it
tpPct (DCA, per deal)Lower itRaise it
trailingTpPctLower itSet one where there is none, remove it or raise it
trailingSlPctSet one where none is set, or lower itRemove it or raise it
slLow, slHigh, slPct, range, investment, leverage, maxLossUsdNothing: signed at the startAnything

Send the change to edit_bot. The second example is for a DCA bot, because a grid has no trailing stop:

bash
curl -sS -X POST "$API/bots/aaaaaaaa-1111-4111-8111-aaaaaaaaaaaa/edit" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"fields":{"takeProfitPct":10}}'
bash
curl -sS -X POST "$API/bots/aaaaaaaa-1111-4111-8111-aaaaaaaaaaaa/edit" -H "x-api-key: $PROW_KEY" -H "Content-Type: application/json" \
  -d '{"fields":{"trailingSlPct":3}}'

Three things to know before you rely on it:

  • It is a request. The answer's status is edit_requested. Prow's bots service judges the edit again against the live state within seconds. Call GET /bots/{bot_id} and read bot.last_edit: result says applied or refused, and a refusal carries the reason. Do not assume it worked.
  • Tighter has floors. A bot's take profit (takeProfitPct, botTpPct) is at least 1 percent, a DCA deal's take profit and a trailing exit at least 0.5, and one call lowers a distance by at most half, so a take profit of 15 goes to 7.5 or more. A trailing take profit can be changed once every 10 minutes per bot, and a second try before that answers rate_limited.
  • It can be refused for being too tight. If the profit has already reached the new take profit, or has already fallen back further than the new trailing distance, the bots service refuses, because the edit would close the bot at once.

A bot that is paused answers needs_owner, and so does any loosening. The answer includes a link to the bot in Prow, where you can make that change yourself.

How do I change the stop loss of a running bot?

You cannot, with a key or in the app. The stop loss is part of what you signed. The way to a different stop is to stop the bot, copy it and start the copy. Stopping closes the bot's position at the market price, which can be a loss, so ask whoever owns the account first.

  1. POST /bots/{bot_id}/stop, then poll GET /bots/{bot_id} until status is stopped.
  2. POST /bots/{bot_id}/duplicate with {} copies its last settings into a new draft on the same market.
  3. PUT /bots/drafts/{new_bot_id} with the new stop in fields.
  4. Open confirm_url in Prow and start it.

The stops and changes cookbook has each call. Prow runs one bot per market and account, so the copy answers market_busy until the old bot has stopped.

Where should the stop go?

That is a trading question and the API does not answer it. The check refuses a stop on the wrong side of the range, and it returns an estimated liquidation_price so you can see whether it falls before or after your stop. Past that, pick values you can accept losing. A scripted bot makes the same mistakes as a manual one, only faster.

Prow's fee applies to the trades a bot makes in Prow and is 0% until Dec 31, 2026, then 0.025% per trade, plus the venue's fee. Keys and API calls cost nothing. To start, create a key with Build, pause and stop your bots ticked, then follow the API quick start.

Frequently asked questions

Can I set a trailing stop on Hyperliquid through an API?

Through Prow, on a DCA bot, yes: trailingSlPct on the draft. A grid bot has a fixed stop, but it can have a trailing take profit. For orders you place yourself on Hyperliquid, use Hyperliquid's own API.

Can an API key loosen or remove a stop?

No. A key can only make a running bot safer or leave it as it is. Removing or raising a take profit, or setting a trailing take profit where there is none, answers needs_owner.

Why does edit_bot say edit_requested and not done?

Because the bots service applies the change and may refuse it against the live state. Read bot.last_edit in GET /bots/{bot_id} to see the result.

Do the stops still work if Prow is down?

On futures the stop loss rests on the venue as an order, so it can still fire. The whole-bot take profit and the loss limit are checked by Prow on every price update, so they need Prow to be running. The take profit and stop loss guide explains the difference.

Does this work on Aster too?

Yes. Use "venue":"aster" and the market name that list_markets shows. The settings have the same names.

Sources

Checked December 6, 2026: