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.
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.