The examples on this page use Hyperliquid (
provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().Take Profit & Stop Loss
Attach trigger orders to any order using thetakeProfit and stopLoss fields on placeOrder:
Trigger wires are bundled into the
placeOrder action. The placeTriggerOrder action type only appears for standalone trigger orders (via placeTriggerOrder()).
If
limitPrice is omitted, the trigger executes as a market order. If size is omitted, the trigger covers the entire position and tracks later position-size changes. Set size to a base-asset decimal string for a fixed partial-position trigger.Trigger Order Enums
The SDK exports enums for trigger order types and their lifecycle status:Standalone Trigger Orders
Place standalone TP/SL orders on existing positions, separate from a main order, viaplaceTriggerOrder:
placeTriggerOrder() sends a placeTriggerOrder action type, which creates standalone trigger orders on existing positions.