perpilot:~/docs/keepers
Keepers
Run rules and liquidations, get paid.
A keeper is any address that calls two functions:
vault.run(ruleId)on a rule whose condition holds. The vault checks everything again and pays the caller the keeper fee (0.01% of the size traded) in USDC.engine.liquidate(vault, market)on a position whose value (margin + result − funding − closing fee) is under its maintenance margin. The engine pays the caller the liquidation fee (0.5% of the size, out of the margin); the rest of the margin goes to the pool.
What to watch
Rules are public (activeRules, getRule on each vault, or GET /api/rules/open). Positions are public (engine.positionInfo(vault, market), or isLiquidatable). Prices are in the oracle (oracle.price(market)): a price older than the market's maximum age is refused, and nothing can run on it.
Simulate before you send: a call whose condition does not hold reverts and costs only gas. The Perpilot service runs a keeper of its own; others are welcome.