perpilot:~/docs/strategies

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.

KindFires whenDoes
Stop-lossa long's price falls to the level, a short's rises to itcloses all or a share of the position
Take-profita long's price rises to the level, a short's falls to itcloses all or a share of the position
Entrythe price falls to (or rises to) the levelopens a long or a short with the margin and leverage written in the rule
Recurringevery N hoursopens 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.