OptiSize

The hyperbolic shape of the xy=k slippage curve makes it important to consider order size when doing a swap.

Consideration of gas fees creates a convex optimization problem.

What order size gives the best outcome, in terms of the highest percent realization of spot price value?

When researching this question, we found it was easy to approximate by simulating transactions. Empirically we observed many wallets using this size.

A closed-form solution can be derived using calculus.

We call this the OptiSize formula.

Last updated