Rules
Four kinds of rule, run by keepers.
A rule lives in your vault. When its condition holds, any keeper may call run; the vault checks the condition, the limits and the price again by itself, then trades through the engine.
| Kind | Fires when | Does |
|---|---|---|
| Stop-loss | a long's price falls to the level, a short's rises to it | closes all or a share of the position |
| Take-profit | a long's price rises to the level, a short's falls to it | closes all or a share of the position |
| Entry | the price falls to (or rises to) the level | opens a long or a short with the margin and leverage written in the rule |
| Recurring | every N hours | opens or adds to a position, up to a number of runs |
The box
Every opening by a rule or by the agent counts against the vault's box: margin per opening, margin per day (a level that drains evenly over 24 hours), the shortest gap between two openings, and the highest leverage. Stop-losses and take-profits are not capped by the box: they are there to get out.
When a position is closed in full, its stop-loss and take-profit rules end by themselves. A rule guarantees neither the price nor the execution: a fast move can liquidate a position before its stop runs.
Playbooks
A rule that ran at least once can be shared as a playbook on the marketplace. When another vault copies it and it runs there, its author receives 70% of the protocol fee of that run.