Order types: grid
What it does
Section titled “What it does”A grid sets out price levels. Between each pair of neighbouring levels sits one order box. It sells at the higher price, then flips and buys back at the lower one, again and again. A grid of 5 levels is 4 boxes, created in one transaction.
- Every round trip makes money by construction: the contract requires each box’s buy price to be below its sell price.
- Profit stays in the boxes until the end. You’re paid when the fills run out, when you cancel, or at the refund after expiry.
- You cap the number of flips, which caps what you can pay in fees.
- A cooldown of at least one block separates a box’s flips.
When to use it
Section titled “When to use it”- In a market you expect to move up and down within a range.
- When you’d rather collect many small spreads than bet on a direction.
What you pay
Section titled “What you pay”- The order fee on each fill. See fees.
- An execution fee per flip, within your cap. Kadia’s settler charges only what each fill costs.
- ERG set aside at creation, as for a DCA: the fees for every flip, the final payout box’s minimum and one rent cushion.
What can go wrong
Section titled “What can go wrong”- Too-close levels earn nothing. If your levels are closer together than about twice the order fee, each round trip’s spread barely covers the fees. Space them wider; the contract only checks that they’re in the right order.
- Churn. A settler could flip a box as often as the cooldown allows, using up your flips and fees. Each round trip still pays you the spread between its levels, and a longer cooldown slows this down.
- The price can leave your range. If it falls below your lowest level, you end up holding the bought asset. If it rises above your highest, you end up holding the other one, until the price comes back or you cancel.
- A grid lives at most a year (262,800 blocks), then it’s refunded.
Technical details
Sources: kadia-dex docs/guide/how-it-works.md, docs/guide/fees.md and the order-type decisions in docs/decisions/ at commit 7ce1595 (7ce159587dc8c0bd78d6a5fbe0f7f8e7dde3920e).