Trigger Keepers

Our /trigger API endpoint returns the list of active trigger orders in an AMM. Trigger Orders are valid under the following conditions:

if (side == Side.LONG) {
   invalid = takeProfit ? markPrice < trigger : markPrice > trigger;
} else {
   invalid = takeProfit ? markPrice > trigger : markPrice < trigger;
}

For the convenience of keepers, we have an extrnal function in solidity to check if a trigger order is valid

isTriggerOrderValid(uint256 id)

Where id is the trigger order id as returned by our API.

Our example repo visualizes these conditions better. Once a trigger order is found, you can call the following function to execute the trigger order:

closePositionKeeper(uint256 id)

Where id is the ID of the trigger order.

You don't need to be whitelisted to run this function, and you will earn a reward of 5 bps for executing a trigger order.

Last updated