duality-labs / duality

Apache License 2.0
10 stars 5 forks source link

Implement tradfi limit order API #246

Closed PossibilityResult closed 1 year ago

PossibilityResult commented 1 year ago

I think it'd be extremely valuable to have a tx type for a price quote, where market makers can submit expiring quotes for liquidity to be traded at.

The user flow would look like this:

  1. Every block a market makers sets bid ask prices and amounts they'd be willing to trade at.
  2. At the top of the block, the bid and ask orders are placed as limit order
  3. At the end of the block they are completely withdrawn (whether or filled or unfilled)

This prevents the "stale order sniping" and inventory risk that market makers typically take on when LPing. It reduces metrics like TVL, since liquidity is only "flashed" into the pools, but we can come up with other metrics.

Next steps:

teddyknox commented 1 year ago

https://www.investopedia.com/terms/f/fok.asp

The best way to implement this would be as a kind of special limit order.

teddyknox commented 1 year ago

imo this is the same as the limitPrice feature we just implemented, except with MEV ordering built-in if we integrate with Skip we won't need this

teddyknox commented 1 year ago

We already implement this behavior in Swap(), let's repurpose this issue to refer to the idea that we should expose this functionality as a limit order type.