Skip to main content

Take-Profit / Stop-Loss (TP/SL)

Atlas supports automatic position closing based on price targets. Set a take-profit to lock in gains or a stop-loss to limit losses.

How It Works

  1. Set TP/SL prices when opening a position, or add them to an existing position
  2. The app creates or updates the on-chain trigger/order state for that position
  3. Atlas monitors oracle prices in real-time
  4. When the price crosses your target, a close transaction is triggered
  5. Your position is closed and PnL is settled

Setting TP/SL

When Opening a Position

Include take_profit_price and/or stop_loss_price in your order. Both are optional — you can set one, both, or neither.

On an Existing Position

Use the Set TP/SL button on your active position. You can set one, both, or clear them at any time.

Setting or clearing TP/SL may require a wallet signature because Atlas keeps position-related actions visible and cancellable through on-chain order/trigger state.

Trigger Conditions

DirectionTake-ProfitStop-Loss
LongPrice rises to ≥ TP pricePrice drops to ≤ SL price
ShortPrice drops to ≤ TP pricePrice rises to ≥ SL price

API Endpoints

MethodEndpointDescription
POST/position/tpslSet or update TP/SL on an active position
DELETE/position/tpslClear TP/SL from a position

You can also set TP/SL when opening a position by including take_profit_price and/or stop_loss_price in the open order request.

How It's Executed

When your TP/SL condition is triggered:

  1. The Position Monitor Service detects the price crossing your target
  2. A CloseTPSL transaction is automatically built and submitted on-chain
  3. The on-chain validator verifies the oracle price and calculates your final PnL
  4. Your payout (collateral + PnL - borrow fees) is sent to your wallet

Trigger execution itself does not need a fresh wallet signature — the protocol operator executes the close on your behalf, with on-chain guarantees that you receive the correct payout. Creating, changing, or clearing the TP/SL trigger can still require your signature.

Important Notes

  • Execution price: Your position closes at the oracle price when processed, which may differ slightly from your target price
  • Borrow fees: Normal borrow fees still apply to the position until it's actually closed
  • Order visibility: TP/SL setup, clear, and triggered closes can appear in Orders or History while the related transaction is being indexed or processed